| ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 6 |
| ; RUN: llc -global-isel=0 -mtriple=amdgpu6.00-mesa-mesa3d -stop-after=postrapseudos < %s | FileCheck -check-prefix=GFX6-SDAG %s |
| ; RUN: llc -global-isel=1 -mtriple=amdgpu6.00-mesa-mesa3d -stop-after=postrapseudos < %s | FileCheck -check-prefix=GFX6-GISEL %s |
| ; RUN: llc -global-isel=0 -mtriple=amdgpu9.00-mesa-mesa3d -stop-after=postrapseudos < %s | FileCheck -check-prefix=GFX9-SDAG %s |
| ; RUN: llc -global-isel=1 -mtriple=amdgpu9.00-mesa-mesa3d -stop-after=postrapseudos < %s | FileCheck -check-prefix=GFX9-GISEL %s |
| |
| ; Make sure the op is emitted bundled with a waitcnt with and without the retry loop, and the bundle is not removed by ExpandPostRAPseudos. |
| |
| define amdgpu_kernel void @gws_barrier_offset0(i32 %val) #0 { |
| ; GFX6-SDAG-LABEL: name: gws_barrier_offset0 |
| ; GFX6-SDAG: bb.0 (%ir-block.0): |
| ; GFX6-SDAG-NEXT: successors: %bb.1(0x80000000) |
| ; GFX6-SDAG-NEXT: liveins: $sgpr8_sgpr9 |
| ; GFX6-SDAG-NEXT: {{ $}} |
| ; GFX6-SDAG-NEXT: renamable $sgpr0 = S_LOAD_DWORD_IMM killed renamable $sgpr8_sgpr9, 0, 0 :: (dereferenceable invariant load (s32) from %ir.val.kernarg.offset1, align 16, addrspace 4) |
| ; GFX6-SDAG-NEXT: $vgpr0 = V_MOV_B32_e32 killed $sgpr0, implicit $exec, implicit $exec |
| ; GFX6-SDAG-NEXT: $m0 = S_MOV_B32 0 |
| ; GFX6-SDAG-NEXT: {{ $}} |
| ; GFX6-SDAG-NEXT: bb.1: |
| ; GFX6-SDAG-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000) |
| ; GFX6-SDAG-NEXT: liveins: $vgpr0 |
| ; GFX6-SDAG-NEXT: {{ $}} |
| ; GFX6-SDAG-NEXT: S_SETREG_IMM32_B32 0, 515, implicit-def $mode, implicit $mode |
| ; GFX6-SDAG-NEXT: BUNDLE implicit renamable $vgpr0, implicit $m0, implicit $exec :: (load (s32) from custom "GWSResource") { |
| ; GFX6-SDAG-NEXT: DS_GWS_BARRIER renamable $vgpr0, 0, implicit $m0, implicit $exec :: (load (s32) from custom "GWSResource") |
| ; GFX6-SDAG-NEXT: S_WAITCNT .Vmcnt_0_Expcnt_0_Lgkmcnt_0 |
| ; GFX6-SDAG-NEXT: } |
| ; GFX6-SDAG-NEXT: renamable $sgpr0 = S_GETREG_B32 515, implicit $mode |
| ; GFX6-SDAG-NEXT: S_CMP_LG_U32 killed renamable $sgpr0, 0, implicit-def $scc |
| ; GFX6-SDAG-NEXT: S_CBRANCH_SCC1 %bb.1, implicit killed $scc |
| ; GFX6-SDAG-NEXT: {{ $}} |
| ; GFX6-SDAG-NEXT: bb.2: |
| ; GFX6-SDAG-NEXT: S_ENDPGM 0 |
| ; |
| ; GFX6-GISEL-LABEL: name: gws_barrier_offset0 |
| ; GFX6-GISEL: bb.0 (%ir-block.0): |
| ; GFX6-GISEL-NEXT: successors: %bb.1(0x80000000) |
| ; GFX6-GISEL-NEXT: liveins: $sgpr8_sgpr9 |
| ; GFX6-GISEL-NEXT: {{ $}} |
| ; GFX6-GISEL-NEXT: renamable $sgpr0 = S_LOAD_DWORD_IMM killed renamable $sgpr8_sgpr9, 0, 0 :: (dereferenceable invariant load (i32) from %ir.val.kernarg.offset1, align 16, addrspace 4) |
| ; GFX6-GISEL-NEXT: $vgpr0 = V_MOV_B32_e32 killed $sgpr0, implicit $exec, implicit $exec |
| ; GFX6-GISEL-NEXT: $m0 = S_MOV_B32 0 |
| ; GFX6-GISEL-NEXT: {{ $}} |
| ; GFX6-GISEL-NEXT: bb.1: |
| ; GFX6-GISEL-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000) |
| ; GFX6-GISEL-NEXT: liveins: $vgpr0 |
| ; GFX6-GISEL-NEXT: {{ $}} |
| ; GFX6-GISEL-NEXT: S_SETREG_IMM32_B32 0, 515, implicit-def $mode, implicit $mode |
| ; GFX6-GISEL-NEXT: BUNDLE implicit renamable $vgpr0, implicit $m0, implicit $exec :: (load (i32) from custom "GWSResource") { |
| ; GFX6-GISEL-NEXT: DS_GWS_BARRIER renamable $vgpr0, 0, implicit $m0, implicit $exec :: (load (i32) from custom "GWSResource") |
| ; GFX6-GISEL-NEXT: S_WAITCNT .Vmcnt_0_Expcnt_0_Lgkmcnt_0 |
| ; GFX6-GISEL-NEXT: } |
| ; GFX6-GISEL-NEXT: renamable $sgpr0 = S_GETREG_B32 515, implicit $mode |
| ; GFX6-GISEL-NEXT: S_CMP_LG_U32 killed renamable $sgpr0, 0, implicit-def $scc |
| ; GFX6-GISEL-NEXT: S_CBRANCH_SCC1 %bb.1, implicit killed $scc |
| ; GFX6-GISEL-NEXT: {{ $}} |
| ; GFX6-GISEL-NEXT: bb.2: |
| ; GFX6-GISEL-NEXT: S_ENDPGM 0 |
| ; |
| ; GFX9-SDAG-LABEL: name: gws_barrier_offset0 |
| ; GFX9-SDAG: bb.0 (%ir-block.0): |
| ; GFX9-SDAG-NEXT: liveins: $sgpr8_sgpr9 |
| ; GFX9-SDAG-NEXT: {{ $}} |
| ; GFX9-SDAG-NEXT: renamable $sgpr0 = S_LOAD_DWORD_IMM killed renamable $sgpr8_sgpr9, 0, 0 :: (dereferenceable invariant load (s32) from %ir.val.kernarg.offset1, align 16, addrspace 4) |
| ; GFX9-SDAG-NEXT: $vgpr0 = V_MOV_B32_e32 killed $sgpr0, implicit $exec, implicit $exec |
| ; GFX9-SDAG-NEXT: $m0 = S_MOV_B32 0 |
| ; GFX9-SDAG-NEXT: BUNDLE implicit killed renamable $vgpr0, implicit $m0, implicit $exec :: (load (s32) from custom "GWSResource") { |
| ; GFX9-SDAG-NEXT: DS_GWS_BARRIER renamable $vgpr0, 0, implicit $m0, implicit $exec :: (load (s32) from custom "GWSResource") |
| ; GFX9-SDAG-NEXT: S_WAITCNT .Vmcnt_0_Expcnt_0_Lgkmcnt_0 |
| ; GFX9-SDAG-NEXT: } |
| ; GFX9-SDAG-NEXT: S_ENDPGM 0 |
| ; |
| ; GFX9-GISEL-LABEL: name: gws_barrier_offset0 |
| ; GFX9-GISEL: bb.0 (%ir-block.0): |
| ; GFX9-GISEL-NEXT: liveins: $sgpr8_sgpr9 |
| ; GFX9-GISEL-NEXT: {{ $}} |
| ; GFX9-GISEL-NEXT: renamable $sgpr0 = S_LOAD_DWORD_IMM killed renamable $sgpr8_sgpr9, 0, 0 :: (dereferenceable invariant load (i32) from %ir.val.kernarg.offset1, align 16, addrspace 4) |
| ; GFX9-GISEL-NEXT: $vgpr0 = V_MOV_B32_e32 killed $sgpr0, implicit $exec, implicit $exec |
| ; GFX9-GISEL-NEXT: $m0 = S_MOV_B32 0 |
| ; GFX9-GISEL-NEXT: BUNDLE implicit killed renamable $vgpr0, implicit $m0, implicit $exec :: (load (i32) from custom "GWSResource") { |
| ; GFX9-GISEL-NEXT: DS_GWS_BARRIER renamable $vgpr0, 0, implicit $m0, implicit $exec :: (load (i32) from custom "GWSResource") |
| ; GFX9-GISEL-NEXT: S_WAITCNT .Vmcnt_0_Expcnt_0_Lgkmcnt_0 |
| ; GFX9-GISEL-NEXT: } |
| ; GFX9-GISEL-NEXT: S_ENDPGM 0 |
| call void @llvm.amdgcn.ds.gws.barrier(i32 %val, i32 0) |
| ret void |
| } |
| |
| define amdgpu_kernel void @gws_barrier_offset63(i32 %val) #0 { |
| ; GFX6-SDAG-LABEL: name: gws_barrier_offset63 |
| ; GFX6-SDAG: bb.0 (%ir-block.0): |
| ; GFX6-SDAG-NEXT: successors: %bb.1(0x80000000) |
| ; GFX6-SDAG-NEXT: liveins: $sgpr8_sgpr9 |
| ; GFX6-SDAG-NEXT: {{ $}} |
| ; GFX6-SDAG-NEXT: renamable $sgpr0 = S_LOAD_DWORD_IMM killed renamable $sgpr8_sgpr9, 0, 0 :: (dereferenceable invariant load (s32) from %ir.val.kernarg.offset1, align 16, addrspace 4) |
| ; GFX6-SDAG-NEXT: $vgpr0 = V_MOV_B32_e32 killed $sgpr0, implicit $exec, implicit $exec |
| ; GFX6-SDAG-NEXT: $m0 = S_MOV_B32 0 |
| ; GFX6-SDAG-NEXT: {{ $}} |
| ; GFX6-SDAG-NEXT: bb.1: |
| ; GFX6-SDAG-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000) |
| ; GFX6-SDAG-NEXT: liveins: $vgpr0 |
| ; GFX6-SDAG-NEXT: {{ $}} |
| ; GFX6-SDAG-NEXT: S_SETREG_IMM32_B32 0, 515, implicit-def $mode, implicit $mode |
| ; GFX6-SDAG-NEXT: BUNDLE implicit renamable $vgpr0, implicit $m0, implicit $exec :: (load (s32) from custom "GWSResource") { |
| ; GFX6-SDAG-NEXT: DS_GWS_BARRIER renamable $vgpr0, 63, implicit $m0, implicit $exec :: (load (s32) from custom "GWSResource") |
| ; GFX6-SDAG-NEXT: S_WAITCNT .Vmcnt_0_Expcnt_0_Lgkmcnt_0 |
| ; GFX6-SDAG-NEXT: } |
| ; GFX6-SDAG-NEXT: renamable $sgpr0 = S_GETREG_B32 515, implicit $mode |
| ; GFX6-SDAG-NEXT: S_CMP_LG_U32 killed renamable $sgpr0, 0, implicit-def $scc |
| ; GFX6-SDAG-NEXT: S_CBRANCH_SCC1 %bb.1, implicit killed $scc |
| ; GFX6-SDAG-NEXT: {{ $}} |
| ; GFX6-SDAG-NEXT: bb.2: |
| ; GFX6-SDAG-NEXT: S_ENDPGM 0 |
| ; |
| ; GFX6-GISEL-LABEL: name: gws_barrier_offset63 |
| ; GFX6-GISEL: bb.0 (%ir-block.0): |
| ; GFX6-GISEL-NEXT: successors: %bb.1(0x80000000) |
| ; GFX6-GISEL-NEXT: liveins: $sgpr8_sgpr9 |
| ; GFX6-GISEL-NEXT: {{ $}} |
| ; GFX6-GISEL-NEXT: renamable $sgpr0 = S_LOAD_DWORD_IMM killed renamable $sgpr8_sgpr9, 0, 0 :: (dereferenceable invariant load (i32) from %ir.val.kernarg.offset1, align 16, addrspace 4) |
| ; GFX6-GISEL-NEXT: $vgpr0 = V_MOV_B32_e32 killed $sgpr0, implicit $exec, implicit $exec |
| ; GFX6-GISEL-NEXT: $m0 = S_MOV_B32 0 |
| ; GFX6-GISEL-NEXT: {{ $}} |
| ; GFX6-GISEL-NEXT: bb.1: |
| ; GFX6-GISEL-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000) |
| ; GFX6-GISEL-NEXT: liveins: $vgpr0 |
| ; GFX6-GISEL-NEXT: {{ $}} |
| ; GFX6-GISEL-NEXT: S_SETREG_IMM32_B32 0, 515, implicit-def $mode, implicit $mode |
| ; GFX6-GISEL-NEXT: BUNDLE implicit renamable $vgpr0, implicit $m0, implicit $exec :: (load (i32) from custom "GWSResource") { |
| ; GFX6-GISEL-NEXT: DS_GWS_BARRIER renamable $vgpr0, 63, implicit $m0, implicit $exec :: (load (i32) from custom "GWSResource") |
| ; GFX6-GISEL-NEXT: S_WAITCNT .Vmcnt_0_Expcnt_0_Lgkmcnt_0 |
| ; GFX6-GISEL-NEXT: } |
| ; GFX6-GISEL-NEXT: renamable $sgpr0 = S_GETREG_B32 515, implicit $mode |
| ; GFX6-GISEL-NEXT: S_CMP_LG_U32 killed renamable $sgpr0, 0, implicit-def $scc |
| ; GFX6-GISEL-NEXT: S_CBRANCH_SCC1 %bb.1, implicit killed $scc |
| ; GFX6-GISEL-NEXT: {{ $}} |
| ; GFX6-GISEL-NEXT: bb.2: |
| ; GFX6-GISEL-NEXT: S_ENDPGM 0 |
| ; |
| ; GFX9-SDAG-LABEL: name: gws_barrier_offset63 |
| ; GFX9-SDAG: bb.0 (%ir-block.0): |
| ; GFX9-SDAG-NEXT: liveins: $sgpr8_sgpr9 |
| ; GFX9-SDAG-NEXT: {{ $}} |
| ; GFX9-SDAG-NEXT: renamable $sgpr0 = S_LOAD_DWORD_IMM killed renamable $sgpr8_sgpr9, 0, 0 :: (dereferenceable invariant load (s32) from %ir.val.kernarg.offset1, align 16, addrspace 4) |
| ; GFX9-SDAG-NEXT: $vgpr0 = V_MOV_B32_e32 killed $sgpr0, implicit $exec, implicit $exec |
| ; GFX9-SDAG-NEXT: $m0 = S_MOV_B32 0 |
| ; GFX9-SDAG-NEXT: BUNDLE implicit killed renamable $vgpr0, implicit $m0, implicit $exec :: (load (s32) from custom "GWSResource") { |
| ; GFX9-SDAG-NEXT: DS_GWS_BARRIER renamable $vgpr0, 63, implicit $m0, implicit $exec :: (load (s32) from custom "GWSResource") |
| ; GFX9-SDAG-NEXT: S_WAITCNT .Vmcnt_0_Expcnt_0_Lgkmcnt_0 |
| ; GFX9-SDAG-NEXT: } |
| ; GFX9-SDAG-NEXT: S_ENDPGM 0 |
| ; |
| ; GFX9-GISEL-LABEL: name: gws_barrier_offset63 |
| ; GFX9-GISEL: bb.0 (%ir-block.0): |
| ; GFX9-GISEL-NEXT: liveins: $sgpr8_sgpr9 |
| ; GFX9-GISEL-NEXT: {{ $}} |
| ; GFX9-GISEL-NEXT: renamable $sgpr0 = S_LOAD_DWORD_IMM killed renamable $sgpr8_sgpr9, 0, 0 :: (dereferenceable invariant load (i32) from %ir.val.kernarg.offset1, align 16, addrspace 4) |
| ; GFX9-GISEL-NEXT: $vgpr0 = V_MOV_B32_e32 killed $sgpr0, implicit $exec, implicit $exec |
| ; GFX9-GISEL-NEXT: $m0 = S_MOV_B32 0 |
| ; GFX9-GISEL-NEXT: BUNDLE implicit killed renamable $vgpr0, implicit $m0, implicit $exec :: (load (i32) from custom "GWSResource") { |
| ; GFX9-GISEL-NEXT: DS_GWS_BARRIER renamable $vgpr0, 63, implicit $m0, implicit $exec :: (load (i32) from custom "GWSResource") |
| ; GFX9-GISEL-NEXT: S_WAITCNT .Vmcnt_0_Expcnt_0_Lgkmcnt_0 |
| ; GFX9-GISEL-NEXT: } |
| ; GFX9-GISEL-NEXT: S_ENDPGM 0 |
| call void @llvm.amdgcn.ds.gws.barrier(i32 %val, i32 63) |
| ret void |
| } |
| |
| declare void @llvm.amdgcn.ds.gws.barrier(i32, i32) #1 |
| |
| attributes #0 = { nounwind } |
| attributes #1 = { convergent inaccessiblememonly nounwind } |