r225314 - Add __builtin_amdgpu_class

Matt Arsenault Matthew.Arsenault at amd.com
Tue Jan 6 15:14:58 PST 2015


Author: arsenm
Date: Tue Jan  6 17:14:57 2015
New Revision: 225314

URL: http://llvm.org/viewvc/llvm-project?rev=225314&view=rev
Log:
Add __builtin_amdgpu_class

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=225314&r1=225313&r2=225314&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsR600.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsR600.def Tue Jan  6 17:14:57 2015
@@ -30,5 +30,7 @@ BUILTIN(__builtin_amdgpu_rsq_clamped, "d
 BUILTIN(__builtin_amdgpu_rsq_clampedf, "ff", "nc")
 BUILTIN(__builtin_amdgpu_ldexp, "ddi", "nc")
 BUILTIN(__builtin_amdgpu_ldexpf, "ffi", "nc")
+BUILTIN(__builtin_amdgpu_class, "bdi", "nc")
+BUILTIN(__builtin_amdgpu_classf, "bfi", "nc")
 
 #undef BUILTIN

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=225314&r1=225313&r2=225314&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Jan  6 17:14:57 2015
@@ -6393,6 +6393,9 @@ Value *CodeGenFunction::EmitR600BuiltinE
   case R600::BI__builtin_amdgpu_ldexp:
   case R600::BI__builtin_amdgpu_ldexpf:
     return emitFPIntBuiltin(*this, E, Intrinsic::AMDGPU_ldexp);
+  case R600::BI__builtin_amdgpu_class:
+  case R600::BI__builtin_amdgpu_classf:
+    return emitFPIntBuiltin(*this, E, Intrinsic::AMDGPU_class);
    default:
     return nullptr;
   }

Modified: cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl?rev=225314&r1=225313&r2=225314&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/builtins-r600.cl Tue Jan  6 17:14:57 2015
@@ -127,3 +127,17 @@ void test_ldexp_f64(global double* out,
 {
   *out = __builtin_amdgpu_ldexp(a, b);
 }
+
+// CHECK-LABEL: @test_class_f32
+// CHECK: call i1 @llvm.AMDGPU.class.f32
+void test_class_f32(global float* out, float a, int b)
+{
+  *out = __builtin_amdgpu_classf(a, b);
+}
+
+// CHECK-LABEL: @test_class_f64
+// CHECK: call i1 @llvm.AMDGPU.class.f64
+void test_class_f64(global double* out, double a, int b)
+{
+  *out = __builtin_amdgpu_class(a, b);
+}





More information about the cfe-commits mailing list