1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX8 %s
3 ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9,GFX900 %s
4 ; RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX10 %s
5 ; RUN: llc -mtriple=amdgcn -mcpu=gfx90a -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9,GFX90A %s
6 ; RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11 %s
8 declare i64 @_Z13get_global_idj(i32) #0
10 define amdgpu_kernel void @clmem_read_simplified(ptr addrspace(1) %buffer) {
11 ; GFX8-LABEL: clmem_read_simplified:
12 ; GFX8: ; %bb.0: ; %entry
13 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
14 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
15 ; GFX8-NEXT: s_mov_b32 s38, -1
16 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
17 ; GFX8-NEXT: s_add_u32 s36, s36, s11
18 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
19 ; GFX8-NEXT: s_getpc_b64 s[0:1]
20 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
21 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
22 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
23 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
24 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
25 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
26 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
27 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
28 ; GFX8-NEXT: s_mov_b32 s32, 0
29 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
30 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
31 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 7, v0
32 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff8000, v1
33 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
34 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, s34, v1
35 ; GFX8-NEXT: v_mov_b32_e32 v3, 3
36 ; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc
37 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
38 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v1, v0
39 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v2, vcc
40 ; GFX8-NEXT: s_movk_i32 s0, 0x800
41 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, s0, v3
42 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v4, vcc
43 ; GFX8-NEXT: s_movk_i32 s0, 0x1000
44 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, s0, v3
45 ; GFX8-NEXT: v_addc_u32_e32 v8, vcc, 0, v4, vcc
46 ; GFX8-NEXT: s_movk_i32 s0, 0x1800
47 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, s0, v3
48 ; GFX8-NEXT: v_addc_u32_e32 v10, vcc, 0, v4, vcc
49 ; GFX8-NEXT: flat_load_dwordx2 v[11:12], v[3:4]
50 ; GFX8-NEXT: flat_load_dwordx2 v[5:6], v[5:6]
51 ; GFX8-NEXT: flat_load_dwordx2 v[7:8], v[7:8]
52 ; GFX8-NEXT: flat_load_dwordx2 v[9:10], v[9:10]
53 ; GFX8-NEXT: s_movk_i32 s0, 0x2000
54 ; GFX8-NEXT: v_add_u32_e32 v13, vcc, s0, v3
55 ; GFX8-NEXT: v_addc_u32_e32 v14, vcc, 0, v4, vcc
56 ; GFX8-NEXT: s_movk_i32 s0, 0x2800
57 ; GFX8-NEXT: v_add_u32_e32 v15, vcc, s0, v3
58 ; GFX8-NEXT: v_addc_u32_e32 v16, vcc, 0, v4, vcc
59 ; GFX8-NEXT: flat_load_dwordx2 v[13:14], v[13:14]
60 ; GFX8-NEXT: flat_load_dwordx2 v[15:16], v[15:16]
61 ; GFX8-NEXT: s_movk_i32 s0, 0x3000
62 ; GFX8-NEXT: v_add_u32_e32 v17, vcc, s0, v3
63 ; GFX8-NEXT: v_addc_u32_e32 v18, vcc, 0, v4, vcc
64 ; GFX8-NEXT: flat_load_dwordx2 v[17:18], v[17:18]
65 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x3800, v3
66 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v4, vcc
67 ; GFX8-NEXT: flat_load_dwordx2 v[3:4], v[3:4]
68 ; GFX8-NEXT: s_waitcnt vmcnt(6)
69 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v5, v11
70 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v6, v12, vcc
71 ; GFX8-NEXT: s_waitcnt vmcnt(5)
72 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v7, v0
73 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v8, v5, vcc
74 ; GFX8-NEXT: s_waitcnt vmcnt(4)
75 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v9, v0
76 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v10, v5, vcc
77 ; GFX8-NEXT: s_waitcnt vmcnt(3)
78 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v13, v0
79 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v14, v5, vcc
80 ; GFX8-NEXT: s_waitcnt vmcnt(2)
81 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v15, v0
82 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v16, v5, vcc
83 ; GFX8-NEXT: s_waitcnt vmcnt(1)
84 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v17, v0
85 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v18, v5, vcc
86 ; GFX8-NEXT: s_waitcnt vmcnt(0)
87 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v3, v0
88 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v4, v5, vcc
89 ; GFX8-NEXT: flat_store_dwordx2 v[1:2], v[3:4]
92 ; GFX9-LABEL: clmem_read_simplified:
93 ; GFX9: ; %bb.0: ; %entry
94 ; GFX9-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
95 ; GFX9-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
96 ; GFX9-NEXT: s_mov_b32 s38, -1
97 ; GFX9-NEXT: s_mov_b32 s39, 0xe00000
98 ; GFX9-NEXT: s_add_u32 s36, s36, s11
99 ; GFX9-NEXT: s_addc_u32 s37, s37, 0
100 ; GFX9-NEXT: s_getpc_b64 s[0:1]
101 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
102 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
103 ; GFX9-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
104 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
105 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
106 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37]
107 ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39]
108 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
109 ; GFX9-NEXT: s_mov_b32 s32, 0
110 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
111 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
112 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 7, v0
113 ; GFX9-NEXT: v_and_b32_e32 v18, 0xffff8000, v1
114 ; GFX9-NEXT: v_mov_b32_e32 v1, s35
115 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s34, v18
116 ; GFX9-NEXT: v_mov_b32_e32 v3, 3
117 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
118 ; GFX9-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
119 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v2, v0
120 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
121 ; GFX9-NEXT: s_movk_i32 s1, 0x2000
122 ; GFX9-NEXT: global_load_dwordx2 v[2:3], v[0:1], off
123 ; GFX9-NEXT: global_load_dwordx2 v[4:5], v[0:1], off offset:2048
124 ; GFX9-NEXT: v_add_co_u32_e32 v6, vcc, s1, v0
125 ; GFX9-NEXT: v_addc_co_u32_e32 v7, vcc, 0, v1, vcc
126 ; GFX9-NEXT: global_load_dwordx2 v[8:9], v[6:7], off offset:-4096
127 ; GFX9-NEXT: s_movk_i32 s0, 0x1000
128 ; GFX9-NEXT: v_add_co_u32_e32 v10, vcc, s0, v0
129 ; GFX9-NEXT: v_addc_co_u32_e32 v11, vcc, 0, v1, vcc
130 ; GFX9-NEXT: global_load_dwordx2 v[12:13], v[10:11], off offset:2048
131 ; GFX9-NEXT: global_load_dwordx2 v[14:15], v[6:7], off
132 ; GFX9-NEXT: global_load_dwordx2 v[16:17], v[6:7], off offset:2048
133 ; GFX9-NEXT: s_movk_i32 s0, 0x3000
134 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, s0, v0
135 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
136 ; GFX9-NEXT: global_load_dwordx2 v[6:7], v[0:1], off
137 ; GFX9-NEXT: global_load_dwordx2 v[10:11], v[0:1], off offset:2048
138 ; GFX9-NEXT: s_waitcnt vmcnt(6)
139 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v4, v2
140 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v5, v3, vcc
141 ; GFX9-NEXT: s_waitcnt vmcnt(5)
142 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v8, v0
143 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v9, v1, vcc
144 ; GFX9-NEXT: s_waitcnt vmcnt(4)
145 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v12, v0
146 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v13, v1, vcc
147 ; GFX9-NEXT: s_waitcnt vmcnt(3)
148 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v14, v0
149 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v15, v1, vcc
150 ; GFX9-NEXT: s_waitcnt vmcnt(2)
151 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v16, v0
152 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v17, v1, vcc
153 ; GFX9-NEXT: s_waitcnt vmcnt(1)
154 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v6, v0
155 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v7, v1, vcc
156 ; GFX9-NEXT: s_waitcnt vmcnt(0)
157 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v10, v0
158 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v11, v1, vcc
159 ; GFX9-NEXT: global_store_dwordx2 v18, v[0:1], s[34:35]
160 ; GFX9-NEXT: s_endpgm
162 ; GFX10-LABEL: clmem_read_simplified:
163 ; GFX10: ; %bb.0: ; %entry
164 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
165 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
166 ; GFX10-NEXT: s_mov_b32 s38, -1
167 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
168 ; GFX10-NEXT: s_add_u32 s36, s36, s11
169 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
170 ; GFX10-NEXT: s_getpc_b64 s[0:1]
171 ; GFX10-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
172 ; GFX10-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
173 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
174 ; GFX10-NEXT: s_load_dwordx2 s[6:7], s[0:1], 0x0
175 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
176 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
177 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
178 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
179 ; GFX10-NEXT: s_mov_b32 s32, 0
180 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
181 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[6:7]
182 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 7, v0
183 ; GFX10-NEXT: v_mov_b32_e32 v2, 3
184 ; GFX10-NEXT: v_and_b32_e32 v20, 0xffff8000, v1
185 ; GFX10-NEXT: v_lshlrev_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
186 ; GFX10-NEXT: v_add_co_u32 v1, s0, s34, v20
187 ; GFX10-NEXT: v_add_co_ci_u32_e64 v2, s0, s35, 0, s0
188 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
189 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
190 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v0, 0x1000
191 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
192 ; GFX10-NEXT: v_add_co_u32 v8, vcc_lo, v0, 0x2000
193 ; GFX10-NEXT: s_clause 0x1
194 ; GFX10-NEXT: global_load_dwordx2 v[4:5], v[0:1], off
195 ; GFX10-NEXT: global_load_dwordx2 v[6:7], v[2:3], off offset:-2048
196 ; GFX10-NEXT: v_add_co_ci_u32_e32 v9, vcc_lo, 0, v1, vcc_lo
197 ; GFX10-NEXT: s_clause 0x1
198 ; GFX10-NEXT: global_load_dwordx2 v[10:11], v[2:3], off
199 ; GFX10-NEXT: global_load_dwordx2 v[12:13], v[8:9], off offset:-2048
200 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v0, 0x3000
201 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
202 ; GFX10-NEXT: s_clause 0x1
203 ; GFX10-NEXT: global_load_dwordx2 v[14:15], v[8:9], off
204 ; GFX10-NEXT: global_load_dwordx2 v[16:17], v[2:3], off offset:-2048
205 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x3800, v0
206 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
207 ; GFX10-NEXT: s_clause 0x1
208 ; GFX10-NEXT: global_load_dwordx2 v[8:9], v[2:3], off
209 ; GFX10-NEXT: global_load_dwordx2 v[18:19], v[0:1], off
210 ; GFX10-NEXT: s_waitcnt vmcnt(6)
211 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v6, v4
212 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v7, v5, vcc_lo
213 ; GFX10-NEXT: s_waitcnt vmcnt(5)
214 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v10, v0
215 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v11, v1, vcc_lo
216 ; GFX10-NEXT: s_waitcnt vmcnt(4)
217 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v12, v0
218 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v13, v1, vcc_lo
219 ; GFX10-NEXT: s_waitcnt vmcnt(3)
220 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v14, v0
221 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v15, v1, vcc_lo
222 ; GFX10-NEXT: s_waitcnt vmcnt(2)
223 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v16, v0
224 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v17, v1, vcc_lo
225 ; GFX10-NEXT: s_waitcnt vmcnt(1)
226 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v8, v0
227 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v9, v1, vcc_lo
228 ; GFX10-NEXT: s_waitcnt vmcnt(0)
229 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v18, v0
230 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v19, v1, vcc_lo
231 ; GFX10-NEXT: global_store_dwordx2 v20, v[0:1], s[34:35]
232 ; GFX10-NEXT: s_endpgm
234 ; GFX11-LABEL: clmem_read_simplified:
235 ; GFX11: ; %bb.0: ; %entry
236 ; GFX11-NEXT: s_getpc_b64 s[0:1]
237 ; GFX11-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
238 ; GFX11-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
239 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
240 ; GFX11-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
241 ; GFX11-NEXT: s_load_b64 s[34:35], s[4:5], 0x24
242 ; GFX11-NEXT: s_mov_b32 s32, 0
243 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
244 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[0:1]
245 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 7, v0
246 ; GFX11-NEXT: v_and_b32_e32 v0, 0xff, v0
247 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
248 ; GFX11-NEXT: v_and_b32_e32 v16, 0xffff8000, v1
249 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 3, v0
250 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
251 ; GFX11-NEXT: v_add_co_u32 v1, s0, s34, v16
252 ; GFX11-NEXT: v_add_co_ci_u32_e64 v2, null, s35, 0, s0
253 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
254 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
255 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
256 ; GFX11-NEXT: s_clause 0x1
257 ; GFX11-NEXT: global_load_b64 v[2:3], v[0:1], off
258 ; GFX11-NEXT: global_load_b64 v[4:5], v[0:1], off offset:2048
259 ; GFX11-NEXT: v_add_co_u32 v6, vcc_lo, v0, 0x2000
260 ; GFX11-NEXT: v_add_co_ci_u32_e32 v7, vcc_lo, 0, v1, vcc_lo
261 ; GFX11-NEXT: v_add_co_u32 v8, vcc_lo, 0x1000, v0
262 ; GFX11-NEXT: v_add_co_ci_u32_e32 v9, vcc_lo, 0, v1, vcc_lo
263 ; GFX11-NEXT: s_clause 0x1
264 ; GFX11-NEXT: global_load_b64 v[10:11], v[6:7], off offset:-4096
265 ; GFX11-NEXT: global_load_b64 v[8:9], v[8:9], off offset:2048
266 ; GFX11-NEXT: v_add_co_u32 v12, vcc_lo, 0x2000, v0
267 ; GFX11-NEXT: v_add_co_ci_u32_e32 v13, vcc_lo, 0, v1, vcc_lo
268 ; GFX11-NEXT: global_load_b64 v[6:7], v[6:7], off
269 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0x3000, v0
270 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
271 ; GFX11-NEXT: s_clause 0x2
272 ; GFX11-NEXT: global_load_b64 v[12:13], v[12:13], off offset:2048
273 ; GFX11-NEXT: global_load_b64 v[14:15], v[0:1], off
274 ; GFX11-NEXT: global_load_b64 v[0:1], v[0:1], off offset:2048
275 ; GFX11-NEXT: s_waitcnt vmcnt(6)
276 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v4, v2
277 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v5, v3, vcc_lo
278 ; GFX11-NEXT: s_waitcnt vmcnt(5)
279 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
280 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v10, v2
281 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v11, v3, vcc_lo
282 ; GFX11-NEXT: s_waitcnt vmcnt(4)
283 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
284 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v8, v2
285 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v9, v3, vcc_lo
286 ; GFX11-NEXT: s_waitcnt vmcnt(3)
287 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
288 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v6, v2
289 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v7, v3, vcc_lo
290 ; GFX11-NEXT: s_waitcnt vmcnt(2)
291 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
292 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v12, v2
293 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v13, v3, vcc_lo
294 ; GFX11-NEXT: s_waitcnt vmcnt(1)
295 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
296 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v14, v2
297 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v15, v3, vcc_lo
298 ; GFX11-NEXT: s_waitcnt vmcnt(0)
299 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
300 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v0, v2
301 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v1, v3, vcc_lo
302 ; GFX11-NEXT: global_store_b64 v16, v[0:1], s[34:35]
303 ; GFX11-NEXT: s_endpgm
305 %call = tail call i64 @_Z13get_global_idj(i32 0)
306 %conv = and i64 %call, 255
307 %a0 = shl i64 %call, 7
308 %idx.ext11 = and i64 %a0, 4294934528
309 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
311 %addr1 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 %conv
312 %load1 = load i64, ptr addrspace(1) %addr1, align 8
313 %addr2 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 256
314 %load2 = load i64, ptr addrspace(1) %addr2, align 8
315 %add.1 = add i64 %load2, %load1
317 %add.ptr8.2 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 512
318 %load3 = load i64, ptr addrspace(1) %add.ptr8.2, align 8
319 %add.2 = add i64 %load3, %add.1
320 %add.ptr8.3 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 768
321 %load4 = load i64, ptr addrspace(1) %add.ptr8.3, align 8
322 %add.3 = add i64 %load4, %add.2
324 %add.ptr8.4 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1024
325 %load5 = load i64, ptr addrspace(1) %add.ptr8.4, align 8
326 %add.4 = add i64 %load5, %add.3
327 %add.ptr8.5 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1280
328 %load6 = load i64, ptr addrspace(1) %add.ptr8.5, align 8
329 %add.5 = add i64 %load6, %add.4
331 %add.ptr8.6 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1536
332 %load7 = load i64, ptr addrspace(1) %add.ptr8.6, align 8
333 %add.6 = add i64 %load7, %add.5
334 %add.ptr8.7 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1792
335 %load8 = load i64, ptr addrspace(1) %add.ptr8.7, align 8
336 %add.7 = add i64 %load8, %add.6
338 store i64 %add.7, ptr addrspace(1) %add.ptr12, align 8
342 define hidden amdgpu_kernel void @clmem_read(ptr addrspace(1) %buffer) {
343 ; GFX8-LABEL: clmem_read:
344 ; GFX8: ; %bb.0: ; %entry
345 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
346 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
347 ; GFX8-NEXT: s_mov_b32 s38, -1
348 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
349 ; GFX8-NEXT: s_add_u32 s36, s36, s11
350 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
351 ; GFX8-NEXT: s_getpc_b64 s[0:1]
352 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
353 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
354 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
355 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
356 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
357 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
358 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
359 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
360 ; GFX8-NEXT: s_mov_b32 s32, 0
361 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
362 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
363 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 17, v0
364 ; GFX8-NEXT: v_and_b32_e32 v6, 0xfe000000, v1
365 ; GFX8-NEXT: v_mov_b32_e32 v1, 3
366 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v1, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
367 ; GFX8-NEXT: v_or_b32_e32 v0, v6, v0
368 ; GFX8-NEXT: v_mov_b32_e32 v1, s35
369 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s34, v0
370 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
371 ; GFX8-NEXT: s_movk_i32 s0, 0x5000
372 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s0, v0
373 ; GFX8-NEXT: v_mov_b32_e32 v2, 0
374 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
375 ; GFX8-NEXT: v_mov_b32_e32 v3, 0
376 ; GFX8-NEXT: s_movk_i32 s0, 0x7f
377 ; GFX8-NEXT: .LBB1_1: ; %for.cond.preheader
378 ; GFX8-NEXT: ; =>This Loop Header: Depth=1
379 ; GFX8-NEXT: ; Child Loop BB1_2 Depth 2
380 ; GFX8-NEXT: v_mov_b32_e32 v5, v1
381 ; GFX8-NEXT: v_mov_b32_e32 v4, v0
382 ; GFX8-NEXT: s_mov_b32 s1, 0
383 ; GFX8-NEXT: .LBB1_2: ; %for.body
384 ; GFX8-NEXT: ; Parent Loop BB1_1 Depth=1
385 ; GFX8-NEXT: ; => This Inner Loop Header: Depth=2
386 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, 0xffffb000, v4
387 ; GFX8-NEXT: v_addc_u32_e32 v8, vcc, -1, v5, vcc
388 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, 0xffffb800, v4
389 ; GFX8-NEXT: v_addc_u32_e32 v10, vcc, -1, v5, vcc
390 ; GFX8-NEXT: v_add_u32_e32 v11, vcc, 0xffffc000, v4
391 ; GFX8-NEXT: flat_load_dwordx2 v[7:8], v[7:8]
392 ; GFX8-NEXT: flat_load_dwordx2 v[9:10], v[9:10]
393 ; GFX8-NEXT: v_addc_u32_e32 v12, vcc, -1, v5, vcc
394 ; GFX8-NEXT: v_add_u32_e32 v13, vcc, 0xffffc800, v4
395 ; GFX8-NEXT: v_addc_u32_e32 v14, vcc, -1, v5, vcc
396 ; GFX8-NEXT: v_add_u32_e32 v15, vcc, 0xffffd000, v4
397 ; GFX8-NEXT: flat_load_dwordx2 v[11:12], v[11:12]
398 ; GFX8-NEXT: flat_load_dwordx2 v[13:14], v[13:14]
399 ; GFX8-NEXT: v_addc_u32_e32 v16, vcc, -1, v5, vcc
400 ; GFX8-NEXT: v_add_u32_e32 v17, vcc, 0xffffd800, v4
401 ; GFX8-NEXT: v_addc_u32_e32 v18, vcc, -1, v5, vcc
402 ; GFX8-NEXT: flat_load_dwordx2 v[15:16], v[15:16]
403 ; GFX8-NEXT: flat_load_dwordx2 v[17:18], v[17:18]
404 ; GFX8-NEXT: v_add_u32_e32 v19, vcc, 0xffffe000, v4
405 ; GFX8-NEXT: v_addc_u32_e32 v20, vcc, -1, v5, vcc
406 ; GFX8-NEXT: v_add_u32_e32 v21, vcc, 0xffffe800, v4
407 ; GFX8-NEXT: flat_load_dwordx2 v[19:20], v[19:20]
408 ; GFX8-NEXT: v_addc_u32_e32 v22, vcc, -1, v5, vcc
409 ; GFX8-NEXT: flat_load_dwordx2 v[21:22], v[21:22]
410 ; GFX8-NEXT: v_add_u32_e32 v23, vcc, 0xfffff000, v4
411 ; GFX8-NEXT: v_addc_u32_e32 v24, vcc, -1, v5, vcc
412 ; GFX8-NEXT: flat_load_dwordx2 v[23:24], v[23:24]
413 ; GFX8-NEXT: v_add_u32_e32 v25, vcc, 0xfffff800, v4
414 ; GFX8-NEXT: v_addc_u32_e32 v26, vcc, -1, v5, vcc
415 ; GFX8-NEXT: flat_load_dwordx2 v[25:26], v[25:26]
416 ; GFX8-NEXT: flat_load_dwordx2 v[27:28], v[4:5]
417 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x10000, v4
418 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, 0, v5, vcc
419 ; GFX8-NEXT: s_addk_i32 s1, 0x2000
420 ; GFX8-NEXT: s_cmp_gt_u32 s1, 0x3fffff
421 ; GFX8-NEXT: s_waitcnt vmcnt(10)
422 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v7, v2
423 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v8, v3, vcc
424 ; GFX8-NEXT: s_waitcnt vmcnt(9)
425 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v9, v2
426 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v10, v3, vcc
427 ; GFX8-NEXT: s_waitcnt vmcnt(8)
428 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v11, v2
429 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v12, v3, vcc
430 ; GFX8-NEXT: s_waitcnt vmcnt(7)
431 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v13, v2
432 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v14, v3, vcc
433 ; GFX8-NEXT: s_waitcnt vmcnt(6)
434 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v15, v2
435 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v16, v3, vcc
436 ; GFX8-NEXT: s_waitcnt vmcnt(5)
437 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v17, v2
438 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v18, v3, vcc
439 ; GFX8-NEXT: s_waitcnt vmcnt(4)
440 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v19, v2
441 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v20, v3, vcc
442 ; GFX8-NEXT: s_waitcnt vmcnt(3)
443 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v21, v2
444 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v22, v3, vcc
445 ; GFX8-NEXT: s_waitcnt vmcnt(2)
446 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v23, v2
447 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v24, v3, vcc
448 ; GFX8-NEXT: s_waitcnt vmcnt(1)
449 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v25, v2
450 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v26, v3, vcc
451 ; GFX8-NEXT: s_waitcnt vmcnt(0)
452 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v27, v2
453 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v28, v3, vcc
454 ; GFX8-NEXT: s_cbranch_scc0 .LBB1_2
455 ; GFX8-NEXT: ; %bb.3: ; %while.cond.loopexit
456 ; GFX8-NEXT: ; in Loop: Header=BB1_1 Depth=1
457 ; GFX8-NEXT: s_add_i32 s1, s0, -1
458 ; GFX8-NEXT: s_cmp_eq_u32 s0, 0
459 ; GFX8-NEXT: s_cbranch_scc1 .LBB1_5
460 ; GFX8-NEXT: ; %bb.4: ; in Loop: Header=BB1_1 Depth=1
461 ; GFX8-NEXT: s_mov_b32 s0, s1
462 ; GFX8-NEXT: s_branch .LBB1_1
463 ; GFX8-NEXT: .LBB1_5: ; %while.end
464 ; GFX8-NEXT: v_mov_b32_e32 v1, s35
465 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s34, v6
466 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
467 ; GFX8-NEXT: flat_store_dwordx2 v[0:1], v[2:3]
468 ; GFX8-NEXT: s_endpgm
470 ; GFX900-LABEL: clmem_read:
471 ; GFX900: ; %bb.0: ; %entry
472 ; GFX900-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
473 ; GFX900-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
474 ; GFX900-NEXT: s_mov_b32 s38, -1
475 ; GFX900-NEXT: s_mov_b32 s39, 0xe00000
476 ; GFX900-NEXT: s_add_u32 s36, s36, s11
477 ; GFX900-NEXT: s_addc_u32 s37, s37, 0
478 ; GFX900-NEXT: s_getpc_b64 s[0:1]
479 ; GFX900-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
480 ; GFX900-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
481 ; GFX900-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
482 ; GFX900-NEXT: v_mov_b32_e32 v31, v0
483 ; GFX900-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
484 ; GFX900-NEXT: s_mov_b64 s[0:1], s[36:37]
485 ; GFX900-NEXT: s_mov_b64 s[2:3], s[38:39]
486 ; GFX900-NEXT: v_mov_b32_e32 v0, 0
487 ; GFX900-NEXT: s_mov_b32 s32, 0
488 ; GFX900-NEXT: s_waitcnt lgkmcnt(0)
489 ; GFX900-NEXT: s_swappc_b64 s[30:31], s[4:5]
490 ; GFX900-NEXT: v_and_b32_e32 v1, 0xff, v0
491 ; GFX900-NEXT: v_lshlrev_b32_e32 v0, 17, v0
492 ; GFX900-NEXT: v_and_b32_e32 v6, 0xfe000000, v0
493 ; GFX900-NEXT: v_lshl_or_b32 v0, v1, 3, v6
494 ; GFX900-NEXT: v_mov_b32_e32 v1, s35
495 ; GFX900-NEXT: v_add_co_u32_e32 v0, vcc, s34, v0
496 ; GFX900-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
497 ; GFX900-NEXT: s_movk_i32 s0, 0x5000
498 ; GFX900-NEXT: v_add_co_u32_e32 v0, vcc, s0, v0
499 ; GFX900-NEXT: v_mov_b32_e32 v2, 0
500 ; GFX900-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
501 ; GFX900-NEXT: s_movk_i32 s2, 0x7f
502 ; GFX900-NEXT: v_mov_b32_e32 v3, 0
503 ; GFX900-NEXT: s_movk_i32 s0, 0xd000
504 ; GFX900-NEXT: s_movk_i32 s1, 0xe000
505 ; GFX900-NEXT: s_movk_i32 s3, 0xf000
506 ; GFX900-NEXT: .LBB1_1: ; %for.cond.preheader
507 ; GFX900-NEXT: ; =>This Loop Header: Depth=1
508 ; GFX900-NEXT: ; Child Loop BB1_2 Depth 2
509 ; GFX900-NEXT: v_mov_b32_e32 v5, v1
510 ; GFX900-NEXT: v_mov_b32_e32 v4, v0
511 ; GFX900-NEXT: s_mov_b32 s4, 0
512 ; GFX900-NEXT: .LBB1_2: ; %for.body
513 ; GFX900-NEXT: ; Parent Loop BB1_1 Depth=1
514 ; GFX900-NEXT: ; => This Inner Loop Header: Depth=2
515 ; GFX900-NEXT: v_add_co_u32_e32 v7, vcc, 0xffffb000, v4
516 ; GFX900-NEXT: v_addc_co_u32_e32 v8, vcc, -1, v5, vcc
517 ; GFX900-NEXT: global_load_dwordx2 v[9:10], v[4:5], off offset:-4096
518 ; GFX900-NEXT: global_load_dwordx2 v[11:12], v[4:5], off offset:-2048
519 ; GFX900-NEXT: v_add_co_u32_e32 v13, vcc, 0xffffc000, v4
520 ; GFX900-NEXT: global_load_dwordx2 v[7:8], v[7:8], off
521 ; GFX900-NEXT: v_addc_co_u32_e32 v14, vcc, -1, v5, vcc
522 ; GFX900-NEXT: global_load_dwordx2 v[17:18], v[13:14], off offset:-2048
523 ; GFX900-NEXT: v_add_co_u32_e32 v15, vcc, s0, v4
524 ; GFX900-NEXT: v_addc_co_u32_e32 v16, vcc, -1, v5, vcc
525 ; GFX900-NEXT: global_load_dwordx2 v[15:16], v[15:16], off offset:-2048
526 ; GFX900-NEXT: v_add_co_u32_e32 v19, vcc, s1, v4
527 ; GFX900-NEXT: global_load_dwordx2 v[13:14], v[13:14], off
528 ; GFX900-NEXT: v_addc_co_u32_e32 v20, vcc, -1, v5, vcc
529 ; GFX900-NEXT: global_load_dwordx2 v[23:24], v[19:20], off offset:-4096
530 ; GFX900-NEXT: global_load_dwordx2 v[25:26], v[19:20], off offset:-2048
531 ; GFX900-NEXT: global_load_dwordx2 v[27:28], v[19:20], off
532 ; GFX900-NEXT: v_add_co_u32_e32 v21, vcc, s3, v4
533 ; GFX900-NEXT: v_addc_co_u32_e32 v22, vcc, -1, v5, vcc
534 ; GFX900-NEXT: global_load_dwordx2 v[19:20], v[21:22], off offset:-2048
535 ; GFX900-NEXT: global_load_dwordx2 v[29:30], v[4:5], off
536 ; GFX900-NEXT: v_add_co_u32_e32 v4, vcc, 0x10000, v4
537 ; GFX900-NEXT: v_addc_co_u32_e32 v5, vcc, 0, v5, vcc
538 ; GFX900-NEXT: s_addk_i32 s4, 0x2000
539 ; GFX900-NEXT: s_cmp_gt_u32 s4, 0x3fffff
540 ; GFX900-NEXT: s_waitcnt vmcnt(8)
541 ; GFX900-NEXT: v_add_co_u32_e32 v2, vcc, v7, v2
542 ; GFX900-NEXT: v_addc_co_u32_e32 v3, vcc, v8, v3, vcc
543 ; GFX900-NEXT: s_waitcnt vmcnt(7)
544 ; GFX900-NEXT: v_add_co_u32_e32 v2, vcc, v17, v2
545 ; GFX900-NEXT: v_addc_co_u32_e32 v3, vcc, v18, v3, vcc
546 ; GFX900-NEXT: s_waitcnt vmcnt(5)
547 ; GFX900-NEXT: v_add_co_u32_e32 v2, vcc, v13, v2
548 ; GFX900-NEXT: v_addc_co_u32_e32 v3, vcc, v14, v3, vcc
549 ; GFX900-NEXT: v_add_co_u32_e32 v2, vcc, v15, v2
550 ; GFX900-NEXT: v_addc_co_u32_e32 v3, vcc, v16, v3, vcc
551 ; GFX900-NEXT: s_waitcnt vmcnt(4)
552 ; GFX900-NEXT: v_add_co_u32_e32 v2, vcc, v23, v2
553 ; GFX900-NEXT: v_addc_co_u32_e32 v3, vcc, v24, v3, vcc
554 ; GFX900-NEXT: s_waitcnt vmcnt(3)
555 ; GFX900-NEXT: v_add_co_u32_e32 v2, vcc, v25, v2
556 ; GFX900-NEXT: v_addc_co_u32_e32 v3, vcc, v26, v3, vcc
557 ; GFX900-NEXT: s_waitcnt vmcnt(2)
558 ; GFX900-NEXT: v_add_co_u32_e32 v2, vcc, v27, v2
559 ; GFX900-NEXT: v_addc_co_u32_e32 v3, vcc, v28, v3, vcc
560 ; GFX900-NEXT: s_waitcnt vmcnt(1)
561 ; GFX900-NEXT: v_add_co_u32_e32 v2, vcc, v19, v2
562 ; GFX900-NEXT: v_addc_co_u32_e32 v3, vcc, v20, v3, vcc
563 ; GFX900-NEXT: v_add_co_u32_e32 v2, vcc, v9, v2
564 ; GFX900-NEXT: v_addc_co_u32_e32 v3, vcc, v10, v3, vcc
565 ; GFX900-NEXT: v_add_co_u32_e32 v2, vcc, v11, v2
566 ; GFX900-NEXT: v_addc_co_u32_e32 v3, vcc, v12, v3, vcc
567 ; GFX900-NEXT: s_waitcnt vmcnt(0)
568 ; GFX900-NEXT: v_add_co_u32_e32 v2, vcc, v29, v2
569 ; GFX900-NEXT: v_addc_co_u32_e32 v3, vcc, v30, v3, vcc
570 ; GFX900-NEXT: s_cbranch_scc0 .LBB1_2
571 ; GFX900-NEXT: ; %bb.3: ; %while.cond.loopexit
572 ; GFX900-NEXT: ; in Loop: Header=BB1_1 Depth=1
573 ; GFX900-NEXT: s_add_i32 s4, s2, -1
574 ; GFX900-NEXT: s_cmp_eq_u32 s2, 0
575 ; GFX900-NEXT: s_cbranch_scc1 .LBB1_5
576 ; GFX900-NEXT: ; %bb.4: ; in Loop: Header=BB1_1 Depth=1
577 ; GFX900-NEXT: s_mov_b32 s2, s4
578 ; GFX900-NEXT: s_branch .LBB1_1
579 ; GFX900-NEXT: .LBB1_5: ; %while.end
580 ; GFX900-NEXT: v_mov_b32_e32 v1, s35
581 ; GFX900-NEXT: v_add_co_u32_e32 v0, vcc, s34, v6
582 ; GFX900-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
583 ; GFX900-NEXT: global_store_dwordx2 v[0:1], v[2:3], off
584 ; GFX900-NEXT: s_endpgm
586 ; GFX10-LABEL: clmem_read:
587 ; GFX10: ; %bb.0: ; %entry
588 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
589 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
590 ; GFX10-NEXT: s_mov_b32 s38, -1
591 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
592 ; GFX10-NEXT: s_add_u32 s36, s36, s11
593 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
594 ; GFX10-NEXT: s_getpc_b64 s[0:1]
595 ; GFX10-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
596 ; GFX10-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
597 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
598 ; GFX10-NEXT: s_load_dwordx2 s[6:7], s[0:1], 0x0
599 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
600 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
601 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
602 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
603 ; GFX10-NEXT: s_mov_b32 s32, 0
604 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
605 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[6:7]
606 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 17, v0
607 ; GFX10-NEXT: v_and_b32_e32 v0, 0xff, v0
608 ; GFX10-NEXT: v_mov_b32_e32 v2, 0
609 ; GFX10-NEXT: v_mov_b32_e32 v3, 0
610 ; GFX10-NEXT: s_movk_i32 s1, 0x7f
611 ; GFX10-NEXT: v_and_b32_e32 v6, 0xfe000000, v1
612 ; GFX10-NEXT: v_lshl_or_b32 v0, v0, 3, v6
613 ; GFX10-NEXT: v_add_co_u32 v0, s0, v0, s34
614 ; GFX10-NEXT: v_add_co_ci_u32_e64 v1, s0, 0, s35, s0
615 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x5000, v0
616 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
617 ; GFX10-NEXT: .LBB1_1: ; %for.cond.preheader
618 ; GFX10-NEXT: ; =>This Loop Header: Depth=1
619 ; GFX10-NEXT: ; Child Loop BB1_2 Depth 2
620 ; GFX10-NEXT: v_mov_b32_e32 v5, v1
621 ; GFX10-NEXT: v_mov_b32_e32 v4, v0
622 ; GFX10-NEXT: s_mov_b32 s2, 0
623 ; GFX10-NEXT: .LBB1_2: ; %for.body
624 ; GFX10-NEXT: ; Parent Loop BB1_1 Depth=1
625 ; GFX10-NEXT: ; => This Inner Loop Header: Depth=2
626 ; GFX10-NEXT: v_add_co_u32 v7, vcc_lo, v4, 0xffffb800
627 ; GFX10-NEXT: v_add_co_ci_u32_e32 v8, vcc_lo, -1, v5, vcc_lo
628 ; GFX10-NEXT: v_add_co_u32 v9, vcc_lo, v4, 0xffffc800
629 ; GFX10-NEXT: v_add_co_ci_u32_e32 v10, vcc_lo, -1, v5, vcc_lo
630 ; GFX10-NEXT: v_add_co_u32 v13, vcc_lo, v4, 0xffffd800
631 ; GFX10-NEXT: v_add_co_ci_u32_e32 v14, vcc_lo, -1, v5, vcc_lo
632 ; GFX10-NEXT: v_add_co_u32 v17, vcc_lo, v4, 0xffffe800
633 ; GFX10-NEXT: s_clause 0x2
634 ; GFX10-NEXT: global_load_dwordx2 v[11:12], v[7:8], off offset:-2048
635 ; GFX10-NEXT: global_load_dwordx2 v[15:16], v[9:10], off offset:-2048
636 ; GFX10-NEXT: global_load_dwordx2 v[19:20], v[13:14], off offset:-2048
637 ; GFX10-NEXT: v_add_co_ci_u32_e32 v18, vcc_lo, -1, v5, vcc_lo
638 ; GFX10-NEXT: v_add_co_u32 v21, vcc_lo, 0xfffff000, v4
639 ; GFX10-NEXT: v_add_co_ci_u32_e32 v22, vcc_lo, -1, v5, vcc_lo
640 ; GFX10-NEXT: s_clause 0x7
641 ; GFX10-NEXT: global_load_dwordx2 v[23:24], v[17:18], off offset:-2048
642 ; GFX10-NEXT: global_load_dwordx2 v[7:8], v[7:8], off
643 ; GFX10-NEXT: global_load_dwordx2 v[9:10], v[9:10], off
644 ; GFX10-NEXT: global_load_dwordx2 v[13:14], v[13:14], off
645 ; GFX10-NEXT: global_load_dwordx2 v[25:26], v[17:18], off
646 ; GFX10-NEXT: global_load_dwordx2 v[27:28], v[21:22], off
647 ; GFX10-NEXT: global_load_dwordx2 v[29:30], v[4:5], off offset:-2048
648 ; GFX10-NEXT: global_load_dwordx2 v[31:32], v[4:5], off
649 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0x10000, v4
650 ; GFX10-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v5, vcc_lo
651 ; GFX10-NEXT: s_addk_i32 s2, 0x2000
652 ; GFX10-NEXT: s_cmp_gt_u32 s2, 0x3fffff
653 ; GFX10-NEXT: s_waitcnt vmcnt(10)
654 ; GFX10-NEXT: v_add_co_u32 v2, s0, v11, v2
655 ; GFX10-NEXT: v_add_co_ci_u32_e64 v3, s0, v12, v3, s0
656 ; GFX10-NEXT: s_waitcnt vmcnt(6)
657 ; GFX10-NEXT: v_add_co_u32 v2, s0, v7, v2
658 ; GFX10-NEXT: v_add_co_ci_u32_e64 v3, s0, v8, v3, s0
659 ; GFX10-NEXT: v_add_co_u32 v2, s0, v15, v2
660 ; GFX10-NEXT: v_add_co_ci_u32_e64 v3, s0, v16, v3, s0
661 ; GFX10-NEXT: s_waitcnt vmcnt(5)
662 ; GFX10-NEXT: v_add_co_u32 v2, s0, v9, v2
663 ; GFX10-NEXT: v_add_co_ci_u32_e64 v3, s0, v10, v3, s0
664 ; GFX10-NEXT: v_add_co_u32 v2, s0, v19, v2
665 ; GFX10-NEXT: v_add_co_ci_u32_e64 v3, s0, v20, v3, s0
666 ; GFX10-NEXT: s_waitcnt vmcnt(4)
667 ; GFX10-NEXT: v_add_co_u32 v2, s0, v13, v2
668 ; GFX10-NEXT: v_add_co_ci_u32_e64 v3, s0, v14, v3, s0
669 ; GFX10-NEXT: v_add_co_u32 v2, s0, v23, v2
670 ; GFX10-NEXT: v_add_co_ci_u32_e64 v3, s0, v24, v3, s0
671 ; GFX10-NEXT: s_waitcnt vmcnt(3)
672 ; GFX10-NEXT: v_add_co_u32 v2, s0, v25, v2
673 ; GFX10-NEXT: v_add_co_ci_u32_e64 v3, s0, v26, v3, s0
674 ; GFX10-NEXT: s_waitcnt vmcnt(2)
675 ; GFX10-NEXT: v_add_co_u32 v2, s0, v27, v2
676 ; GFX10-NEXT: v_add_co_ci_u32_e64 v3, s0, v28, v3, s0
677 ; GFX10-NEXT: s_waitcnt vmcnt(1)
678 ; GFX10-NEXT: v_add_co_u32 v2, s0, v29, v2
679 ; GFX10-NEXT: v_add_co_ci_u32_e64 v3, s0, v30, v3, s0
680 ; GFX10-NEXT: s_waitcnt vmcnt(0)
681 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v31, v2
682 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v32, v3, vcc_lo
683 ; GFX10-NEXT: s_cbranch_scc0 .LBB1_2
684 ; GFX10-NEXT: ; %bb.3: ; %while.cond.loopexit
685 ; GFX10-NEXT: ; in Loop: Header=BB1_1 Depth=1
686 ; GFX10-NEXT: s_add_i32 s0, s1, -1
687 ; GFX10-NEXT: s_cmp_eq_u32 s1, 0
688 ; GFX10-NEXT: s_cbranch_scc1 .LBB1_5
689 ; GFX10-NEXT: ; %bb.4: ; in Loop: Header=BB1_1 Depth=1
690 ; GFX10-NEXT: s_mov_b32 s1, s0
691 ; GFX10-NEXT: s_branch .LBB1_1
692 ; GFX10-NEXT: .LBB1_5: ; %while.end
693 ; GFX10-NEXT: v_add_co_u32 v0, s0, s34, v6
694 ; GFX10-NEXT: v_add_co_ci_u32_e64 v1, s0, s35, 0, s0
695 ; GFX10-NEXT: global_store_dwordx2 v[0:1], v[2:3], off
696 ; GFX10-NEXT: s_endpgm
698 ; GFX90A-LABEL: clmem_read:
699 ; GFX90A: ; %bb.0: ; %entry
700 ; GFX90A-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
701 ; GFX90A-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
702 ; GFX90A-NEXT: s_mov_b32 s38, -1
703 ; GFX90A-NEXT: s_mov_b32 s39, 0xe00000
704 ; GFX90A-NEXT: s_add_u32 s36, s36, s11
705 ; GFX90A-NEXT: s_addc_u32 s37, s37, 0
706 ; GFX90A-NEXT: s_getpc_b64 s[0:1]
707 ; GFX90A-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
708 ; GFX90A-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
709 ; GFX90A-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
710 ; GFX90A-NEXT: v_mov_b32_e32 v31, v0
711 ; GFX90A-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
712 ; GFX90A-NEXT: s_mov_b64 s[0:1], s[36:37]
713 ; GFX90A-NEXT: s_mov_b64 s[2:3], s[38:39]
714 ; GFX90A-NEXT: v_mov_b32_e32 v0, 0
715 ; GFX90A-NEXT: s_mov_b32 s32, 0
716 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
717 ; GFX90A-NEXT: s_swappc_b64 s[30:31], s[4:5]
718 ; GFX90A-NEXT: v_and_b32_e32 v1, 0xff, v0
719 ; GFX90A-NEXT: v_lshlrev_b32_e32 v0, 17, v0
720 ; GFX90A-NEXT: v_and_b32_e32 v0, 0xfe000000, v0
721 ; GFX90A-NEXT: v_lshl_or_b32 v1, v1, 3, v0
722 ; GFX90A-NEXT: v_mov_b32_e32 v2, s35
723 ; GFX90A-NEXT: v_add_co_u32_e32 v1, vcc, s34, v1
724 ; GFX90A-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v2, vcc
725 ; GFX90A-NEXT: s_movk_i32 s0, 0x5000
726 ; GFX90A-NEXT: v_add_co_u32_e32 v2, vcc, s0, v1
727 ; GFX90A-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v3, vcc
728 ; GFX90A-NEXT: s_movk_i32 s2, 0x7f
729 ; GFX90A-NEXT: v_pk_mov_b32 v[4:5], 0, 0
730 ; GFX90A-NEXT: s_movk_i32 s0, 0xd000
731 ; GFX90A-NEXT: s_movk_i32 s1, 0xe000
732 ; GFX90A-NEXT: s_movk_i32 s3, 0xf000
733 ; GFX90A-NEXT: .LBB1_1: ; %for.cond.preheader
734 ; GFX90A-NEXT: ; =>This Loop Header: Depth=1
735 ; GFX90A-NEXT: ; Child Loop BB1_2 Depth 2
736 ; GFX90A-NEXT: v_pk_mov_b32 v[6:7], v[2:3], v[2:3] op_sel:[0,1]
737 ; GFX90A-NEXT: s_mov_b32 s4, 0
738 ; GFX90A-NEXT: .LBB1_2: ; %for.body
739 ; GFX90A-NEXT: ; Parent Loop BB1_1 Depth=1
740 ; GFX90A-NEXT: ; => This Inner Loop Header: Depth=2
741 ; GFX90A-NEXT: v_add_co_u32_e32 v12, vcc, 0xffffb000, v6
742 ; GFX90A-NEXT: v_addc_co_u32_e32 v13, vcc, -1, v7, vcc
743 ; GFX90A-NEXT: global_load_dwordx2 v[8:9], v[6:7], off offset:-4096
744 ; GFX90A-NEXT: global_load_dwordx2 v[10:11], v[6:7], off offset:-2048
745 ; GFX90A-NEXT: v_add_co_u32_e32 v14, vcc, 0xffffc000, v6
746 ; GFX90A-NEXT: global_load_dwordx2 v[12:13], v[12:13], off
747 ; GFX90A-NEXT: v_addc_co_u32_e32 v15, vcc, -1, v7, vcc
748 ; GFX90A-NEXT: global_load_dwordx2 v[18:19], v[14:15], off offset:-2048
749 ; GFX90A-NEXT: v_add_co_u32_e32 v16, vcc, s0, v6
750 ; GFX90A-NEXT: v_addc_co_u32_e32 v17, vcc, -1, v7, vcc
751 ; GFX90A-NEXT: global_load_dwordx2 v[16:17], v[16:17], off offset:-2048
752 ; GFX90A-NEXT: v_add_co_u32_e32 v20, vcc, s1, v6
753 ; GFX90A-NEXT: global_load_dwordx2 v[14:15], v[14:15], off
754 ; GFX90A-NEXT: v_addc_co_u32_e32 v21, vcc, -1, v7, vcc
755 ; GFX90A-NEXT: global_load_dwordx2 v[24:25], v[20:21], off offset:-4096
756 ; GFX90A-NEXT: global_load_dwordx2 v[26:27], v[20:21], off offset:-2048
757 ; GFX90A-NEXT: global_load_dwordx2 v[28:29], v[20:21], off
758 ; GFX90A-NEXT: v_add_co_u32_e32 v22, vcc, s3, v6
759 ; GFX90A-NEXT: v_addc_co_u32_e32 v23, vcc, -1, v7, vcc
760 ; GFX90A-NEXT: global_load_dwordx2 v[20:21], v[22:23], off offset:-2048
761 ; GFX90A-NEXT: global_load_dwordx2 v[30:31], v[6:7], off
762 ; GFX90A-NEXT: v_add_co_u32_e32 v6, vcc, 0x10000, v6
763 ; GFX90A-NEXT: v_addc_co_u32_e32 v7, vcc, 0, v7, vcc
764 ; GFX90A-NEXT: s_addk_i32 s4, 0x2000
765 ; GFX90A-NEXT: s_cmp_gt_u32 s4, 0x3fffff
766 ; GFX90A-NEXT: s_waitcnt vmcnt(8)
767 ; GFX90A-NEXT: v_add_co_u32_e32 v1, vcc, v12, v4
768 ; GFX90A-NEXT: v_addc_co_u32_e32 v4, vcc, v13, v5, vcc
769 ; GFX90A-NEXT: s_waitcnt vmcnt(7)
770 ; GFX90A-NEXT: v_add_co_u32_e32 v1, vcc, v18, v1
771 ; GFX90A-NEXT: v_addc_co_u32_e32 v4, vcc, v19, v4, vcc
772 ; GFX90A-NEXT: s_waitcnt vmcnt(5)
773 ; GFX90A-NEXT: v_add_co_u32_e32 v1, vcc, v14, v1
774 ; GFX90A-NEXT: v_addc_co_u32_e32 v4, vcc, v15, v4, vcc
775 ; GFX90A-NEXT: v_add_co_u32_e32 v1, vcc, v16, v1
776 ; GFX90A-NEXT: v_addc_co_u32_e32 v4, vcc, v17, v4, vcc
777 ; GFX90A-NEXT: s_waitcnt vmcnt(4)
778 ; GFX90A-NEXT: v_add_co_u32_e32 v1, vcc, v24, v1
779 ; GFX90A-NEXT: v_addc_co_u32_e32 v4, vcc, v25, v4, vcc
780 ; GFX90A-NEXT: s_waitcnt vmcnt(3)
781 ; GFX90A-NEXT: v_add_co_u32_e32 v1, vcc, v26, v1
782 ; GFX90A-NEXT: v_addc_co_u32_e32 v4, vcc, v27, v4, vcc
783 ; GFX90A-NEXT: s_waitcnt vmcnt(2)
784 ; GFX90A-NEXT: v_add_co_u32_e32 v1, vcc, v28, v1
785 ; GFX90A-NEXT: v_addc_co_u32_e32 v4, vcc, v29, v4, vcc
786 ; GFX90A-NEXT: s_waitcnt vmcnt(1)
787 ; GFX90A-NEXT: v_add_co_u32_e32 v1, vcc, v20, v1
788 ; GFX90A-NEXT: v_addc_co_u32_e32 v4, vcc, v21, v4, vcc
789 ; GFX90A-NEXT: v_add_co_u32_e32 v1, vcc, v8, v1
790 ; GFX90A-NEXT: v_addc_co_u32_e32 v4, vcc, v9, v4, vcc
791 ; GFX90A-NEXT: v_add_co_u32_e32 v1, vcc, v10, v1
792 ; GFX90A-NEXT: v_addc_co_u32_e32 v5, vcc, v11, v4, vcc
793 ; GFX90A-NEXT: s_waitcnt vmcnt(0)
794 ; GFX90A-NEXT: v_add_co_u32_e32 v4, vcc, v30, v1
795 ; GFX90A-NEXT: v_addc_co_u32_e32 v5, vcc, v31, v5, vcc
796 ; GFX90A-NEXT: s_cbranch_scc0 .LBB1_2
797 ; GFX90A-NEXT: ; %bb.3: ; %while.cond.loopexit
798 ; GFX90A-NEXT: ; in Loop: Header=BB1_1 Depth=1
799 ; GFX90A-NEXT: s_add_i32 s4, s2, -1
800 ; GFX90A-NEXT: s_cmp_eq_u32 s2, 0
801 ; GFX90A-NEXT: s_cbranch_scc1 .LBB1_5
802 ; GFX90A-NEXT: ; %bb.4: ; in Loop: Header=BB1_1 Depth=1
803 ; GFX90A-NEXT: s_mov_b32 s2, s4
804 ; GFX90A-NEXT: s_branch .LBB1_1
805 ; GFX90A-NEXT: .LBB1_5: ; %while.end
806 ; GFX90A-NEXT: v_mov_b32_e32 v1, s35
807 ; GFX90A-NEXT: v_add_co_u32_e32 v0, vcc, s34, v0
808 ; GFX90A-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
809 ; GFX90A-NEXT: global_store_dwordx2 v[0:1], v[4:5], off
810 ; GFX90A-NEXT: s_endpgm
812 ; GFX11-LABEL: clmem_read:
813 ; GFX11: ; %bb.0: ; %entry
814 ; GFX11-NEXT: s_getpc_b64 s[0:1]
815 ; GFX11-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
816 ; GFX11-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
817 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
818 ; GFX11-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
819 ; GFX11-NEXT: s_load_b64 s[34:35], s[4:5], 0x24
820 ; GFX11-NEXT: s_mov_b32 s32, 0
821 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
822 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[0:1]
823 ; GFX11-NEXT: v_dual_mov_b32 v2, 0 :: v_dual_lshlrev_b32 v1, 17, v0
824 ; GFX11-NEXT: v_dual_mov_b32 v3, 0 :: v_dual_and_b32 v0, 0xff, v0
825 ; GFX11-NEXT: s_movk_i32 s1, 0x7f
826 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
827 ; GFX11-NEXT: v_and_b32_e32 v6, 0xfe000000, v1
828 ; GFX11-NEXT: v_lshl_or_b32 v0, v0, 3, v6
829 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
830 ; GFX11-NEXT: v_add_co_u32 v0, s0, v0, s34
831 ; GFX11-NEXT: v_add_co_ci_u32_e64 v1, null, 0, s35, s0
832 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
833 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0x5000, v0
834 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
835 ; GFX11-NEXT: .LBB1_1: ; %for.cond.preheader
836 ; GFX11-NEXT: ; =>This Loop Header: Depth=1
837 ; GFX11-NEXT: ; Child Loop BB1_2 Depth 2
838 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
839 ; GFX11-NEXT: v_dual_mov_b32 v5, v1 :: v_dual_mov_b32 v4, v0
840 ; GFX11-NEXT: s_mov_b32 s2, 0
841 ; GFX11-NEXT: .LBB1_2: ; %for.body
842 ; GFX11-NEXT: ; Parent Loop BB1_1 Depth=1
843 ; GFX11-NEXT: ; => This Inner Loop Header: Depth=2
844 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
845 ; GFX11-NEXT: v_add_co_u32 v7, vcc_lo, v4, 0xffffc000
846 ; GFX11-NEXT: v_add_co_ci_u32_e32 v8, vcc_lo, -1, v5, vcc_lo
847 ; GFX11-NEXT: v_add_co_u32 v9, vcc_lo, 0xffffc000, v4
848 ; GFX11-NEXT: v_add_co_ci_u32_e32 v10, vcc_lo, -1, v5, vcc_lo
849 ; GFX11-NEXT: v_add_co_u32 v11, vcc_lo, 0xffffd000, v4
850 ; GFX11-NEXT: s_clause 0x1
851 ; GFX11-NEXT: global_load_b64 v[13:14], v[7:8], off offset:-4096
852 ; GFX11-NEXT: global_load_b64 v[9:10], v[9:10], off offset:-2048
853 ; GFX11-NEXT: v_add_co_ci_u32_e32 v12, vcc_lo, -1, v5, vcc_lo
854 ; GFX11-NEXT: v_add_co_u32 v15, vcc_lo, v4, 0xffffe000
855 ; GFX11-NEXT: v_add_co_ci_u32_e32 v16, vcc_lo, -1, v5, vcc_lo
856 ; GFX11-NEXT: global_load_b64 v[11:12], v[11:12], off offset:-2048
857 ; GFX11-NEXT: v_add_co_u32 v17, vcc_lo, 0xffffe000, v4
858 ; GFX11-NEXT: s_clause 0x1
859 ; GFX11-NEXT: global_load_b64 v[19:20], v[15:16], off offset:-4096
860 ; GFX11-NEXT: global_load_b64 v[7:8], v[7:8], off
861 ; GFX11-NEXT: v_add_co_ci_u32_e32 v18, vcc_lo, -1, v5, vcc_lo
862 ; GFX11-NEXT: v_add_co_u32 v21, vcc_lo, 0xfffff000, v4
863 ; GFX11-NEXT: v_add_co_ci_u32_e32 v22, vcc_lo, -1, v5, vcc_lo
864 ; GFX11-NEXT: s_clause 0x5
865 ; GFX11-NEXT: global_load_b64 v[17:18], v[17:18], off offset:-2048
866 ; GFX11-NEXT: global_load_b64 v[15:16], v[15:16], off
867 ; GFX11-NEXT: global_load_b64 v[21:22], v[21:22], off offset:-2048
868 ; GFX11-NEXT: global_load_b64 v[23:24], v[4:5], off offset:-4096
869 ; GFX11-NEXT: global_load_b64 v[25:26], v[4:5], off offset:-2048
870 ; GFX11-NEXT: global_load_b64 v[27:28], v[4:5], off
871 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0x10000, v4
872 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v5, vcc_lo
873 ; GFX11-NEXT: s_addk_i32 s2, 0x2000
874 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
875 ; GFX11-NEXT: s_cmp_gt_u32 s2, 0x3fffff
876 ; GFX11-NEXT: s_waitcnt vmcnt(10)
877 ; GFX11-NEXT: v_add_co_u32 v2, s0, v13, v2
878 ; GFX11-NEXT: v_add_co_ci_u32_e64 v3, s0, v14, v3, s0
879 ; GFX11-NEXT: s_waitcnt vmcnt(9)
880 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
881 ; GFX11-NEXT: v_add_co_u32 v2, s0, v9, v2
882 ; GFX11-NEXT: v_add_co_ci_u32_e64 v3, s0, v10, v3, s0
883 ; GFX11-NEXT: s_waitcnt vmcnt(6)
884 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
885 ; GFX11-NEXT: v_add_co_u32 v2, s0, v7, v2
886 ; GFX11-NEXT: v_add_co_ci_u32_e64 v3, s0, v8, v3, s0
887 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
888 ; GFX11-NEXT: v_add_co_u32 v2, s0, v11, v2
889 ; GFX11-NEXT: v_add_co_ci_u32_e64 v3, s0, v12, v3, s0
890 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
891 ; GFX11-NEXT: v_add_co_u32 v2, s0, v19, v2
892 ; GFX11-NEXT: v_add_co_ci_u32_e64 v3, s0, v20, v3, s0
893 ; GFX11-NEXT: s_waitcnt vmcnt(5)
894 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
895 ; GFX11-NEXT: v_add_co_u32 v2, s0, v17, v2
896 ; GFX11-NEXT: v_add_co_ci_u32_e64 v3, s0, v18, v3, s0
897 ; GFX11-NEXT: s_waitcnt vmcnt(4)
898 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
899 ; GFX11-NEXT: v_add_co_u32 v2, s0, v15, v2
900 ; GFX11-NEXT: v_add_co_ci_u32_e64 v3, s0, v16, v3, s0
901 ; GFX11-NEXT: s_waitcnt vmcnt(3)
902 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
903 ; GFX11-NEXT: v_add_co_u32 v2, s0, v21, v2
904 ; GFX11-NEXT: v_add_co_ci_u32_e64 v3, s0, v22, v3, s0
905 ; GFX11-NEXT: s_waitcnt vmcnt(2)
906 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
907 ; GFX11-NEXT: v_add_co_u32 v2, s0, v23, v2
908 ; GFX11-NEXT: v_add_co_ci_u32_e64 v3, s0, v24, v3, s0
909 ; GFX11-NEXT: s_waitcnt vmcnt(1)
910 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
911 ; GFX11-NEXT: v_add_co_u32 v2, s0, v25, v2
912 ; GFX11-NEXT: v_add_co_ci_u32_e64 v3, s0, v26, v3, s0
913 ; GFX11-NEXT: s_waitcnt vmcnt(0)
914 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
915 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v27, v2
916 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v28, v3, vcc_lo
917 ; GFX11-NEXT: s_cbranch_scc0 .LBB1_2
918 ; GFX11-NEXT: ; %bb.3: ; %while.cond.loopexit
919 ; GFX11-NEXT: ; in Loop: Header=BB1_1 Depth=1
920 ; GFX11-NEXT: s_add_i32 s0, s1, -1
921 ; GFX11-NEXT: s_cmp_eq_u32 s1, 0
922 ; GFX11-NEXT: s_cbranch_scc1 .LBB1_5
923 ; GFX11-NEXT: ; %bb.4: ; in Loop: Header=BB1_1 Depth=1
924 ; GFX11-NEXT: s_mov_b32 s1, s0
925 ; GFX11-NEXT: s_branch .LBB1_1
926 ; GFX11-NEXT: .LBB1_5: ; %while.end
927 ; GFX11-NEXT: v_add_co_u32 v0, s0, s34, v6
928 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
929 ; GFX11-NEXT: v_add_co_ci_u32_e64 v1, null, s35, 0, s0
930 ; GFX11-NEXT: global_store_b64 v[0:1], v[2:3], off
931 ; GFX11-NEXT: s_endpgm
933 %call = tail call i64 @_Z13get_global_idj(i32 0)
934 %conv = and i64 %call, 255
935 %a0 = shl i64 %call, 17
936 %idx.ext11 = and i64 %a0, 4261412864
937 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
938 %add.ptr6 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 %conv
939 br label %for.cond.preheader
941 while.cond.loopexit: ; preds = %for.body
942 %dec = add nsw i32 %dec31, -1
943 %tobool = icmp eq i32 %dec31, 0
944 br i1 %tobool, label %while.end, label %for.cond.preheader
946 for.cond.preheader: ; preds = %entry, %while.cond.loopexit
947 %dec31 = phi i32 [ 127, %entry ], [ %dec, %while.cond.loopexit ]
948 %sum.030 = phi i64 [ 0, %entry ], [ %add.10, %while.cond.loopexit ]
951 for.body: ; preds = %for.body, %for.cond.preheader
952 %block.029 = phi i32 [ 0, %for.cond.preheader ], [ %add9.31, %for.body ]
953 %sum.128 = phi i64 [ %sum.030, %for.cond.preheader ], [ %add.10, %for.body ]
954 %conv3 = zext i32 %block.029 to i64
955 %add.ptr8 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3
956 %load1 = load i64, ptr addrspace(1) %add.ptr8, align 8
957 %add = add i64 %load1, %sum.128
959 %add9 = or disjoint i32 %block.029, 256
960 %conv3.1 = zext i32 %add9 to i64
961 %add.ptr8.1 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.1
962 %load2 = load i64, ptr addrspace(1) %add.ptr8.1, align 8
963 %add.1 = add i64 %load2, %add
965 %add9.1 = or disjoint i32 %block.029, 512
966 %conv3.2 = zext i32 %add9.1 to i64
967 %add.ptr8.2 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.2
968 %l3 = load i64, ptr addrspace(1) %add.ptr8.2, align 8
969 %add.2 = add i64 %l3, %add.1
971 %add9.2 = or disjoint i32 %block.029, 768
972 %conv3.3 = zext i32 %add9.2 to i64
973 %add.ptr8.3 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.3
974 %l4 = load i64, ptr addrspace(1) %add.ptr8.3, align 8
975 %add.3 = add i64 %l4, %add.2
977 %add9.3 = or disjoint i32 %block.029, 1024
978 %conv3.4 = zext i32 %add9.3 to i64
979 %add.ptr8.4 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.4
980 %l5 = load i64, ptr addrspace(1) %add.ptr8.4, align 8
981 %add.4 = add i64 %l5, %add.3
983 %add9.4 = or disjoint i32 %block.029, 1280
984 %conv3.5 = zext i32 %add9.4 to i64
985 %add.ptr8.5 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.5
986 %l6 = load i64, ptr addrspace(1) %add.ptr8.5, align 8
987 %add.5 = add i64 %l6, %add.4
989 %add9.5 = or disjoint i32 %block.029, 1536
990 %conv3.6 = zext i32 %add9.5 to i64
991 %add.ptr8.6 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.6
992 %load7 = load i64, ptr addrspace(1) %add.ptr8.6, align 8
993 %add.6 = add i64 %load7, %add.5
995 %add9.6 = or disjoint i32 %block.029, 1792
996 %conv3.7 = zext i32 %add9.6 to i64
997 %add.ptr8.7 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.7
998 %load8 = load i64, ptr addrspace(1) %add.ptr8.7, align 8
999 %add.7 = add i64 %load8, %add.6
1001 %add9.7 = or disjoint i32 %block.029, 2048
1002 %conv3.8 = zext i32 %add9.7 to i64
1003 %add.ptr8.8 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.8
1004 %load9 = load i64, ptr addrspace(1) %add.ptr8.8, align 8
1005 %add.8 = add i64 %load9, %add.7
1007 %add9.8 = or disjoint i32 %block.029, 2304
1008 %conv3.9 = zext i32 %add9.8 to i64
1009 %add.ptr8.9 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.9
1010 %load10 = load i64, ptr addrspace(1) %add.ptr8.9, align 8
1011 %add.9 = add i64 %load10, %add.8
1013 %add9.9 = or disjoint i32 %block.029, 2560
1014 %conv3.10 = zext i32 %add9.9 to i64
1015 %add.ptr8.10 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.10
1016 %load11 = load i64, ptr addrspace(1) %add.ptr8.10, align 8
1017 %add.10 = add i64 %load11, %add.9
1019 %add9.31 = add nuw nsw i32 %block.029, 8192
1020 %cmp.31 = icmp ult i32 %add9.31, 4194304
1021 br i1 %cmp.31, label %for.body, label %while.cond.loopexit
1023 while.end: ; preds = %while.cond.loopexit
1024 store i64 %add.10, ptr addrspace(1) %add.ptr12, align 8
1028 ; using 32bit address.
1029 define amdgpu_kernel void @Address32(ptr addrspace(1) %buffer) {
1030 ; GFX8-LABEL: Address32:
1031 ; GFX8: ; %bb.0: ; %entry
1032 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1033 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1034 ; GFX8-NEXT: s_mov_b32 s38, -1
1035 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
1036 ; GFX8-NEXT: s_add_u32 s36, s36, s11
1037 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
1038 ; GFX8-NEXT: s_getpc_b64 s[0:1]
1039 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1040 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1041 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
1042 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1043 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
1044 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
1045 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
1046 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
1047 ; GFX8-NEXT: s_mov_b32 s32, 0
1048 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1049 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
1050 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1051 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff8000, v1
1052 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
1053 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, s34, v1
1054 ; GFX8-NEXT: v_mov_b32_e32 v3, 2
1055 ; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc
1056 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1057 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v1, v0
1058 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v2, vcc
1059 ; GFX8-NEXT: s_movk_i32 s0, 0x400
1060 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, s0, v3
1061 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v4, vcc
1062 ; GFX8-NEXT: s_movk_i32 s0, 0x800
1063 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, s0, v3
1064 ; GFX8-NEXT: v_addc_u32_e32 v8, vcc, 0, v4, vcc
1065 ; GFX8-NEXT: s_movk_i32 s0, 0xc00
1066 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, s0, v3
1067 ; GFX8-NEXT: v_addc_u32_e32 v10, vcc, 0, v4, vcc
1068 ; GFX8-NEXT: s_movk_i32 s0, 0x1000
1069 ; GFX8-NEXT: v_add_u32_e32 v11, vcc, s0, v3
1070 ; GFX8-NEXT: v_addc_u32_e32 v12, vcc, 0, v4, vcc
1071 ; GFX8-NEXT: s_movk_i32 s0, 0x1400
1072 ; GFX8-NEXT: v_add_u32_e32 v13, vcc, s0, v3
1073 ; GFX8-NEXT: v_addc_u32_e32 v14, vcc, 0, v4, vcc
1074 ; GFX8-NEXT: s_movk_i32 s0, 0x1800
1075 ; GFX8-NEXT: v_add_u32_e32 v15, vcc, s0, v3
1076 ; GFX8-NEXT: v_addc_u32_e32 v16, vcc, 0, v4, vcc
1077 ; GFX8-NEXT: s_movk_i32 s0, 0x1c00
1078 ; GFX8-NEXT: v_add_u32_e32 v17, vcc, s0, v3
1079 ; GFX8-NEXT: v_addc_u32_e32 v18, vcc, 0, v4, vcc
1080 ; GFX8-NEXT: s_movk_i32 s0, 0x2000
1081 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
1082 ; GFX8-NEXT: flat_load_dword v19, v[5:6]
1083 ; GFX8-NEXT: flat_load_dword v7, v[7:8]
1084 ; GFX8-NEXT: flat_load_dword v8, v[9:10]
1085 ; GFX8-NEXT: flat_load_dword v9, v[11:12]
1086 ; GFX8-NEXT: flat_load_dword v10, v[13:14]
1087 ; GFX8-NEXT: flat_load_dword v11, v[15:16]
1088 ; GFX8-NEXT: flat_load_dword v12, v[17:18]
1089 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, s0, v3
1090 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v4, vcc
1091 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x2400, v3
1092 ; GFX8-NEXT: flat_load_dword v5, v[5:6]
1093 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v4, vcc
1094 ; GFX8-NEXT: flat_load_dword v3, v[3:4]
1095 ; GFX8-NEXT: s_waitcnt vmcnt(8)
1096 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v19, v0
1097 ; GFX8-NEXT: s_waitcnt vmcnt(7)
1098 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v7, v0
1099 ; GFX8-NEXT: s_waitcnt vmcnt(6)
1100 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v8, v0
1101 ; GFX8-NEXT: s_waitcnt vmcnt(5)
1102 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v9, v0
1103 ; GFX8-NEXT: s_waitcnt vmcnt(4)
1104 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v10, v0
1105 ; GFX8-NEXT: s_waitcnt vmcnt(3)
1106 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v11, v0
1107 ; GFX8-NEXT: s_waitcnt vmcnt(2)
1108 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v12, v0
1109 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1110 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v5, v0
1111 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1112 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v3, v0
1113 ; GFX8-NEXT: flat_store_dword v[1:2], v0
1114 ; GFX8-NEXT: s_endpgm
1116 ; GFX9-LABEL: Address32:
1117 ; GFX9: ; %bb.0: ; %entry
1118 ; GFX9-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1119 ; GFX9-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1120 ; GFX9-NEXT: s_mov_b32 s38, -1
1121 ; GFX9-NEXT: s_mov_b32 s39, 0xe00000
1122 ; GFX9-NEXT: s_add_u32 s36, s36, s11
1123 ; GFX9-NEXT: s_addc_u32 s37, s37, 0
1124 ; GFX9-NEXT: s_getpc_b64 s[0:1]
1125 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1126 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1127 ; GFX9-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
1128 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
1129 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1130 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37]
1131 ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39]
1132 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
1133 ; GFX9-NEXT: s_mov_b32 s32, 0
1134 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
1135 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
1136 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1137 ; GFX9-NEXT: v_and_b32_e32 v4, 0xffff8000, v1
1138 ; GFX9-NEXT: v_mov_b32_e32 v1, s35
1139 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s34, v4
1140 ; GFX9-NEXT: v_mov_b32_e32 v3, 2
1141 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1142 ; GFX9-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1143 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v2, v0
1144 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1145 ; GFX9-NEXT: s_movk_i32 s0, 0x1000
1146 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s0, v0
1147 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v1, vcc
1148 ; GFX9-NEXT: global_load_dword v5, v[0:1], off
1149 ; GFX9-NEXT: global_load_dword v6, v[0:1], off offset:1024
1150 ; GFX9-NEXT: global_load_dword v7, v[0:1], off offset:2048
1151 ; GFX9-NEXT: global_load_dword v8, v[0:1], off offset:3072
1152 ; GFX9-NEXT: global_load_dword v9, v[2:3], off
1153 ; GFX9-NEXT: global_load_dword v10, v[2:3], off offset:1024
1154 ; GFX9-NEXT: global_load_dword v11, v[2:3], off offset:2048
1155 ; GFX9-NEXT: global_load_dword v12, v[2:3], off offset:3072
1156 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, 0x2000, v0
1157 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1158 ; GFX9-NEXT: global_load_dword v2, v[0:1], off
1159 ; GFX9-NEXT: global_load_dword v3, v[0:1], off offset:1024
1160 ; GFX9-NEXT: s_waitcnt vmcnt(8)
1161 ; GFX9-NEXT: v_add_u32_e32 v0, v6, v5
1162 ; GFX9-NEXT: s_waitcnt vmcnt(6)
1163 ; GFX9-NEXT: v_add3_u32 v0, v7, v0, v8
1164 ; GFX9-NEXT: s_waitcnt vmcnt(4)
1165 ; GFX9-NEXT: v_add3_u32 v0, v9, v0, v10
1166 ; GFX9-NEXT: s_waitcnt vmcnt(2)
1167 ; GFX9-NEXT: v_add3_u32 v0, v11, v0, v12
1168 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1169 ; GFX9-NEXT: v_add3_u32 v0, v2, v0, v3
1170 ; GFX9-NEXT: global_store_dword v4, v0, s[34:35]
1171 ; GFX9-NEXT: s_endpgm
1173 ; GFX10-LABEL: Address32:
1174 ; GFX10: ; %bb.0: ; %entry
1175 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1176 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1177 ; GFX10-NEXT: s_mov_b32 s38, -1
1178 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
1179 ; GFX10-NEXT: s_add_u32 s36, s36, s11
1180 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
1181 ; GFX10-NEXT: s_getpc_b64 s[0:1]
1182 ; GFX10-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1183 ; GFX10-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1184 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
1185 ; GFX10-NEXT: s_load_dwordx2 s[6:7], s[0:1], 0x0
1186 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
1187 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
1188 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
1189 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
1190 ; GFX10-NEXT: s_mov_b32 s32, 0
1191 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1192 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[6:7]
1193 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1194 ; GFX10-NEXT: v_mov_b32_e32 v2, 2
1195 ; GFX10-NEXT: v_and_b32_e32 v8, 0xffff8000, v1
1196 ; GFX10-NEXT: v_lshlrev_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1197 ; GFX10-NEXT: v_add_co_u32 v1, s0, s34, v8
1198 ; GFX10-NEXT: v_add_co_ci_u32_e64 v2, s0, s35, 0, s0
1199 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
1200 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
1201 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, 0x800, v0
1202 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
1203 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, v0, 0x1000
1204 ; GFX10-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
1205 ; GFX10-NEXT: v_add_co_u32 v6, vcc_lo, 0x1000, v0
1206 ; GFX10-NEXT: s_clause 0x4
1207 ; GFX10-NEXT: global_load_dword v9, v[0:1], off
1208 ; GFX10-NEXT: global_load_dword v10, v[0:1], off offset:1024
1209 ; GFX10-NEXT: global_load_dword v11, v[2:3], off offset:1024
1210 ; GFX10-NEXT: global_load_dword v12, v[4:5], off offset:-2048
1211 ; GFX10-NEXT: global_load_dword v13, v[4:5], off
1212 ; GFX10-NEXT: v_add_co_ci_u32_e32 v7, vcc_lo, 0, v1, vcc_lo
1213 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, 0x1800, v0
1214 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
1215 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, v0, 0x2000
1216 ; GFX10-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
1217 ; GFX10-NEXT: s_clause 0x1
1218 ; GFX10-NEXT: global_load_dword v14, v[6:7], off offset:1024
1219 ; GFX10-NEXT: global_load_dword v15, v[2:3], off offset:1024
1220 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x2000, v0
1221 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
1222 ; GFX10-NEXT: s_clause 0x2
1223 ; GFX10-NEXT: global_load_dword v2, v[4:5], off offset:-2048
1224 ; GFX10-NEXT: global_load_dword v3, v[4:5], off
1225 ; GFX10-NEXT: global_load_dword v6, v[0:1], off offset:1024
1226 ; GFX10-NEXT: s_waitcnt vmcnt(8)
1227 ; GFX10-NEXT: v_add_nc_u32_e32 v0, v10, v9
1228 ; GFX10-NEXT: s_waitcnt vmcnt(6)
1229 ; GFX10-NEXT: v_add3_u32 v0, v12, v0, v11
1230 ; GFX10-NEXT: s_waitcnt vmcnt(4)
1231 ; GFX10-NEXT: v_add3_u32 v0, v13, v0, v14
1232 ; GFX10-NEXT: s_waitcnt vmcnt(2)
1233 ; GFX10-NEXT: v_add3_u32 v0, v2, v0, v15
1234 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1235 ; GFX10-NEXT: v_add3_u32 v0, v3, v0, v6
1236 ; GFX10-NEXT: global_store_dword v8, v0, s[34:35]
1237 ; GFX10-NEXT: s_endpgm
1239 ; GFX11-LABEL: Address32:
1240 ; GFX11: ; %bb.0: ; %entry
1241 ; GFX11-NEXT: s_getpc_b64 s[0:1]
1242 ; GFX11-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1243 ; GFX11-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1244 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
1245 ; GFX11-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1246 ; GFX11-NEXT: s_load_b64 s[34:35], s[4:5], 0x24
1247 ; GFX11-NEXT: s_mov_b32 s32, 0
1248 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1249 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[0:1]
1250 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1251 ; GFX11-NEXT: v_and_b32_e32 v0, 0xff, v0
1252 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1253 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff8000, v1
1254 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1255 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
1256 ; GFX11-NEXT: v_add_co_u32 v1, s0, s34, v6
1257 ; GFX11-NEXT: v_add_co_ci_u32_e64 v2, null, s35, 0, s0
1258 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1259 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
1260 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
1261 ; GFX11-NEXT: s_clause 0x1
1262 ; GFX11-NEXT: global_load_b32 v7, v[0:1], off
1263 ; GFX11-NEXT: global_load_b32 v8, v[0:1], off offset:1024
1264 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, 0x1000, v0
1265 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
1266 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, v0, 0x2000
1267 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
1268 ; GFX11-NEXT: s_clause 0x5
1269 ; GFX11-NEXT: global_load_b32 v9, v[0:1], off offset:2048
1270 ; GFX11-NEXT: global_load_b32 v10, v[0:1], off offset:3072
1271 ; GFX11-NEXT: global_load_b32 v11, v[4:5], off offset:-4096
1272 ; GFX11-NEXT: global_load_b32 v12, v[2:3], off offset:1024
1273 ; GFX11-NEXT: global_load_b32 v13, v[2:3], off offset:2048
1274 ; GFX11-NEXT: global_load_b32 v2, v[2:3], off offset:3072
1275 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0x2000, v0
1276 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
1277 ; GFX11-NEXT: s_clause 0x1
1278 ; GFX11-NEXT: global_load_b32 v3, v[4:5], off
1279 ; GFX11-NEXT: global_load_b32 v0, v[0:1], off offset:1024
1280 ; GFX11-NEXT: s_waitcnt vmcnt(8)
1281 ; GFX11-NEXT: v_add_nc_u32_e32 v1, v8, v7
1282 ; GFX11-NEXT: s_waitcnt vmcnt(6)
1283 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
1284 ; GFX11-NEXT: v_add3_u32 v1, v9, v1, v10
1285 ; GFX11-NEXT: s_waitcnt vmcnt(4)
1286 ; GFX11-NEXT: v_add3_u32 v1, v11, v1, v12
1287 ; GFX11-NEXT: s_waitcnt vmcnt(2)
1288 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
1289 ; GFX11-NEXT: v_add3_u32 v1, v13, v1, v2
1290 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1291 ; GFX11-NEXT: v_add3_u32 v0, v3, v1, v0
1292 ; GFX11-NEXT: global_store_b32 v6, v0, s[34:35]
1293 ; GFX11-NEXT: s_endpgm
1295 %call = tail call i64 @_Z13get_global_idj(i32 0)
1296 %conv = and i64 %call, 255
1297 %id = shl i64 %call, 7
1298 %idx.ext11 = and i64 %id, 4294934528
1299 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
1301 %add.ptr6 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr12, i64 %conv
1302 %load1 = load i32, ptr addrspace(1) %add.ptr6, align 4
1304 %add.ptr8.1 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 256
1305 %load2 = load i32, ptr addrspace(1) %add.ptr8.1, align 4
1306 %add.1 = add i32 %load2, %load1
1308 %add.ptr8.2 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 512
1309 %load3 = load i32, ptr addrspace(1) %add.ptr8.2, align 4
1310 %add.2 = add i32 %load3, %add.1
1312 %add.ptr8.3 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 768
1313 %load4 = load i32, ptr addrspace(1) %add.ptr8.3, align 4
1314 %add.3 = add i32 %load4, %add.2
1316 %add.ptr8.4 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 1024
1317 %load5 = load i32, ptr addrspace(1) %add.ptr8.4, align 4
1318 %add.4 = add i32 %load5, %add.3
1320 %add.ptr8.5 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 1280
1321 %load6 = load i32, ptr addrspace(1) %add.ptr8.5, align 4
1322 %add.5 = add i32 %load6, %add.4
1324 %add.ptr8.6 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 1536
1325 %load7 = load i32, ptr addrspace(1) %add.ptr8.6, align 4
1326 %add.6 = add i32 %load7, %add.5
1328 %add.ptr8.7 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 1792
1329 %load8 = load i32, ptr addrspace(1) %add.ptr8.7, align 4
1330 %add.7 = add i32 %load8, %add.6
1332 %add.ptr8.8 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 2048
1333 %load9 = load i32, ptr addrspace(1) %add.ptr8.8, align 4
1334 %add.8 = add i32 %load9, %add.7
1336 %add.ptr8.9 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 2304
1337 %load10 = load i32, ptr addrspace(1) %add.ptr8.9, align 4
1338 %add.9 = add i32 %load10, %add.8
1340 store i32 %add.9, ptr addrspace(1) %add.ptr12, align 4
1344 define amdgpu_kernel void @Offset64(ptr addrspace(1) %buffer) {
1345 ; GFX8-LABEL: Offset64:
1346 ; GFX8: ; %bb.0: ; %entry
1347 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1348 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1349 ; GFX8-NEXT: s_mov_b32 s38, -1
1350 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
1351 ; GFX8-NEXT: s_add_u32 s36, s36, s11
1352 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
1353 ; GFX8-NEXT: s_getpc_b64 s[0:1]
1354 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1355 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1356 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
1357 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1358 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
1359 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
1360 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
1361 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
1362 ; GFX8-NEXT: s_mov_b32 s32, 0
1363 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1364 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
1365 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1366 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff8000, v1
1367 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
1368 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, s34, v1
1369 ; GFX8-NEXT: v_mov_b32_e32 v3, 3
1370 ; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc
1371 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1372 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v1, v0
1373 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v2, vcc
1374 ; GFX8-NEXT: s_movk_i32 s0, 0xf000
1375 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, s0, v3
1376 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v4, vcc
1377 ; GFX8-NEXT: s_movk_i32 s0, 0xf800
1378 ; GFX8-NEXT: flat_load_dwordx2 v[7:8], v[3:4]
1379 ; GFX8-NEXT: flat_load_dwordx2 v[5:6], v[5:6]
1380 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, s0, v3
1381 ; GFX8-NEXT: v_addc_u32_e32 v10, vcc, 0, v4, vcc
1382 ; GFX8-NEXT: flat_load_dwordx2 v[9:10], v[9:10]
1383 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0, v3
1384 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 1, v4, vcc
1385 ; GFX8-NEXT: flat_load_dwordx2 v[3:4], v[3:4]
1386 ; GFX8-NEXT: s_waitcnt vmcnt(2)
1387 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v5, v7
1388 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v6, v8, vcc
1389 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1390 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v9, v0
1391 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v10, v5, vcc
1392 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1393 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v3, v0
1394 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v4, v5, vcc
1395 ; GFX8-NEXT: flat_store_dwordx2 v[1:2], v[3:4]
1396 ; GFX8-NEXT: s_endpgm
1398 ; GFX9-LABEL: Offset64:
1399 ; GFX9: ; %bb.0: ; %entry
1400 ; GFX9-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1401 ; GFX9-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1402 ; GFX9-NEXT: s_mov_b32 s38, -1
1403 ; GFX9-NEXT: s_mov_b32 s39, 0xe00000
1404 ; GFX9-NEXT: s_add_u32 s36, s36, s11
1405 ; GFX9-NEXT: s_addc_u32 s37, s37, 0
1406 ; GFX9-NEXT: s_getpc_b64 s[0:1]
1407 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1408 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1409 ; GFX9-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
1410 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
1411 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1412 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37]
1413 ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39]
1414 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
1415 ; GFX9-NEXT: s_mov_b32 s32, 0
1416 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
1417 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
1418 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1419 ; GFX9-NEXT: v_and_b32_e32 v12, 0xffff8000, v1
1420 ; GFX9-NEXT: v_mov_b32_e32 v1, s35
1421 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s34, v12
1422 ; GFX9-NEXT: v_mov_b32_e32 v3, 3
1423 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1424 ; GFX9-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1425 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v2, v0
1426 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1427 ; GFX9-NEXT: v_add_co_u32_e32 v4, vcc, 0, v0
1428 ; GFX9-NEXT: v_addc_co_u32_e32 v5, vcc, 1, v1, vcc
1429 ; GFX9-NEXT: global_load_dwordx2 v[2:3], v[0:1], off
1430 ; GFX9-NEXT: global_load_dwordx2 v[6:7], v[4:5], off offset:-4096
1431 ; GFX9-NEXT: s_movk_i32 s0, 0xf000
1432 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, s0, v0
1433 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1434 ; GFX9-NEXT: global_load_dwordx2 v[8:9], v[4:5], off
1435 ; GFX9-NEXT: global_load_dwordx2 v[10:11], v[0:1], off offset:2048
1436 ; GFX9-NEXT: s_waitcnt vmcnt(2)
1437 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v6, v2
1438 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v7, v3, vcc
1439 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1440 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v10, v0
1441 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v11, v1, vcc
1442 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v8, v0
1443 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v9, v1, vcc
1444 ; GFX9-NEXT: global_store_dwordx2 v12, v[0:1], s[34:35]
1445 ; GFX9-NEXT: s_endpgm
1447 ; GFX10-LABEL: Offset64:
1448 ; GFX10: ; %bb.0: ; %entry
1449 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1450 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1451 ; GFX10-NEXT: s_mov_b32 s38, -1
1452 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
1453 ; GFX10-NEXT: s_add_u32 s36, s36, s11
1454 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
1455 ; GFX10-NEXT: s_getpc_b64 s[0:1]
1456 ; GFX10-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1457 ; GFX10-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1458 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
1459 ; GFX10-NEXT: s_load_dwordx2 s[6:7], s[0:1], 0x0
1460 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
1461 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
1462 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
1463 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
1464 ; GFX10-NEXT: s_mov_b32 s32, 0
1465 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1466 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[6:7]
1467 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1468 ; GFX10-NEXT: v_mov_b32_e32 v2, 3
1469 ; GFX10-NEXT: v_and_b32_e32 v12, 0xffff8000, v1
1470 ; GFX10-NEXT: v_lshlrev_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1471 ; GFX10-NEXT: v_add_co_u32 v1, s0, s34, v12
1472 ; GFX10-NEXT: v_add_co_ci_u32_e64 v2, s0, s35, 0, s0
1473 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
1474 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
1475 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v0, 0xfffff800
1476 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
1477 ; GFX10-NEXT: s_clause 0x1
1478 ; GFX10-NEXT: global_load_dwordx2 v[4:5], v[0:1], off
1479 ; GFX10-NEXT: global_load_dwordx2 v[6:7], v[2:3], off offset:-2048
1480 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0, v0
1481 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 1, v1, vcc_lo
1482 ; GFX10-NEXT: s_clause 0x1
1483 ; GFX10-NEXT: global_load_dwordx2 v[8:9], v[2:3], off
1484 ; GFX10-NEXT: global_load_dwordx2 v[10:11], v[0:1], off
1485 ; GFX10-NEXT: s_waitcnt vmcnt(2)
1486 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v6, v4
1487 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v7, v5, vcc_lo
1488 ; GFX10-NEXT: s_waitcnt vmcnt(1)
1489 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v8, v0
1490 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v9, v1, vcc_lo
1491 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1492 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v10, v0
1493 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v11, v1, vcc_lo
1494 ; GFX10-NEXT: global_store_dwordx2 v12, v[0:1], s[34:35]
1495 ; GFX10-NEXT: s_endpgm
1497 ; GFX11-LABEL: Offset64:
1498 ; GFX11: ; %bb.0: ; %entry
1499 ; GFX11-NEXT: s_getpc_b64 s[0:1]
1500 ; GFX11-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1501 ; GFX11-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1502 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
1503 ; GFX11-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1504 ; GFX11-NEXT: s_load_b64 s[34:35], s[4:5], 0x24
1505 ; GFX11-NEXT: s_mov_b32 s32, 0
1506 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1507 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[0:1]
1508 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1509 ; GFX11-NEXT: v_and_b32_e32 v0, 0xff, v0
1510 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1511 ; GFX11-NEXT: v_and_b32_e32 v8, 0xffff8000, v1
1512 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 3, v0
1513 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
1514 ; GFX11-NEXT: v_add_co_u32 v1, s0, s34, v8
1515 ; GFX11-NEXT: v_add_co_ci_u32_e64 v2, null, s35, 0, s0
1516 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1517 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
1518 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
1519 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1520 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, v0, 0
1521 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 1, v1, vcc_lo
1522 ; GFX11-NEXT: global_load_b64 v[2:3], v[0:1], off
1523 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff000, v0
1524 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
1525 ; GFX11-NEXT: s_clause 0x2
1526 ; GFX11-NEXT: global_load_b64 v[6:7], v[4:5], off offset:-4096
1527 ; GFX11-NEXT: global_load_b64 v[4:5], v[4:5], off
1528 ; GFX11-NEXT: global_load_b64 v[0:1], v[0:1], off offset:2048
1529 ; GFX11-NEXT: s_waitcnt vmcnt(2)
1530 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v6, v2
1531 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v7, v3, vcc_lo
1532 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1533 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1534 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v0, v2
1535 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v1, v3, vcc_lo
1536 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1537 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v4, v0
1538 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v5, v1, vcc_lo
1539 ; GFX11-NEXT: global_store_b64 v8, v[0:1], s[34:35]
1540 ; GFX11-NEXT: s_endpgm
1542 %call = tail call i64 @_Z13get_global_idj(i32 0)
1543 %conv = and i64 %call, 255
1544 %a0 = shl i64 %call, 7
1545 %idx.ext11 = and i64 %a0, 4294934528
1546 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
1548 %addr1 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 %conv
1549 %load1 = load i64, ptr addrspace(1) %addr1, align 8
1551 %addr2 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 536870400
1552 %load2 = load i64, ptr addrspace(1) %addr2, align 8
1554 %add1 = add i64 %load2, %load1
1556 %addr3 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 536870656
1557 %load3 = load i64, ptr addrspace(1) %addr3, align 8
1559 %add2 = add i64 %load3, %add1
1561 %addr4 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 536870912
1562 %load4 = load i64, ptr addrspace(1) %addr4, align 8
1563 %add4 = add i64 %load4, %add2
1565 store i64 %add4, ptr addrspace(1) %add.ptr12, align 8
1569 ; TODO: Support load4 as anchor instruction.
1570 define amdgpu_kernel void @p32Offset64(ptr addrspace(1) %buffer) {
1571 ; GFX8-LABEL: p32Offset64:
1572 ; GFX8: ; %bb.0: ; %entry
1573 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1574 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1575 ; GFX8-NEXT: s_mov_b32 s38, -1
1576 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
1577 ; GFX8-NEXT: s_add_u32 s36, s36, s11
1578 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
1579 ; GFX8-NEXT: s_getpc_b64 s[0:1]
1580 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1581 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1582 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
1583 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1584 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
1585 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
1586 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
1587 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
1588 ; GFX8-NEXT: s_mov_b32 s32, 0
1589 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1590 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
1591 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1592 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff8000, v1
1593 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
1594 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, s34, v1
1595 ; GFX8-NEXT: v_mov_b32_e32 v3, 2
1596 ; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc
1597 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1598 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v1, v0
1599 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v2, vcc
1600 ; GFX8-NEXT: s_mov_b32 s0, 0x7ffff800
1601 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, s0, v3
1602 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v4, vcc
1603 ; GFX8-NEXT: s_mov_b32 s0, 0x7ffffc00
1604 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, s0, v3
1605 ; GFX8-NEXT: v_addc_u32_e32 v8, vcc, 0, v4, vcc
1606 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
1607 ; GFX8-NEXT: flat_load_dword v5, v[5:6]
1608 ; GFX8-NEXT: flat_load_dword v6, v[7:8]
1609 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x80000000, v3
1610 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v4, vcc
1611 ; GFX8-NEXT: flat_load_dword v3, v[3:4]
1612 ; GFX8-NEXT: s_waitcnt vmcnt(2)
1613 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v5, v0
1614 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1615 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v6, v0
1616 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1617 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v3, v0
1618 ; GFX8-NEXT: flat_store_dword v[1:2], v0
1619 ; GFX8-NEXT: s_endpgm
1621 ; GFX9-LABEL: p32Offset64:
1622 ; GFX9: ; %bb.0: ; %entry
1623 ; GFX9-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1624 ; GFX9-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1625 ; GFX9-NEXT: s_mov_b32 s38, -1
1626 ; GFX9-NEXT: s_mov_b32 s39, 0xe00000
1627 ; GFX9-NEXT: s_add_u32 s36, s36, s11
1628 ; GFX9-NEXT: s_addc_u32 s37, s37, 0
1629 ; GFX9-NEXT: s_getpc_b64 s[0:1]
1630 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1631 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1632 ; GFX9-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
1633 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
1634 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1635 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37]
1636 ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39]
1637 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
1638 ; GFX9-NEXT: s_mov_b32 s32, 0
1639 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
1640 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
1641 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1642 ; GFX9-NEXT: v_and_b32_e32 v6, 0xffff8000, v1
1643 ; GFX9-NEXT: v_mov_b32_e32 v1, s35
1644 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s34, v6
1645 ; GFX9-NEXT: v_mov_b32_e32 v3, 2
1646 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1647 ; GFX9-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1648 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v2, v0
1649 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1650 ; GFX9-NEXT: s_mov_b32 s0, 0x7ffff000
1651 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s0, v0
1652 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v1, vcc
1653 ; GFX9-NEXT: v_add_co_u32_e32 v4, vcc, 0x80000000, v0
1654 ; GFX9-NEXT: v_addc_co_u32_e32 v5, vcc, 0, v1, vcc
1655 ; GFX9-NEXT: global_load_dword v7, v[0:1], off
1656 ; GFX9-NEXT: global_load_dword v8, v[2:3], off offset:2048
1657 ; GFX9-NEXT: global_load_dword v9, v[2:3], off offset:3072
1658 ; GFX9-NEXT: global_load_dword v10, v[4:5], off
1659 ; GFX9-NEXT: s_waitcnt vmcnt(2)
1660 ; GFX9-NEXT: v_add_u32_e32 v0, v8, v7
1661 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1662 ; GFX9-NEXT: v_add3_u32 v0, v9, v0, v10
1663 ; GFX9-NEXT: global_store_dword v6, v0, s[34:35]
1664 ; GFX9-NEXT: s_endpgm
1666 ; GFX10-LABEL: p32Offset64:
1667 ; GFX10: ; %bb.0: ; %entry
1668 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1669 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1670 ; GFX10-NEXT: s_mov_b32 s38, -1
1671 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
1672 ; GFX10-NEXT: s_add_u32 s36, s36, s11
1673 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
1674 ; GFX10-NEXT: s_getpc_b64 s[0:1]
1675 ; GFX10-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1676 ; GFX10-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1677 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
1678 ; GFX10-NEXT: s_load_dwordx2 s[6:7], s[0:1], 0x0
1679 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
1680 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
1681 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
1682 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
1683 ; GFX10-NEXT: s_mov_b32 s32, 0
1684 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1685 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[6:7]
1686 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1687 ; GFX10-NEXT: v_mov_b32_e32 v2, 2
1688 ; GFX10-NEXT: v_and_b32_e32 v4, 0xffff8000, v1
1689 ; GFX10-NEXT: v_lshlrev_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1690 ; GFX10-NEXT: v_add_co_u32 v1, s0, s34, v4
1691 ; GFX10-NEXT: v_add_co_ci_u32_e64 v2, s0, s35, 0, s0
1692 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
1693 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
1694 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v0, 0x80000000
1695 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
1696 ; GFX10-NEXT: global_load_dword v5, v[0:1], off
1697 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7ffff800, v0
1698 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
1699 ; GFX10-NEXT: s_clause 0x2
1700 ; GFX10-NEXT: global_load_dword v6, v[2:3], off offset:-2048
1701 ; GFX10-NEXT: global_load_dword v7, v[2:3], off
1702 ; GFX10-NEXT: global_load_dword v8, v[0:1], off offset:1024
1703 ; GFX10-NEXT: s_waitcnt vmcnt(2)
1704 ; GFX10-NEXT: v_add_nc_u32_e32 v0, v6, v5
1705 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1706 ; GFX10-NEXT: v_add3_u32 v0, v8, v0, v7
1707 ; GFX10-NEXT: global_store_dword v4, v0, s[34:35]
1708 ; GFX10-NEXT: s_endpgm
1710 ; GFX11-LABEL: p32Offset64:
1711 ; GFX11: ; %bb.0: ; %entry
1712 ; GFX11-NEXT: s_getpc_b64 s[0:1]
1713 ; GFX11-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1714 ; GFX11-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1715 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
1716 ; GFX11-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1717 ; GFX11-NEXT: s_load_b64 s[34:35], s[4:5], 0x24
1718 ; GFX11-NEXT: s_mov_b32 s32, 0
1719 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1720 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[0:1]
1721 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1722 ; GFX11-NEXT: v_and_b32_e32 v0, 0xff, v0
1723 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1724 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff8000, v1
1725 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1726 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
1727 ; GFX11-NEXT: v_add_co_u32 v1, s0, s34, v6
1728 ; GFX11-NEXT: v_add_co_ci_u32_e64 v2, null, s35, 0, s0
1729 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1730 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
1731 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
1732 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1733 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, 0x7ffff000, v0
1734 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
1735 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0x80000000, v0
1736 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
1737 ; GFX11-NEXT: s_clause 0x3
1738 ; GFX11-NEXT: global_load_b32 v0, v[0:1], off
1739 ; GFX11-NEXT: global_load_b32 v1, v[2:3], off offset:2048
1740 ; GFX11-NEXT: global_load_b32 v2, v[2:3], off offset:3072
1741 ; GFX11-NEXT: global_load_b32 v3, v[4:5], off
1742 ; GFX11-NEXT: s_waitcnt vmcnt(2)
1743 ; GFX11-NEXT: v_add_nc_u32_e32 v0, v1, v0
1744 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1745 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
1746 ; GFX11-NEXT: v_add3_u32 v0, v2, v0, v3
1747 ; GFX11-NEXT: global_store_b32 v6, v0, s[34:35]
1748 ; GFX11-NEXT: s_endpgm
1750 %call = tail call i64 @_Z13get_global_idj(i32 0)
1751 %conv = and i64 %call, 255
1752 %a0 = shl i64 %call, 7
1753 %idx.ext11 = and i64 %a0, 4294934528
1754 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
1756 %addr1 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr12, i64 %conv
1757 %load1 = load i32, ptr addrspace(1) %addr1, align 8
1759 %addr2 = getelementptr inbounds i32, ptr addrspace(1) %addr1, i64 536870400
1760 %load2 = load i32, ptr addrspace(1) %addr2, align 8
1762 %add1 = add i32 %load2, %load1
1764 %addr3 = getelementptr inbounds i32, ptr addrspace(1) %addr1, i64 536870656
1765 %load3 = load i32, ptr addrspace(1) %addr3, align 8
1767 %add2 = add i32 %load3, %add1
1769 %addr4 = getelementptr inbounds i32, ptr addrspace(1) %addr1, i64 536870912
1770 %load4 = load i32, ptr addrspace(1) %addr4, align 8
1771 %add4 = add i32 %load4, %add2
1773 store i32 %add4, ptr addrspace(1) %add.ptr12, align 8
1777 define amdgpu_kernel void @DiffBase(ptr addrspace(1) %buffer1,
1778 ; GFX8-LABEL: DiffBase:
1779 ; GFX8: ; %bb.0: ; %entry
1780 ; GFX8-NEXT: s_mov_b32 s40, SCRATCH_RSRC_DWORD0
1781 ; GFX8-NEXT: s_mov_b32 s41, SCRATCH_RSRC_DWORD1
1782 ; GFX8-NEXT: s_mov_b32 s42, -1
1783 ; GFX8-NEXT: s_mov_b32 s43, 0xe80000
1784 ; GFX8-NEXT: s_add_u32 s40, s40, s11
1785 ; GFX8-NEXT: s_addc_u32 s41, s41, 0
1786 ; GFX8-NEXT: s_getpc_b64 s[0:1]
1787 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1788 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1789 ; GFX8-NEXT: s_load_dwordx4 s[36:39], s[4:5], 0x24
1790 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1791 ; GFX8-NEXT: s_mov_b64 s[0:1], s[40:41]
1792 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
1793 ; GFX8-NEXT: s_mov_b64 s[2:3], s[42:43]
1794 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
1795 ; GFX8-NEXT: s_mov_b32 s32, 0
1796 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1797 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
1798 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 7, v0
1799 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff8000, v0
1800 ; GFX8-NEXT: v_mov_b32_e32 v1, s37
1801 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s36, v2
1802 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1803 ; GFX8-NEXT: v_mov_b32_e32 v3, s39
1804 ; GFX8-NEXT: v_add_u32_e32 v12, vcc, s38, v2
1805 ; GFX8-NEXT: v_addc_u32_e32 v13, vcc, 0, v3, vcc
1806 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, 0x1000, v0
1807 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, 0, v1, vcc
1808 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x1800, v0
1809 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, 0, v1, vcc
1810 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x2000, v0
1811 ; GFX8-NEXT: v_addc_u32_e32 v7, vcc, 0, v1, vcc
1812 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x2800, v12
1813 ; GFX8-NEXT: flat_load_dwordx2 v[2:3], v[2:3]
1814 ; GFX8-NEXT: flat_load_dwordx2 v[4:5], v[4:5]
1815 ; GFX8-NEXT: flat_load_dwordx2 v[6:7], v[6:7]
1816 ; GFX8-NEXT: v_addc_u32_e32 v9, vcc, 0, v13, vcc
1817 ; GFX8-NEXT: v_add_u32_e32 v10, vcc, 0x3000, v12
1818 ; GFX8-NEXT: v_addc_u32_e32 v11, vcc, 0, v13, vcc
1819 ; GFX8-NEXT: flat_load_dwordx2 v[8:9], v[8:9]
1820 ; GFX8-NEXT: flat_load_dwordx2 v[10:11], v[10:11]
1821 ; GFX8-NEXT: v_add_u32_e32 v12, vcc, 0x3800, v12
1822 ; GFX8-NEXT: v_addc_u32_e32 v13, vcc, 0, v13, vcc
1823 ; GFX8-NEXT: flat_load_dwordx2 v[12:13], v[12:13]
1824 ; GFX8-NEXT: s_waitcnt vmcnt(4)
1825 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v4, v2
1826 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v5, v3, vcc
1827 ; GFX8-NEXT: s_waitcnt vmcnt(3)
1828 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v6, v2
1829 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v7, v3, vcc
1830 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1831 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, v10, v8
1832 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v11, v9, vcc
1833 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1834 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, v12, v4
1835 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v13, v5, vcc
1836 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v2, v4
1837 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v3, v5, vcc
1838 ; GFX8-NEXT: flat_store_dwordx2 v[0:1], v[2:3]
1839 ; GFX8-NEXT: s_endpgm
1841 ; GFX9-LABEL: DiffBase:
1842 ; GFX9: ; %bb.0: ; %entry
1843 ; GFX9-NEXT: s_mov_b32 s40, SCRATCH_RSRC_DWORD0
1844 ; GFX9-NEXT: s_mov_b32 s41, SCRATCH_RSRC_DWORD1
1845 ; GFX9-NEXT: s_mov_b32 s42, -1
1846 ; GFX9-NEXT: s_mov_b32 s43, 0xe00000
1847 ; GFX9-NEXT: s_add_u32 s40, s40, s11
1848 ; GFX9-NEXT: s_addc_u32 s41, s41, 0
1849 ; GFX9-NEXT: s_getpc_b64 s[0:1]
1850 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1851 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1852 ; GFX9-NEXT: s_load_dwordx4 s[36:39], s[4:5], 0x24
1853 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
1854 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1855 ; GFX9-NEXT: s_mov_b64 s[0:1], s[40:41]
1856 ; GFX9-NEXT: s_mov_b64 s[2:3], s[42:43]
1857 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
1858 ; GFX9-NEXT: s_mov_b32 s32, 0
1859 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
1860 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
1861 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 7, v0
1862 ; GFX9-NEXT: v_and_b32_e32 v16, 0xffff8000, v0
1863 ; GFX9-NEXT: v_mov_b32_e32 v0, s37
1864 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s36, v16
1865 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v0, vcc
1866 ; GFX9-NEXT: v_mov_b32_e32 v0, s39
1867 ; GFX9-NEXT: v_add_co_u32_e32 v10, vcc, s38, v16
1868 ; GFX9-NEXT: v_addc_co_u32_e32 v11, vcc, 0, v0, vcc
1869 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, 0x1000, v2
1870 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v3, vcc
1871 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, 0x2000, v2
1872 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v3, vcc
1873 ; GFX9-NEXT: global_load_dwordx2 v[4:5], v[0:1], off
1874 ; GFX9-NEXT: global_load_dwordx2 v[6:7], v[0:1], off offset:2048
1875 ; GFX9-NEXT: global_load_dwordx2 v[8:9], v[2:3], off
1876 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, 0x2000, v10
1877 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v11, vcc
1878 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, 0x3000, v10
1879 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v11, vcc
1880 ; GFX9-NEXT: global_load_dwordx2 v[10:11], v[0:1], off offset:2048
1881 ; GFX9-NEXT: global_load_dwordx2 v[12:13], v[2:3], off
1882 ; GFX9-NEXT: global_load_dwordx2 v[14:15], v[2:3], off offset:2048
1883 ; GFX9-NEXT: s_waitcnt vmcnt(4)
1884 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v6, v4
1885 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v7, v5, vcc
1886 ; GFX9-NEXT: s_waitcnt vmcnt(3)
1887 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v8, v0
1888 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v9, v1, vcc
1889 ; GFX9-NEXT: s_waitcnt vmcnt(1)
1890 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, v12, v10
1891 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, v13, v11, vcc
1892 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1893 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, v14, v2
1894 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, v15, v3, vcc
1895 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v0, v2
1896 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v1, v3, vcc
1897 ; GFX9-NEXT: global_store_dwordx2 v16, v[0:1], s[36:37]
1898 ; GFX9-NEXT: s_endpgm
1900 ; GFX10-LABEL: DiffBase:
1901 ; GFX10: ; %bb.0: ; %entry
1902 ; GFX10-NEXT: s_mov_b32 s40, SCRATCH_RSRC_DWORD0
1903 ; GFX10-NEXT: s_mov_b32 s41, SCRATCH_RSRC_DWORD1
1904 ; GFX10-NEXT: s_mov_b32 s42, -1
1905 ; GFX10-NEXT: s_mov_b32 s43, 0x31c16000
1906 ; GFX10-NEXT: s_add_u32 s40, s40, s11
1907 ; GFX10-NEXT: s_addc_u32 s41, s41, 0
1908 ; GFX10-NEXT: s_getpc_b64 s[0:1]
1909 ; GFX10-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1910 ; GFX10-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1911 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
1912 ; GFX10-NEXT: s_load_dwordx2 s[6:7], s[0:1], 0x0
1913 ; GFX10-NEXT: s_load_dwordx4 s[36:39], s[4:5], 0x24
1914 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
1915 ; GFX10-NEXT: s_mov_b64 s[0:1], s[40:41]
1916 ; GFX10-NEXT: s_mov_b64 s[2:3], s[42:43]
1917 ; GFX10-NEXT: s_mov_b32 s32, 0
1918 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1919 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[6:7]
1920 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 7, v0
1921 ; GFX10-NEXT: v_and_b32_e32 v16, 0xffff8000, v0
1922 ; GFX10-NEXT: v_add_co_u32 v8, s0, s36, v16
1923 ; GFX10-NEXT: v_add_co_ci_u32_e64 v9, s0, s37, 0, s0
1924 ; GFX10-NEXT: v_add_co_u32 v12, s0, s38, v16
1925 ; GFX10-NEXT: v_add_co_ci_u32_e64 v13, s0, s39, 0, s0
1926 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v8, 0x1800
1927 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v9, vcc_lo
1928 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v12, 0x3000
1929 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v13, vcc_lo
1930 ; GFX10-NEXT: s_clause 0x1
1931 ; GFX10-NEXT: global_load_dwordx2 v[4:5], v[0:1], off offset:-2048
1932 ; GFX10-NEXT: global_load_dwordx2 v[6:7], v[0:1], off
1933 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x2000, v8
1934 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v9, vcc_lo
1935 ; GFX10-NEXT: s_clause 0x1
1936 ; GFX10-NEXT: global_load_dwordx2 v[8:9], v[2:3], off offset:-2048
1937 ; GFX10-NEXT: global_load_dwordx2 v[10:11], v[2:3], off
1938 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, 0x3800, v12
1939 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v13, vcc_lo
1940 ; GFX10-NEXT: global_load_dwordx2 v[12:13], v[0:1], off
1941 ; GFX10-NEXT: global_load_dwordx2 v[14:15], v[2:3], off
1942 ; GFX10-NEXT: s_waitcnt vmcnt(4)
1943 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v6, v4
1944 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v7, v5, vcc_lo
1945 ; GFX10-NEXT: s_waitcnt vmcnt(2)
1946 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v10, v8
1947 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v11, v9, vcc_lo
1948 ; GFX10-NEXT: s_waitcnt vmcnt(1)
1949 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v12, v0
1950 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v13, v1, vcc_lo
1951 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1952 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v14, v2
1953 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v15, v3, vcc_lo
1954 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v0, v2
1955 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v1, v3, vcc_lo
1956 ; GFX10-NEXT: global_store_dwordx2 v16, v[0:1], s[36:37]
1957 ; GFX10-NEXT: s_endpgm
1959 ; GFX11-LABEL: DiffBase:
1960 ; GFX11: ; %bb.0: ; %entry
1961 ; GFX11-NEXT: s_getpc_b64 s[0:1]
1962 ; GFX11-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1963 ; GFX11-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1964 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
1965 ; GFX11-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
1966 ; GFX11-NEXT: s_load_b128 s[36:39], s[4:5], 0x24
1967 ; GFX11-NEXT: s_mov_b32 s32, 0
1968 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1969 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[0:1]
1970 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 7, v0
1971 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1972 ; GFX11-NEXT: v_and_b32_e32 v12, 0xffff8000, v0
1973 ; GFX11-NEXT: v_add_co_u32 v2, s0, s36, v12
1974 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_3)
1975 ; GFX11-NEXT: v_add_co_ci_u32_e64 v3, null, s37, 0, s0
1976 ; GFX11-NEXT: v_add_co_u32 v8, s0, s38, v12
1977 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0x1000, v2
1978 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_4)
1979 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v3, vcc_lo
1980 ; GFX11-NEXT: v_add_co_ci_u32_e64 v9, null, s39, 0, s0
1981 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v2, 0x2000
1982 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
1983 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0x2000, v8
1984 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v9, vcc_lo
1985 ; GFX11-NEXT: v_add_co_u32 v8, vcc_lo, 0x3000, v8
1986 ; GFX11-NEXT: global_load_b64 v[6:7], v[2:3], off offset:-4096
1987 ; GFX11-NEXT: v_add_co_ci_u32_e32 v9, vcc_lo, 0, v9, vcc_lo
1988 ; GFX11-NEXT: global_load_b64 v[0:1], v[0:1], off offset:2048
1989 ; GFX11-NEXT: s_clause 0x1
1990 ; GFX11-NEXT: global_load_b64 v[4:5], v[4:5], off offset:2048
1991 ; GFX11-NEXT: global_load_b64 v[10:11], v[8:9], off
1992 ; GFX11-NEXT: global_load_b64 v[2:3], v[2:3], off
1993 ; GFX11-NEXT: global_load_b64 v[8:9], v[8:9], off offset:2048
1994 ; GFX11-NEXT: s_waitcnt vmcnt(4)
1995 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v0, v6
1996 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v1, v7, vcc_lo
1997 ; GFX11-NEXT: s_waitcnt vmcnt(2)
1998 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, v10, v4
1999 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, v11, v5, vcc_lo
2000 ; GFX11-NEXT: s_waitcnt vmcnt(1)
2001 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v2, v0
2002 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v3, v1, vcc_lo
2003 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2004 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v8, v4
2005 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v9, v5, vcc_lo
2006 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2007 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v0, v2
2008 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v1, v3, vcc_lo
2009 ; GFX11-NEXT: global_store_b64 v12, v[0:1], s[36:37]
2010 ; GFX11-NEXT: s_endpgm
2011 ptr addrspace(1) %buffer2) {
2013 %call = tail call i64 @_Z13get_global_idj(i32 0)
2014 %conv = and i64 %call, 255
2015 %a0 = shl i64 %call, 7
2016 %idx.ext11 = and i64 %a0, 4294934528
2017 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer1, i64 %idx.ext11
2019 %add.ptr2 = getelementptr inbounds i8, ptr addrspace(1) %buffer2, i64 %idx.ext11
2021 %addr1 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 512
2022 %load1 = load i64, ptr addrspace(1) %addr1, align 8
2023 %add.ptr8.3 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 768
2024 %load2 = load i64, ptr addrspace(1) %add.ptr8.3, align 8
2025 %add1 = add i64 %load2, %load1
2026 %add.ptr8.4 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 1024
2027 %load3 = load i64, ptr addrspace(1) %add.ptr8.4, align 8
2028 %add2 = add i64 %load3, %add1
2030 %add.ptr8.5 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr2, i64 1280
2031 %load4 = load i64, ptr addrspace(1) %add.ptr8.5, align 8
2033 %add.ptr8.6 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr2, i64 1536
2034 %load5 = load i64, ptr addrspace(1) %add.ptr8.6, align 8
2035 %add3 = add i64 %load5, %load4
2037 %add.ptr8.7 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr2, i64 1792
2038 %load6 = load i64, ptr addrspace(1) %add.ptr8.7, align 8
2039 %add4 = add i64 %load6, %add3
2041 %add5 = add i64 %add2, %add4
2043 store i64 %add5, ptr addrspace(1) %add.ptr12, align 8
2047 define amdgpu_kernel void @ReverseOrder(ptr addrspace(1) %buffer) {
2048 ; GFX8-LABEL: ReverseOrder:
2049 ; GFX8: ; %bb.0: ; %entry
2050 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
2051 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
2052 ; GFX8-NEXT: s_mov_b32 s38, -1
2053 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
2054 ; GFX8-NEXT: s_add_u32 s36, s36, s11
2055 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
2056 ; GFX8-NEXT: s_getpc_b64 s[0:1]
2057 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
2058 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
2059 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
2060 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
2061 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
2062 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
2063 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
2064 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
2065 ; GFX8-NEXT: s_mov_b32 s32, 0
2066 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2067 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
2068 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2069 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff8000, v1
2070 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
2071 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, s34, v1
2072 ; GFX8-NEXT: v_mov_b32_e32 v3, 3
2073 ; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc
2074 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
2075 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v1, v0
2076 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v2, vcc
2077 ; GFX8-NEXT: s_movk_i32 s0, 0x3800
2078 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, s0, v3
2079 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v4, vcc
2080 ; GFX8-NEXT: s_movk_i32 s0, 0x3000
2081 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, s0, v3
2082 ; GFX8-NEXT: v_addc_u32_e32 v8, vcc, 0, v4, vcc
2083 ; GFX8-NEXT: s_movk_i32 s0, 0x2800
2084 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, s0, v3
2085 ; GFX8-NEXT: v_addc_u32_e32 v10, vcc, 0, v4, vcc
2086 ; GFX8-NEXT: flat_load_dwordx2 v[11:12], v[3:4]
2087 ; GFX8-NEXT: flat_load_dwordx2 v[5:6], v[5:6]
2088 ; GFX8-NEXT: flat_load_dwordx2 v[7:8], v[7:8]
2089 ; GFX8-NEXT: flat_load_dwordx2 v[9:10], v[9:10]
2090 ; GFX8-NEXT: s_movk_i32 s0, 0x2000
2091 ; GFX8-NEXT: v_add_u32_e32 v13, vcc, s0, v3
2092 ; GFX8-NEXT: v_addc_u32_e32 v14, vcc, 0, v4, vcc
2093 ; GFX8-NEXT: s_movk_i32 s0, 0x1800
2094 ; GFX8-NEXT: v_add_u32_e32 v15, vcc, s0, v3
2095 ; GFX8-NEXT: v_addc_u32_e32 v16, vcc, 0, v4, vcc
2096 ; GFX8-NEXT: flat_load_dwordx2 v[13:14], v[13:14]
2097 ; GFX8-NEXT: flat_load_dwordx2 v[15:16], v[15:16]
2098 ; GFX8-NEXT: s_movk_i32 s0, 0x1000
2099 ; GFX8-NEXT: v_add_u32_e32 v17, vcc, s0, v3
2100 ; GFX8-NEXT: v_addc_u32_e32 v18, vcc, 0, v4, vcc
2101 ; GFX8-NEXT: flat_load_dwordx2 v[17:18], v[17:18]
2102 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x800, v3
2103 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v4, vcc
2104 ; GFX8-NEXT: flat_load_dwordx2 v[3:4], v[3:4]
2105 ; GFX8-NEXT: s_waitcnt vmcnt(6)
2106 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v5, v11
2107 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v6, v12, vcc
2108 ; GFX8-NEXT: s_waitcnt vmcnt(5)
2109 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v7, v0
2110 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v8, v5, vcc
2111 ; GFX8-NEXT: s_waitcnt vmcnt(4)
2112 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v9, v0
2113 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v10, v5, vcc
2114 ; GFX8-NEXT: s_waitcnt vmcnt(3)
2115 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v13, v0
2116 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v14, v5, vcc
2117 ; GFX8-NEXT: s_waitcnt vmcnt(2)
2118 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v15, v0
2119 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v16, v5, vcc
2120 ; GFX8-NEXT: s_waitcnt vmcnt(1)
2121 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v17, v0
2122 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v18, v5, vcc
2123 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2124 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v3, v0
2125 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v4, v5, vcc
2126 ; GFX8-NEXT: flat_store_dwordx2 v[1:2], v[3:4]
2127 ; GFX8-NEXT: s_endpgm
2129 ; GFX9-LABEL: ReverseOrder:
2130 ; GFX9: ; %bb.0: ; %entry
2131 ; GFX9-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
2132 ; GFX9-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
2133 ; GFX9-NEXT: s_mov_b32 s38, -1
2134 ; GFX9-NEXT: s_mov_b32 s39, 0xe00000
2135 ; GFX9-NEXT: s_add_u32 s36, s36, s11
2136 ; GFX9-NEXT: s_addc_u32 s37, s37, 0
2137 ; GFX9-NEXT: s_getpc_b64 s[0:1]
2138 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
2139 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
2140 ; GFX9-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
2141 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
2142 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
2143 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37]
2144 ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39]
2145 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
2146 ; GFX9-NEXT: s_mov_b32 s32, 0
2147 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
2148 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
2149 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2150 ; GFX9-NEXT: v_and_b32_e32 v22, 0xffff8000, v1
2151 ; GFX9-NEXT: v_mov_b32_e32 v1, s35
2152 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s34, v22
2153 ; GFX9-NEXT: v_mov_b32_e32 v3, 3
2154 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
2155 ; GFX9-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
2156 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v2, v0
2157 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
2158 ; GFX9-NEXT: s_movk_i32 s0, 0x3000
2159 ; GFX9-NEXT: v_add_co_u32_e32 v4, vcc, s0, v0
2160 ; GFX9-NEXT: global_load_dwordx2 v[2:3], v[0:1], off
2161 ; GFX9-NEXT: v_addc_co_u32_e32 v5, vcc, 0, v1, vcc
2162 ; GFX9-NEXT: global_load_dwordx2 v[6:7], v[4:5], off offset:2048
2163 ; GFX9-NEXT: global_load_dwordx2 v[8:9], v[4:5], off
2164 ; GFX9-NEXT: s_movk_i32 s0, 0x2000
2165 ; GFX9-NEXT: v_add_co_u32_e32 v4, vcc, s0, v0
2166 ; GFX9-NEXT: v_addc_co_u32_e32 v5, vcc, 0, v1, vcc
2167 ; GFX9-NEXT: global_load_dwordx2 v[10:11], v[4:5], off offset:2048
2168 ; GFX9-NEXT: s_movk_i32 s0, 0x1000
2169 ; GFX9-NEXT: v_add_co_u32_e32 v12, vcc, s0, v0
2170 ; GFX9-NEXT: v_addc_co_u32_e32 v13, vcc, 0, v1, vcc
2171 ; GFX9-NEXT: global_load_dwordx2 v[14:15], v[12:13], off
2172 ; GFX9-NEXT: global_load_dwordx2 v[16:17], v[4:5], off
2173 ; GFX9-NEXT: global_load_dwordx2 v[18:19], v[12:13], off offset:2048
2174 ; GFX9-NEXT: global_load_dwordx2 v[20:21], v[0:1], off offset:2048
2175 ; GFX9-NEXT: s_waitcnt vmcnt(6)
2176 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v6, v2
2177 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v7, v3, vcc
2178 ; GFX9-NEXT: s_waitcnt vmcnt(5)
2179 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v8, v0
2180 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v9, v1, vcc
2181 ; GFX9-NEXT: s_waitcnt vmcnt(4)
2182 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v10, v0
2183 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v11, v1, vcc
2184 ; GFX9-NEXT: s_waitcnt vmcnt(2)
2185 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v16, v0
2186 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v17, v1, vcc
2187 ; GFX9-NEXT: s_waitcnt vmcnt(1)
2188 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v18, v0
2189 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v19, v1, vcc
2190 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v14, v0
2191 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v15, v1, vcc
2192 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2193 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v20, v0
2194 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v21, v1, vcc
2195 ; GFX9-NEXT: global_store_dwordx2 v22, v[0:1], s[34:35]
2196 ; GFX9-NEXT: s_endpgm
2198 ; GFX10-LABEL: ReverseOrder:
2199 ; GFX10: ; %bb.0: ; %entry
2200 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
2201 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
2202 ; GFX10-NEXT: s_mov_b32 s38, -1
2203 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
2204 ; GFX10-NEXT: s_add_u32 s36, s36, s11
2205 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
2206 ; GFX10-NEXT: s_getpc_b64 s[0:1]
2207 ; GFX10-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
2208 ; GFX10-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
2209 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
2210 ; GFX10-NEXT: s_load_dwordx2 s[6:7], s[0:1], 0x0
2211 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
2212 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
2213 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
2214 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
2215 ; GFX10-NEXT: s_mov_b32 s32, 0
2216 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
2217 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[6:7]
2218 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2219 ; GFX10-NEXT: v_mov_b32_e32 v2, 3
2220 ; GFX10-NEXT: v_and_b32_e32 v20, 0xffff8000, v1
2221 ; GFX10-NEXT: v_lshlrev_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
2222 ; GFX10-NEXT: v_add_co_u32 v1, s0, s34, v20
2223 ; GFX10-NEXT: v_add_co_ci_u32_e64 v2, s0, s35, 0, s0
2224 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
2225 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
2226 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, 0x3800, v0
2227 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
2228 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0x3000, v0
2229 ; GFX10-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
2230 ; GFX10-NEXT: s_clause 0x1
2231 ; GFX10-NEXT: global_load_dwordx2 v[6:7], v[0:1], off
2232 ; GFX10-NEXT: global_load_dwordx2 v[8:9], v[2:3], off
2233 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, 0x2800, v0
2234 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
2235 ; GFX10-NEXT: v_add_co_u32 v10, vcc_lo, 0x2000, v0
2236 ; GFX10-NEXT: v_add_co_ci_u32_e32 v11, vcc_lo, 0, v1, vcc_lo
2237 ; GFX10-NEXT: v_add_co_u32 v12, vcc_lo, 0x1800, v0
2238 ; GFX10-NEXT: s_clause 0x1
2239 ; GFX10-NEXT: global_load_dwordx2 v[4:5], v[4:5], off
2240 ; GFX10-NEXT: global_load_dwordx2 v[10:11], v[10:11], off
2241 ; GFX10-NEXT: v_add_co_ci_u32_e32 v13, vcc_lo, 0, v1, vcc_lo
2242 ; GFX10-NEXT: v_add_co_u32 v14, vcc_lo, 0x1000, v0
2243 ; GFX10-NEXT: v_add_co_ci_u32_e32 v15, vcc_lo, 0, v1, vcc_lo
2244 ; GFX10-NEXT: s_clause 0x1
2245 ; GFX10-NEXT: global_load_dwordx2 v[12:13], v[12:13], off
2246 ; GFX10-NEXT: global_load_dwordx2 v[2:3], v[2:3], off
2247 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x800, v0
2248 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
2249 ; GFX10-NEXT: s_clause 0x1
2250 ; GFX10-NEXT: global_load_dwordx2 v[16:17], v[14:15], off
2251 ; GFX10-NEXT: global_load_dwordx2 v[18:19], v[0:1], off
2252 ; GFX10-NEXT: s_waitcnt vmcnt(6)
2253 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v8, v6
2254 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v9, v7, vcc_lo
2255 ; GFX10-NEXT: s_waitcnt vmcnt(5)
2256 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v4, v0
2257 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v5, v1, vcc_lo
2258 ; GFX10-NEXT: s_waitcnt vmcnt(2)
2259 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v2, v0
2260 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v3, v1, vcc_lo
2261 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v10, v0
2262 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v11, v1, vcc_lo
2263 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v12, v0
2264 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v13, v1, vcc_lo
2265 ; GFX10-NEXT: s_waitcnt vmcnt(1)
2266 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v16, v0
2267 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v17, v1, vcc_lo
2268 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2269 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v18, v0
2270 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v19, v1, vcc_lo
2271 ; GFX10-NEXT: global_store_dwordx2 v20, v[0:1], s[34:35]
2272 ; GFX10-NEXT: s_endpgm
2274 ; GFX11-LABEL: ReverseOrder:
2275 ; GFX11: ; %bb.0: ; %entry
2276 ; GFX11-NEXT: s_getpc_b64 s[0:1]
2277 ; GFX11-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
2278 ; GFX11-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
2279 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
2280 ; GFX11-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
2281 ; GFX11-NEXT: s_load_b64 s[34:35], s[4:5], 0x24
2282 ; GFX11-NEXT: s_mov_b32 s32, 0
2283 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2284 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[0:1]
2285 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2286 ; GFX11-NEXT: v_and_b32_e32 v0, 0xff, v0
2287 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2288 ; GFX11-NEXT: v_and_b32_e32 v16, 0xffff8000, v1
2289 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 3, v0
2290 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
2291 ; GFX11-NEXT: v_add_co_u32 v1, s0, s34, v16
2292 ; GFX11-NEXT: v_add_co_ci_u32_e64 v2, null, s35, 0, s0
2293 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2294 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
2295 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
2296 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2297 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, 0x3000, v0
2298 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
2299 ; GFX11-NEXT: v_add_co_u32 v8, vcc_lo, 0x2000, v0
2300 ; GFX11-NEXT: s_clause 0x2
2301 ; GFX11-NEXT: global_load_b64 v[4:5], v[0:1], off
2302 ; GFX11-NEXT: global_load_b64 v[6:7], v[2:3], off offset:2048
2303 ; GFX11-NEXT: global_load_b64 v[2:3], v[2:3], off
2304 ; GFX11-NEXT: v_add_co_ci_u32_e32 v9, vcc_lo, 0, v1, vcc_lo
2305 ; GFX11-NEXT: v_add_co_u32 v10, vcc_lo, 0x1000, v0
2306 ; GFX11-NEXT: v_add_co_ci_u32_e32 v11, vcc_lo, 0, v1, vcc_lo
2307 ; GFX11-NEXT: s_clause 0x4
2308 ; GFX11-NEXT: global_load_b64 v[12:13], v[8:9], off offset:2048
2309 ; GFX11-NEXT: global_load_b64 v[14:15], v[10:11], off
2310 ; GFX11-NEXT: global_load_b64 v[8:9], v[8:9], off
2311 ; GFX11-NEXT: global_load_b64 v[10:11], v[10:11], off offset:2048
2312 ; GFX11-NEXT: global_load_b64 v[0:1], v[0:1], off offset:2048
2313 ; GFX11-NEXT: s_waitcnt vmcnt(6)
2314 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, v6, v4
2315 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, v7, v5, vcc_lo
2316 ; GFX11-NEXT: s_waitcnt vmcnt(5)
2317 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2318 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v2, v4
2319 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v3, v5, vcc_lo
2320 ; GFX11-NEXT: s_waitcnt vmcnt(4)
2321 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2322 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v12, v2
2323 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v13, v3, vcc_lo
2324 ; GFX11-NEXT: s_waitcnt vmcnt(2)
2325 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2326 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v8, v2
2327 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v9, v3, vcc_lo
2328 ; GFX11-NEXT: s_waitcnt vmcnt(1)
2329 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2330 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v10, v2
2331 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v11, v3, vcc_lo
2332 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2333 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v14, v2
2334 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v15, v3, vcc_lo
2335 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2336 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2337 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v0, v2
2338 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v1, v3, vcc_lo
2339 ; GFX11-NEXT: global_store_b64 v16, v[0:1], s[34:35]
2340 ; GFX11-NEXT: s_endpgm
2342 %call = tail call i64 @_Z13get_global_idj(i32 0)
2343 %conv = and i64 %call, 255
2344 %a0 = shl i64 %call, 7
2345 %idx.ext11 = and i64 %a0, 4294934528
2346 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
2348 %addr1 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 %conv
2349 %load1 = load i64, ptr addrspace(1) %addr1, align 8
2351 %add.ptr8.7 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1792
2352 %load8 = load i64, ptr addrspace(1) %add.ptr8.7, align 8
2353 %add7 = add i64 %load8, %load1
2355 %add.ptr8.6 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1536
2356 %load7 = load i64, ptr addrspace(1) %add.ptr8.6, align 8
2357 %add6 = add i64 %load7, %add7
2359 %add.ptr8.5 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1280
2360 %load6 = load i64, ptr addrspace(1) %add.ptr8.5, align 8
2361 %add5 = add i64 %load6, %add6
2363 %add.ptr8.4 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1024
2364 %load5 = load i64, ptr addrspace(1) %add.ptr8.4, align 8
2365 %add4 = add i64 %load5, %add5
2367 %add.ptr8.3 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 768
2368 %load4 = load i64, ptr addrspace(1) %add.ptr8.3, align 8
2369 %add3 = add i64 %load4, %add4
2371 %add.ptr8.2 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 512
2372 %load3 = load i64, ptr addrspace(1) %add.ptr8.2, align 8
2373 %add2 = add i64 %load3, %add3
2375 %addr2 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 256
2376 %load2 = load i64, ptr addrspace(1) %addr2, align 8
2377 %add1 = add i64 %load2, %add2
2379 store i64 %add1, ptr addrspace(1) %add.ptr12, align 8
2383 define hidden amdgpu_kernel void @negativeoffset(ptr addrspace(1) nocapture %buffer) {
2384 ; GFX8-LABEL: negativeoffset:
2385 ; GFX8: ; %bb.0: ; %entry
2386 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
2387 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
2388 ; GFX8-NEXT: s_mov_b32 s38, -1
2389 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
2390 ; GFX8-NEXT: s_add_u32 s36, s36, s11
2391 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
2392 ; GFX8-NEXT: s_getpc_b64 s[0:1]
2393 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
2394 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
2395 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
2396 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
2397 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
2398 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
2399 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
2400 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
2401 ; GFX8-NEXT: s_mov_b32 s32, 0
2402 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2403 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
2404 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2405 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff8000, v1
2406 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
2407 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, s34, v1
2408 ; GFX8-NEXT: v_mov_b32_e32 v3, 3
2409 ; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc
2410 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
2411 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v1, v0
2412 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v2, vcc
2413 ; GFX8-NEXT: s_movk_i32 s0, 0x800
2414 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, s0, v0
2415 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, -1, v6, vcc
2416 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, 0, v0
2417 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, -1, v6, vcc
2418 ; GFX8-NEXT: flat_load_dwordx2 v[3:4], v[3:4]
2419 ; GFX8-NEXT: flat_load_dwordx2 v[5:6], v[5:6]
2420 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2421 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v5, v3
2422 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v6, v4, vcc
2423 ; GFX8-NEXT: flat_store_dwordx2 v[1:2], v[3:4]
2424 ; GFX8-NEXT: s_endpgm
2426 ; GFX9-LABEL: negativeoffset:
2427 ; GFX9: ; %bb.0: ; %entry
2428 ; GFX9-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
2429 ; GFX9-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
2430 ; GFX9-NEXT: s_mov_b32 s38, -1
2431 ; GFX9-NEXT: s_mov_b32 s39, 0xe00000
2432 ; GFX9-NEXT: s_add_u32 s36, s36, s11
2433 ; GFX9-NEXT: s_addc_u32 s37, s37, 0
2434 ; GFX9-NEXT: s_getpc_b64 s[0:1]
2435 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
2436 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
2437 ; GFX9-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
2438 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
2439 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
2440 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37]
2441 ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39]
2442 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
2443 ; GFX9-NEXT: s_mov_b32 s32, 0
2444 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
2445 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
2446 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2447 ; GFX9-NEXT: v_and_b32_e32 v8, 0xffff8000, v1
2448 ; GFX9-NEXT: v_mov_b32_e32 v1, s35
2449 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s34, v8
2450 ; GFX9-NEXT: v_mov_b32_e32 v3, 3
2451 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
2452 ; GFX9-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
2453 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, v2, v0
2454 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v1, vcc
2455 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, 0x1000, v2
2456 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v3, vcc
2457 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, 0, v2
2458 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, -1, v3, vcc
2459 ; GFX9-NEXT: global_load_dwordx2 v[4:5], v[0:1], off offset:-2048
2460 ; GFX9-NEXT: global_load_dwordx2 v[6:7], v[2:3], off
2461 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2462 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v6, v4
2463 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v7, v5, vcc
2464 ; GFX9-NEXT: global_store_dwordx2 v8, v[0:1], s[34:35]
2465 ; GFX9-NEXT: s_endpgm
2467 ; GFX10-LABEL: negativeoffset:
2468 ; GFX10: ; %bb.0: ; %entry
2469 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
2470 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
2471 ; GFX10-NEXT: s_mov_b32 s38, -1
2472 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
2473 ; GFX10-NEXT: s_add_u32 s36, s36, s11
2474 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
2475 ; GFX10-NEXT: s_getpc_b64 s[0:1]
2476 ; GFX10-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
2477 ; GFX10-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
2478 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
2479 ; GFX10-NEXT: s_load_dwordx2 s[6:7], s[0:1], 0x0
2480 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[4:5], 0x24
2481 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
2482 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
2483 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
2484 ; GFX10-NEXT: s_mov_b32 s32, 0
2485 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
2486 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[6:7]
2487 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2488 ; GFX10-NEXT: v_mov_b32_e32 v2, 3
2489 ; GFX10-NEXT: v_and_b32_e32 v8, 0xffff8000, v1
2490 ; GFX10-NEXT: v_lshlrev_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
2491 ; GFX10-NEXT: v_add_co_u32 v1, s0, s34, v8
2492 ; GFX10-NEXT: v_add_co_ci_u32_e64 v2, s0, s35, 0, s0
2493 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, v1, v0
2494 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v2, vcc_lo
2495 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x800, v3
2496 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v4, vcc_lo
2497 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, 0, v3
2498 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, -1, v4, vcc_lo
2499 ; GFX10-NEXT: s_clause 0x1
2500 ; GFX10-NEXT: global_load_dwordx2 v[4:5], v[0:1], off
2501 ; GFX10-NEXT: global_load_dwordx2 v[6:7], v[2:3], off
2502 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2503 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v6, v4
2504 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v7, v5, vcc_lo
2505 ; GFX10-NEXT: global_store_dwordx2 v8, v[0:1], s[34:35]
2506 ; GFX10-NEXT: s_endpgm
2508 ; GFX11-LABEL: negativeoffset:
2509 ; GFX11: ; %bb.0: ; %entry
2510 ; GFX11-NEXT: s_getpc_b64 s[0:1]
2511 ; GFX11-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
2512 ; GFX11-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
2513 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
2514 ; GFX11-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
2515 ; GFX11-NEXT: s_load_b64 s[34:35], s[4:5], 0x24
2516 ; GFX11-NEXT: s_mov_b32 s32, 0
2517 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2518 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[0:1]
2519 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2520 ; GFX11-NEXT: v_and_b32_e32 v0, 0xff, v0
2521 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2522 ; GFX11-NEXT: v_and_b32_e32 v4, 0xffff8000, v1
2523 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 3, v0
2524 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
2525 ; GFX11-NEXT: v_add_co_u32 v1, s0, s34, v4
2526 ; GFX11-NEXT: v_add_co_ci_u32_e64 v2, null, s35, 0, s0
2527 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2528 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, v1, v0
2529 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v2, vcc_lo
2530 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2531 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0x1000, v3
2532 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v5, vcc_lo
2533 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, 0, v3
2534 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, -1, v5, vcc_lo
2535 ; GFX11-NEXT: s_clause 0x1
2536 ; GFX11-NEXT: global_load_b64 v[0:1], v[0:1], off offset:-2048
2537 ; GFX11-NEXT: global_load_b64 v[2:3], v[2:3], off
2538 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2539 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v2, v0
2540 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v3, v1, vcc_lo
2541 ; GFX11-NEXT: global_store_b64 v4, v[0:1], s[34:35]
2542 ; GFX11-NEXT: s_endpgm
2544 %call = tail call i64 @_Z13get_global_idj(i32 0) #2
2545 %conv = and i64 %call, 255
2546 %0 = shl i64 %call, 7
2547 %idx.ext11 = and i64 %0, 4294934528
2548 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
2550 %buffer_wave = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 %conv
2552 %addr1 = getelementptr inbounds i64, ptr addrspace(1) %buffer_wave, i64 -536870656
2553 %load1 = load i64, ptr addrspace(1) %addr1, align 8
2555 %addr2 = getelementptr inbounds i64, ptr addrspace(1) %buffer_wave, i64 -536870912
2556 %load2 = load i64, ptr addrspace(1) %addr2, align 8
2559 %add = add i64 %load2, %load1
2561 store i64 %add, ptr addrspace(1) %add.ptr12, align 8
2565 define amdgpu_kernel void @negativeoffsetnullptr(ptr %buffer) {
2566 ; GFX8-LABEL: negativeoffsetnullptr:
2567 ; GFX8: ; %bb.0: ; %entry
2568 ; GFX8-NEXT: s_load_dword s1, s[4:5], 0xec
2569 ; GFX8-NEXT: s_add_u32 s0, 0, -1
2570 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2571 ; GFX8-NEXT: s_addc_u32 s1, s1, -1
2572 ; GFX8-NEXT: v_mov_b32_e32 v0, s0
2573 ; GFX8-NEXT: v_mov_b32_e32 v1, s1
2574 ; GFX8-NEXT: flat_load_ubyte v0, v[0:1]
2575 ; GFX8-NEXT: s_mov_b64 s[0:1], 0
2576 ; GFX8-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2577 ; GFX8-NEXT: v_cmp_eq_u16_e32 vcc, 0, v0
2578 ; GFX8-NEXT: .LBB8_1: ; %branch
2579 ; GFX8-NEXT: ; =>This Inner Loop Header: Depth=1
2580 ; GFX8-NEXT: s_and_b64 s[2:3], exec, vcc
2581 ; GFX8-NEXT: s_or_b64 s[0:1], s[2:3], s[0:1]
2582 ; GFX8-NEXT: s_andn2_b64 exec, exec, s[0:1]
2583 ; GFX8-NEXT: s_cbranch_execnz .LBB8_1
2584 ; GFX8-NEXT: ; %bb.2: ; %end
2585 ; GFX8-NEXT: s_endpgm
2587 ; GFX9-LABEL: negativeoffsetnullptr:
2588 ; GFX9: ; %bb.0: ; %entry
2589 ; GFX9-NEXT: s_mov_b64 s[0:1], src_private_base
2590 ; GFX9-NEXT: v_mov_b32_e32 v1, s1
2591 ; GFX9-NEXT: v_add_co_u32_e64 v0, vcc, -1, 0
2592 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v1, vcc
2593 ; GFX9-NEXT: flat_load_ubyte v0, v[0:1]
2594 ; GFX9-NEXT: s_mov_b64 s[0:1], 0
2595 ; GFX9-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2596 ; GFX9-NEXT: v_cmp_eq_u16_e32 vcc, 0, v0
2597 ; GFX9-NEXT: .LBB8_1: ; %branch
2598 ; GFX9-NEXT: ; =>This Inner Loop Header: Depth=1
2599 ; GFX9-NEXT: s_and_b64 s[2:3], exec, vcc
2600 ; GFX9-NEXT: s_or_b64 s[0:1], s[2:3], s[0:1]
2601 ; GFX9-NEXT: s_andn2_b64 exec, exec, s[0:1]
2602 ; GFX9-NEXT: s_cbranch_execnz .LBB8_1
2603 ; GFX9-NEXT: ; %bb.2: ; %end
2604 ; GFX9-NEXT: s_endpgm
2606 ; GFX10-LABEL: negativeoffsetnullptr:
2607 ; GFX10: ; %bb.0: ; %entry
2608 ; GFX10-NEXT: s_mov_b64 s[0:1], src_private_base
2609 ; GFX10-NEXT: s_add_u32 s0, 0, -1
2610 ; GFX10-NEXT: s_addc_u32 s1, s1, -1
2611 ; GFX10-NEXT: v_mov_b32_e32 v0, s0
2612 ; GFX10-NEXT: v_mov_b32_e32 v1, s1
2613 ; GFX10-NEXT: s_mov_b32 s0, 0
2614 ; GFX10-NEXT: flat_load_ubyte v0, v[0:1]
2615 ; GFX10-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2616 ; GFX10-NEXT: v_cmp_eq_u16_e32 vcc_lo, 0, v0
2617 ; GFX10-NEXT: .LBB8_1: ; %branch
2618 ; GFX10-NEXT: ; =>This Inner Loop Header: Depth=1
2619 ; GFX10-NEXT: s_and_b32 s1, exec_lo, vcc_lo
2620 ; GFX10-NEXT: s_or_b32 s0, s1, s0
2621 ; GFX10-NEXT: s_andn2_b32 exec_lo, exec_lo, s0
2622 ; GFX10-NEXT: s_cbranch_execnz .LBB8_1
2623 ; GFX10-NEXT: ; %bb.2: ; %end
2624 ; GFX10-NEXT: s_endpgm
2626 ; GFX11-LABEL: negativeoffsetnullptr:
2627 ; GFX11: ; %bb.0: ; %entry
2628 ; GFX11-NEXT: s_mov_b64 s[0:1], src_private_base
2629 ; GFX11-NEXT: v_add_co_u32 v0, s0, -1, 0
2630 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
2631 ; GFX11-NEXT: v_add_co_ci_u32_e64 v1, null, -1, s1, s0
2632 ; GFX11-NEXT: s_mov_b32 s0, 0
2633 ; GFX11-NEXT: flat_load_u8 v0, v[0:1]
2634 ; GFX11-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
2635 ; GFX11-NEXT: v_cmp_eq_u16_e32 vcc_lo, 0, v0
2636 ; GFX11-NEXT: .LBB8_1: ; %branch
2637 ; GFX11-NEXT: ; =>This Inner Loop Header: Depth=1
2638 ; GFX11-NEXT: s_and_b32 s1, exec_lo, vcc_lo
2639 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(NEXT) | instid1(SALU_CYCLE_1)
2640 ; GFX11-NEXT: s_or_b32 s0, s1, s0
2641 ; GFX11-NEXT: s_and_not1_b32 exec_lo, exec_lo, s0
2642 ; GFX11-NEXT: s_cbranch_execnz .LBB8_1
2643 ; GFX11-NEXT: ; %bb.2: ; %end
2644 ; GFX11-NEXT: s_endpgm
2646 %null = select i1 false, ptr %buffer, ptr addrspacecast (ptr addrspace(5) null to ptr)
2647 %gep = getelementptr i8, ptr %null, i64 -1
2648 %ld = load i8, ptr %gep
2649 %cmp = icmp eq i8 %ld, 0
2653 br i1 %cmp, label %end, label %branch
2660 attributes #0 = { nounwind "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "target-cpu"="fiji" "uniform-work-group-size"="false" }