|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 |
| 2 | +; RUN: not --crash llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 -global-isel=0 -verify-machineinstrs < %s 2>&1 | FileCheck -check-prefix=GFX9-SDAG-ERR %s |
| 3 | +; RUN: not --crash llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 -global-isel=1 -verify-machineinstrs < %s 2>&1 | FileCheck -check-prefix=GFX9-GISEL-ERR %s |
| 4 | +; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 -mattr=+architected-sgprs -global-isel=0 -verify-machineinstrs < %s | FileCheck -check-prefix=GFX9 %s |
| 5 | +; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 -mattr=+architected-sgprs -global-isel=1 -verify-machineinstrs < %s | FileCheck -check-prefix=GFX9 %s |
| 6 | +; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 -global-isel=0 -verify-machineinstrs < %s | FileCheck -check-prefix=GFX12 %s |
| 7 | +; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1200 -global-isel=1 -verify-machineinstrs < %s | FileCheck -check-prefix=GFX12 %s |
| 8 | + |
| 9 | +; GFX9-SDAG-ERR: LLVM ERROR: Cannot select: intrinsic %llvm.amdgcn.wave.id |
| 10 | +; GFX9-GISEL-ERR: LLVM ERROR: unable to legalize instruction: {{.*}} = G_INTRINSIC intrinsic(@llvm.amdgcn.wave.id) |
| 11 | + |
| 12 | +define amdgpu_cs void @test_wave_id(ptr addrspace(1) %out) { |
| 13 | +; GFX9-LABEL: test_wave_id: |
| 14 | +; GFX9: ; %bb.0: |
| 15 | +; GFX9-NEXT: s_bfe_u32 s0, ttmp8, 0x50019 |
| 16 | +; GFX9-NEXT: v_mov_b32_e32 v2, s0 |
| 17 | +; GFX9-NEXT: global_store_dword v[0:1], v2, off |
| 18 | +; GFX9-NEXT: s_endpgm |
| 19 | +; |
| 20 | +; GFX12-LABEL: test_wave_id: |
| 21 | +; GFX12: ; %bb.0: |
| 22 | +; GFX12-NEXT: s_bfe_u32 s0, ttmp8, 0x50019 |
| 23 | +; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1) |
| 24 | +; GFX12-NEXT: v_mov_b32_e32 v2, s0 |
| 25 | +; GFX12-NEXT: global_store_b32 v[0:1], v2, off |
| 26 | +; GFX12-NEXT: s_nop 0 |
| 27 | +; GFX12-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) |
| 28 | +; GFX12-NEXT: s_endpgm |
| 29 | + %waveid = call i32 @llvm.amdgcn.wave.id() |
| 30 | + store i32 %waveid, ptr addrspace(1) %out |
| 31 | + ret void |
| 32 | +} |
| 33 | + |
| 34 | +define amdgpu_gfx void @test_wave_id_callable(ptr addrspace(1) %out) { |
| 35 | +; GFX9-LABEL: test_wave_id_callable: |
| 36 | +; GFX9: ; %bb.0: |
| 37 | +; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) |
| 38 | +; GFX9-NEXT: s_bfe_u32 s34, ttmp8, 0x50019 |
| 39 | +; GFX9-NEXT: v_mov_b32_e32 v2, s34 |
| 40 | +; GFX9-NEXT: global_store_dword v[0:1], v2, off |
| 41 | +; GFX9-NEXT: s_waitcnt vmcnt(0) |
| 42 | +; GFX9-NEXT: s_setpc_b64 s[30:31] |
| 43 | +; |
| 44 | +; GFX12-LABEL: test_wave_id_callable: |
| 45 | +; GFX12: ; %bb.0: |
| 46 | +; GFX12-NEXT: s_wait_loadcnt_dscnt 0x0 |
| 47 | +; GFX12-NEXT: s_wait_expcnt 0x0 |
| 48 | +; GFX12-NEXT: s_wait_samplecnt 0x0 |
| 49 | +; GFX12-NEXT: s_wait_bvhcnt 0x0 |
| 50 | +; GFX12-NEXT: s_wait_kmcnt 0x0 |
| 51 | +; GFX12-NEXT: s_bfe_u32 s0, ttmp8, 0x50019 |
| 52 | +; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1) |
| 53 | +; GFX12-NEXT: v_mov_b32_e32 v2, s0 |
| 54 | +; GFX12-NEXT: global_store_b32 v[0:1], v2, off |
| 55 | +; GFX12-NEXT: s_setpc_b64 s[30:31] |
| 56 | + %waveid = call i32 @llvm.amdgcn.wave.id() |
| 57 | + store i32 %waveid, ptr addrspace(1) %out |
| 58 | + ret void |
| 59 | +} |
| 60 | + |
| 61 | +declare i32 @llvm.amdgcn.wave.id() |
0 commit comments