Skip to content

Commit f59f116

Browse files
committed
AMDGPU: Add __builtin_amdgcn_permlane64
1 parent c427ee9 commit f59f116

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ TARGET_BUILTIN(__builtin_amdgcn_image_bvh_intersect_ray_lh, "V4UiWUifV4fV4hV4hV4
259259
// GFX11+ only builtins.
260260
//===----------------------------------------------------------------------===//
261261

262+
// TODO: This is a no-op in wave32. Should the builtin require wavefrontsize64?
263+
TARGET_BUILTIN(__builtin_amdgcn_permlane64, "UiUi", "nc", "gfx11-insts")
264+
262265
//===----------------------------------------------------------------------===//
263266
// WMMA builtins.
264267
// Postfix w32 indicates the builtin requires wavefront size of 32.

clang/test/CodeGenOpenCL/builtins-amdgcn-gfx11.cl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ void test_ds_bvh_stack_rtn(global uint2* out, uint addr, uint data, uint4 data1)
3131
{
3232
*out = __builtin_amdgcn_ds_bvh_stack_rtn(addr, data, data1, 128);
3333
}
34+
35+
// CHECK-LABEL: @test_permlane64(
36+
// CHECK: call i32 @llvm.amdgcn.permlane64(i32 %a)
37+
void test_permlane64(global uint* out, uint a) {
38+
*out = __builtin_amdgcn_permlane64(a);
39+
}

clang/test/SemaOpenCL/builtins-amdgcn-gfx11.cl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ void test(global uint* out1, global ulong* out2, int x) {
1313
#if __has_builtin(__builtin_amdgcn_s_sendmsg_rtnl)
1414
*out2 = __builtin_amdgcn_s_sendmsg_rtnl(x); // GFX11-error {{argument to '__builtin_amdgcn_s_sendmsg_rtnl' must be a constant integer}}
1515
#endif
16+
17+
*out1 = __builtin_amdgcn_permlane64(x); // GFX10-error {{'__builtin_amdgcn_permlane64' needs target feature gfx11-insts}}
1618
}

llvm/include/llvm/IR/IntrinsicsAMDGPU.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,6 +1991,7 @@ def int_amdgcn_image_bvh_intersect_ray :
19911991

19921992
// llvm.amdgcn.permlane64 <src0>
19931993
def int_amdgcn_permlane64 :
1994+
ClangBuiltin<"__builtin_amdgcn_permlane64">,
19941995
Intrinsic<[llvm_i32_ty], [llvm_i32_ty],
19951996
[IntrNoMem, IntrConvergent, IntrWillReturn]>;
19961997

0 commit comments

Comments
 (0)