Index: clang/include/clang/Basic/BuiltinsAMDGPU.def =================================================================== --- clang/include/clang/Basic/BuiltinsAMDGPU.def +++ clang/include/clang/Basic/BuiltinsAMDGPU.def @@ -259,6 +259,9 @@ // GFX11+ only builtins. //===----------------------------------------------------------------------===// +// TODO: This is a no-op in wave32. Should the builtin require wavefrontsize64? +TARGET_BUILTIN(__builtin_amdgcn_permlane64, "UiUi", "nc", "gfx11-insts") + //===----------------------------------------------------------------------===// // WMMA builtins. // Postfix w32 indicates the builtin requires wavefront size of 32. Index: clang/test/CodeGenOpenCL/builtins-amdgcn-gfx11.cl =================================================================== --- clang/test/CodeGenOpenCL/builtins-amdgcn-gfx11.cl +++ clang/test/CodeGenOpenCL/builtins-amdgcn-gfx11.cl @@ -31,3 +31,9 @@ { *out = __builtin_amdgcn_ds_bvh_stack_rtn(addr, data, data1, 128); } + +// CHECK-LABEL: @test_permlane64( +// CHECK: call i32 @llvm.amdgcn.permlane64(i32 %a) +void test_permlane64(global uint* out, uint a) { + *out = __builtin_amdgcn_permlane64(a); +} Index: clang/test/SemaOpenCL/builtins-amdgcn-gfx11.cl =================================================================== --- clang/test/SemaOpenCL/builtins-amdgcn-gfx11.cl +++ clang/test/SemaOpenCL/builtins-amdgcn-gfx11.cl @@ -13,4 +13,6 @@ #if __has_builtin(__builtin_amdgcn_s_sendmsg_rtnl) *out2 = __builtin_amdgcn_s_sendmsg_rtnl(x); // GFX11-error {{argument to '__builtin_amdgcn_s_sendmsg_rtnl' must be a constant integer}} #endif + + *out1 = __builtin_amdgcn_permlane64(x); // GFX10-error {{'__builtin_amdgcn_permlane64' needs target feature gfx11-insts}} } Index: llvm/include/llvm/IR/IntrinsicsAMDGPU.td =================================================================== --- llvm/include/llvm/IR/IntrinsicsAMDGPU.td +++ llvm/include/llvm/IR/IntrinsicsAMDGPU.td @@ -1991,6 +1991,7 @@ // llvm.amdgcn.permlane64 def int_amdgcn_permlane64 : + ClangBuiltin<"__builtin_amdgcn_permlane64">, Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [IntrNoMem, IntrConvergent, IntrWillReturn]>;