[PATCH] D23682: AMDGPU: Add Clang builtin intrinsics for ds_swizzle
Changpeng Fang via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 18 11:11:16 PDT 2016
cfang created this revision.
cfang added reviewers: wdng, arsenm, tstellarAMD.
cfang added subscribers: arsenm, llvm-commits.
Herald added a subscriber: kzhuravl.
declare i32 @llvm.amdgcn.ds.swizzle(i32, i32) // The second argument is an immediate of i32.
https://reviews.llvm.org/D23682
Files:
include/clang/Basic/BuiltinsAMDGPU.def
lib/CodeGen/CGBuiltin.cpp
test/CodeGenOpenCL/builtins-amdgcn.cl
Index: test/CodeGenOpenCL/builtins-amdgcn.cl
===================================================================
--- test/CodeGenOpenCL/builtins-amdgcn.cl
+++ test/CodeGenOpenCL/builtins-amdgcn.cl
@@ -228,6 +228,13 @@
*out = __builtin_amdgcn_uicmpl(a, b, 30+5);
}
+// CHECK-LABEL: @test_ds_swizzle
+// CHECK: call i32 @llvm.amdgcn.ds.swizzle(i32 %a, i32 32)
+void test_ds_swizzle(global int* out, int a)
+{
+ *out = __builtin_amdgcn_ds_swizzle(a, 32);
+}
+
// CHECK-LABEL: @test_fcmp_f32
// CHECK: call i64 @llvm.amdgcn.fcmp.f32(float %a, float %b, i32 5)
void test_fcmp_f32(global ulong* out, float a, float b)
Index: lib/CodeGen/CGBuiltin.cpp
===================================================================
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -7652,6 +7652,9 @@
llvm::Value *Src3ToBool = Builder.CreateIsNotNull(Src3);
return Builder.CreateCall(F, {Src0, Src1, Src2, Src3ToBool});
}
+
+ case AMDGPU::BI__builtin_amdgcn_ds_swizzle:
+ return emitBinaryBuiltin(*this, E, Intrinsic::amdgcn_ds_swizzle);
case AMDGPU::BI__builtin_amdgcn_div_fixup:
case AMDGPU::BI__builtin_amdgcn_div_fixupf:
return emitTernaryBuiltin(*this, E, Intrinsic::amdgcn_div_fixup);
Index: include/clang/Basic/BuiltinsAMDGPU.def
===================================================================
--- include/clang/Basic/BuiltinsAMDGPU.def
+++ include/clang/Basic/BuiltinsAMDGPU.def
@@ -76,6 +76,7 @@
BUILTIN(__builtin_amdgcn_sicmpl, "LUiLiLiIi", "nc")
BUILTIN(__builtin_amdgcn_fcmp, "LUiddIi", "nc")
BUILTIN(__builtin_amdgcn_fcmpf, "LUiffIi", "nc")
+BUILTIN(__builtin_amdgcn_ds_swizzle, "iii", "nc")
//===----------------------------------------------------------------------===//
// VI+ only builtins.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23682.68574.patch
Type: text/x-patch
Size: 1751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160818/2ba13b36/attachment.bin>
More information about the llvm-commits
mailing list