1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1200 < %s | FileCheck --check-prefix=GFX12 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -O0 -mcpu=gfx1200 -mattr=+cumode < %s | FileCheck --check-prefix=GFX12 %s
5 define amdgpu_kernel void @private_last_use_load_0(ptr addrspace(5) %in, ptr addrspace(1) %out) {
6 ; GFX12-LABEL: private_last_use_load_0:
7 ; GFX12: ; %bb.0: ; %entry
8 ; GFX12-NEXT: s_load_b32 s2, s[4:5], 0x0
9 ; GFX12-NEXT: s_load_b64 s[0:1], s[4:5], 0x8
10 ; GFX12-NEXT: v_mov_b32_e32 v0, 0
11 ; GFX12-NEXT: s_wait_kmcnt 0x0
12 ; GFX12-NEXT: scratch_load_b32 v1, off, s2 th:TH_LOAD_LU
13 ; GFX12-NEXT: s_wait_loadcnt 0x0
14 ; GFX12-NEXT: global_store_b32 v0, v1, s[0:1]
15 ; GFX12-NEXT: s_endpgm
17 %val = load i32, ptr addrspace(5) %in, align 4, !amdgpu.last.use !{}
18 store i32 %val, ptr addrspace(1) %out
22 define amdgpu_kernel void @private_last_use_load_1(ptr addrspace(5) %in, ptr addrspace(1) %out) {
23 ; GFX12-LABEL: private_last_use_load_1:
24 ; GFX12: ; %bb.0: ; %entry
25 ; GFX12-NEXT: v_mov_b32_e32 v1, v0
26 ; GFX12-NEXT: s_load_b32 s2, s[4:5], 0x0
27 ; GFX12-NEXT: s_load_b64 s[0:1], s[4:5], 0x8
28 ; GFX12-NEXT: v_mov_b32_e32 v0, 0
29 ; GFX12-NEXT: s_mov_b32 s3, 0x3ff
30 ; GFX12-NEXT: v_and_b32_e64 v1, v1, s3
31 ; GFX12-NEXT: s_mov_b32 s3, 2
32 ; GFX12-NEXT: s_wait_alu 0xfffe
33 ; GFX12-NEXT: v_lshlrev_b32_e64 v1, s3, v1
34 ; GFX12-NEXT: s_wait_kmcnt 0x0
35 ; GFX12-NEXT: scratch_load_b32 v1, v1, s2 th:TH_LOAD_LU
36 ; GFX12-NEXT: s_wait_loadcnt 0x0
37 ; GFX12-NEXT: global_store_b32 v0, v1, s[0:1]
38 ; GFX12-NEXT: s_endpgm
40 %tid = call i32 @llvm.amdgcn.workitem.id.x()
41 %val.gep = getelementptr inbounds i32, ptr addrspace(5) %in, i32 %tid
42 %val = load i32, ptr addrspace(5) %val.gep, align 4, !amdgpu.last.use !{}
43 store i32 %val, ptr addrspace(1) %out
47 define amdgpu_kernel void @private_last_use_and_volatile_load(ptr addrspace(5) %in, ptr addrspace(1) %out) {
48 ; GFX12-LABEL: private_last_use_and_volatile_load:
49 ; GFX12: ; %bb.0: ; %entry
50 ; GFX12-NEXT: s_load_b32 s2, s[4:5], 0x0
51 ; GFX12-NEXT: s_load_b64 s[0:1], s[4:5], 0x8
52 ; GFX12-NEXT: v_mov_b32_e32 v0, 0
53 ; GFX12-NEXT: s_wait_kmcnt 0x0
54 ; GFX12-NEXT: scratch_load_b32 v1, off, s2 th:TH_LOAD_BYPASS scope:SCOPE_SYS
55 ; GFX12-NEXT: s_wait_bvhcnt 0x0
56 ; GFX12-NEXT: s_wait_samplecnt 0x0
57 ; GFX12-NEXT: s_wait_loadcnt 0x0
58 ; GFX12-NEXT: global_store_b32 v0, v1, s[0:1]
59 ; GFX12-NEXT: s_endpgm
61 %val = load volatile i32, ptr addrspace(5) %in, align 4, !amdgpu.last.use !{}
62 store i32 %val, ptr addrspace(1) %out
66 define amdgpu_kernel void @private_last_use_and_nontemporal_load(ptr addrspace(5) %in, ptr addrspace(1) %out) {
67 ; GFX12-LABEL: private_last_use_and_nontemporal_load:
68 ; GFX12: ; %bb.0: ; %entry
69 ; GFX12-NEXT: s_load_b32 s2, s[4:5], 0x0
70 ; GFX12-NEXT: s_load_b64 s[0:1], s[4:5], 0x8
71 ; GFX12-NEXT: v_mov_b32_e32 v0, 0
72 ; GFX12-NEXT: s_wait_kmcnt 0x0
73 ; GFX12-NEXT: scratch_load_b32 v1, off, s2 th:TH_LOAD_LU
74 ; GFX12-NEXT: s_wait_loadcnt 0x0
75 ; GFX12-NEXT: global_store_b32 v0, v1, s[0:1]
76 ; GFX12-NEXT: s_endpgm
78 %val = load i32, ptr addrspace(5) %in, align 4, !amdgpu.last.use !{}, !nontemporal !0
79 store i32 %val, ptr addrspace(1) %out
84 declare i32 @llvm.amdgcn.workitem.id.x()