r220339 - R600: Update for div_fmas intrinsic change
Matt Arsenault
Matthew.Arsenault at amd.com
Tue Oct 21 15:21:41 PDT 2014
Author: arsenm
Date: Tue Oct 21 17:21:41 2014
New Revision: 220339
URL: http://llvm.org/viewvc/llvm-project?rev=220339&view=rev
Log:
R600: Update for div_fmas intrinsic change
Modified:
cfe/trunk/include/clang/Basic/BuiltinsR600.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl
Modified: cfe/trunk/include/clang/Basic/BuiltinsR600.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsR600.def?rev=220339&r1=220338&r2=220339&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsR600.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsR600.def Tue Oct 21 17:21:41 2014
@@ -16,8 +16,8 @@
BUILTIN(__builtin_amdgpu_div_scale, "dddbb*", "n")
BUILTIN(__builtin_amdgpu_div_scalef, "fffbb*", "n")
-BUILTIN(__builtin_amdgpu_div_fmas, "dddd", "nc")
-BUILTIN(__builtin_amdgpu_div_fmasf, "ffff", "nc")
+BUILTIN(__builtin_amdgpu_div_fmas, "ddddb", "nc")
+BUILTIN(__builtin_amdgpu_div_fmasf, "ffffb", "nc")
BUILTIN(__builtin_amdgpu_div_fixup, "dddd", "nc")
BUILTIN(__builtin_amdgpu_div_fixupf, "ffff", "nc")
BUILTIN(__builtin_amdgpu_trig_preop, "ddi", "nc")
Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=220339&r1=220338&r2=220339&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Oct 21 17:21:41 2014
@@ -6153,8 +6153,17 @@ Value *CodeGenFunction::EmitR600BuiltinE
return Result;
}
case R600::BI__builtin_amdgpu_div_fmas:
- case R600::BI__builtin_amdgpu_div_fmasf:
- return emitTernaryFPBuiltin(*this, E, Intrinsic::AMDGPU_div_fmas);
+ case R600::BI__builtin_amdgpu_div_fmasf: {
+ llvm::Value *Src0 = EmitScalarExpr(E->getArg(0));
+ llvm::Value *Src1 = EmitScalarExpr(E->getArg(1));
+ llvm::Value *Src2 = EmitScalarExpr(E->getArg(2));
+ llvm::Value *Src3 = EmitScalarExpr(E->getArg(3));
+
+ llvm::Value *F = CGM.getIntrinsic(Intrinsic::AMDGPU_div_fmas,
+ Src0->getType());
+ llvm::Value *Src3ToBool = Builder.CreateIsNotNull(Src3);
+ return Builder.CreateCall4(F, Src0, Src1, Src2, Src3ToBool);
+ }
case R600::BI__builtin_amdgpu_div_fixup:
case R600::BI__builtin_amdgpu_div_fixupf:
return emitTernaryFPBuiltin(*this, E, Intrinsic::AMDGPU_div_fixup);
Modified: cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl?rev=220339&r1=220338&r2=220339&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl Tue Oct 21 17:21:41 2014
@@ -31,16 +31,16 @@ void test_div_scale_f32(global float* ou
// CHECK-LABEL: @test_div_fmas_f32
// CHECK: call float @llvm.AMDGPU.div.fmas.f32
-void test_div_fmas_f32(global float* out, float a, float b, float c)
+void test_div_fmas_f32(global float* out, float a, float b, float c, int d)
{
- *out = __builtin_amdgpu_div_fmasf(a, b, c);
+ *out = __builtin_amdgpu_div_fmasf(a, b, c, d);
}
// CHECK-LABEL: @test_div_fmas_f64
// CHECK: call double @llvm.AMDGPU.div.fmas.f64
-void test_div_fmas_f64(global double* out, double a, double b, double c)
+void test_div_fmas_f64(global double* out, double a, double b, double c, int d)
{
- *out = __builtin_amdgpu_div_fmas(a, b, c);
+ *out = __builtin_amdgpu_div_fmas(a, b, c, d);
}
// CHECK-LABEL: @test_div_fixup_f32
More information about the cfe-commits
mailing list