[clang] [llvm] [AMDGPU] Implement builtin and intrinsic for s_wait_idle (PR #244238)

Fabian Ritter via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 30 02:30:38 PST 2026


================
@@ -96,6 +96,14 @@ void test_s_memtime(global ulong* out)
     *out = __builtin_amdgcn_s_memtime();
 }
 
+// CHECK-LABEL: @test_s_wait_idle
+// CHECK: {{.*}}call{{.*}} void @llvm.amdgcn.s.wait.idle()
+void test_s_wait_idle()
+{
+  if (__builtin_amdgcn_is_invocable(__builtin_amdgcn_s_wait_idle))
----------------
ritter-x2a wrote:

I've also added a test without the `is_invocable` call to `clang/test/CIR/CodeGenHIP/builtins-amdgcn-gfx10.hip`.
I've still kept the test with `is_invocable` here, because, as far as I can tell, the purpose of this test is to test the gfx10-specific builtins, and the other tests in this file are also guarded by `__builtin_amdgcn_is_invocable`. If there are strong opinions that these builtins should also be tested in OpenCL without `is_invocable`, we should duplicate this test without the SPIR-V checkline.

https://github.com/llvm/llvm-project/pull/244238


More information about the cfe-commits mailing list