mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-12 07:37:34 +00:00
Add llvm.fabs intrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157594 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7bb9f063be
commit
b34d3aa35b
@ -259,6 +259,7 @@ let Properties = [IntrReadMem] in {
|
||||
def int_log2 : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
||||
def int_exp : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
||||
def int_exp2 : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
||||
def int_fabs : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>]>;
|
||||
}
|
||||
|
||||
let Properties = [IntrNoMem] in {
|
||||
|
@ -4920,6 +4920,11 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
|
||||
case Intrinsic::pow:
|
||||
visitPow(I);
|
||||
return 0;
|
||||
case Intrinsic::fabs:
|
||||
setValue(&I, DAG.getNode(ISD::FABS, dl,
|
||||
getValue(I.getArgOperand(0)).getValueType(),
|
||||
getValue(I.getArgOperand(0))));
|
||||
return 0;
|
||||
case Intrinsic::fma:
|
||||
setValue(&I, DAG.getNode(ISD::FMA, dl,
|
||||
getValue(I.getArgOperand(0)).getValueType(),
|
||||
|
21
test/CodeGen/NVPTX/intrinsics.ll
Normal file
21
test/CodeGen/NVPTX/intrinsics.ll
Normal file
@ -0,0 +1,21 @@
|
||||
; RUN: llc < %s -march=nvptx -mcpu=sm_10 | FileCheck %s
|
||||
; RUN: llc < %s -march=nvptx64 -mcpu=sm_10 | FileCheck %s
|
||||
; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
|
||||
; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s
|
||||
|
||||
define ptx_device float @test_fabsf(float %f) {
|
||||
; CHECK: abs.f32 %f0, %f0;
|
||||
; CHECK: ret;
|
||||
%x = call float @llvm.fabs.f32(float %f)
|
||||
ret float %x
|
||||
}
|
||||
|
||||
define ptx_device double @test_fabs(double %d) {
|
||||
; CHECK: abs.f64 %fl0, %fl0;
|
||||
; CHECK: ret;
|
||||
%x = call double @llvm.fabs.f64(double %d)
|
||||
ret double %x
|
||||
}
|
||||
|
||||
declare float @llvm.fabs.f32(float)
|
||||
declare double @llvm.fabs.f64(double)
|
Loading…
x
Reference in New Issue
Block a user