[llvm] [AMDGPU] Optimize out s_barrier_signal/_wait (PR #116993)

Piotr Sobczak via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 04:03:29 PST 2024


================
@@ -0,0 +1,56 @@
+; RUN: llc -mtriple=amdgcn -mcpu=gfx1200 < %s | FileCheck %s
+; RUN: llc -mtriple=amdgcn -mcpu=gfx1200 < %s -global-isel | FileCheck %s
+
+; CHECK-LABEL: {{^}}signal_unknown_wgs:
+; CHECK: s_barrier_signal
+define amdgpu_kernel void @signal_unknown_wgs() {
+  tail call void @llvm.amdgcn.s.barrier.signal(i32 -1) #0
+  ret void
+}
+
+; CHECK-LABEL: {{^}}signal_flat_wgs_attr_32_128:
+; CHECK: s_barrier_signal
+define amdgpu_kernel void @signal_flat_wgs_attr_32_128() #1 {
+  tail call void @llvm.amdgcn.s.barrier.signal(i32 -1) #0
+  ret void
+}
+
+; CHECK-LABEL: {{^}}signal_flat_wgs_attr_32_64:
+; CHECK: :
+; CHECK-NEXT: ; wave barrier
+; CHECK-NEXT: s_endpgm
+define amdgpu_kernel void @signal_flat_wgs_attr_32_64() #2 {
+  tail call void @llvm.amdgcn.s.barrier.signal(i32 -1) #0
+  ret void
+}
+
+
+; CHECK-LABEL: {{^}}wait_unknown_wgs:
+; CHECK: s_barrier_wait
+define amdgpu_kernel void @wait_unknown_wgs() {
+  tail call void @llvm.amdgcn.s.barrier.wait(i16 -1) #0
+  ret void
+}
+
+; CHECK-LABEL: {{^}}wait_flat_wgs_attr_32_128:
+; CHECK: s_barrier_wait
+define amdgpu_kernel void @wait_flat_wgs_attr_32_128() #1 {
+  tail call void @llvm.amdgcn.s.barrier.wait(i16 -1) #0
----------------
piotrAMD wrote:

Done.

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


More information about the llvm-commits mailing list