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, s3
18 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
19 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
20 ; GFX8-NEXT: s_getpc_b64 s[0:1]
21 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
22 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
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, s3
99 ; GFX9-NEXT: s_addc_u32 s37, s37, 0
100 ; GFX9-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
101 ; GFX9-NEXT: s_getpc_b64 s[0:1]
102 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
103 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
104 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
105 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37]
106 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
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, s3
169 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
170 ; GFX10-NEXT: s_getpc_b64 s[2:3]
171 ; GFX10-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
172 ; GFX10-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
173 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
174 ; GFX10-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
175 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[0:1], 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[4:5]
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[2:3]
237 ; GFX11-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
238 ; GFX11-NEXT: s_addc_u32 s3, s3, _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[2:3], s[2:3], 0x0
241 ; GFX11-NEXT: s_load_b64 s[34:35], s[0:1], 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[2:3]
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_nop 0
304 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
305 ; GFX11-NEXT: s_endpgm
307 %call = tail call i64 @_Z13get_global_idj(i32 0)
308 %conv = and i64 %call, 255
309 %a0 = shl i64 %call, 7
310 %idx.ext11 = and i64 %a0, 4294934528
311 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
313 %addr1 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 %conv
314 %load1 = load i64, ptr addrspace(1) %addr1, align 8
315 %addr2 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 256
316 %load2 = load i64, ptr addrspace(1) %addr2, align 8
317 %add.1 = add i64 %load2, %load1
319 %add.ptr8.2 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 512
320 %load3 = load i64, ptr addrspace(1) %add.ptr8.2, align 8
321 %add.2 = add i64 %load3, %add.1
322 %add.ptr8.3 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 768
323 %load4 = load i64, ptr addrspace(1) %add.ptr8.3, align 8
324 %add.3 = add i64 %load4, %add.2
326 %add.ptr8.4 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1024
327 %load5 = load i64, ptr addrspace(1) %add.ptr8.4, align 8
328 %add.4 = add i64 %load5, %add.3
329 %add.ptr8.5 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1280
330 %load6 = load i64, ptr addrspace(1) %add.ptr8.5, align 8
331 %add.5 = add i64 %load6, %add.4
333 %add.ptr8.6 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1536
334 %load7 = load i64, ptr addrspace(1) %add.ptr8.6, align 8
335 %add.6 = add i64 %load7, %add.5
336 %add.ptr8.7 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1792
337 %load8 = load i64, ptr addrspace(1) %add.ptr8.7, align 8
338 %add.7 = add i64 %load8, %add.6
340 store i64 %add.7, ptr addrspace(1) %add.ptr12, align 8
344 define hidden amdgpu_kernel void @clmem_read(ptr addrspace(1) %buffer) {
345 ; GFX8-LABEL: clmem_read:
346 ; GFX8: ; %bb.0: ; %entry
347 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
348 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
349 ; GFX8-NEXT: s_mov_b32 s38, -1
350 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
351 ; GFX8-NEXT: s_add_u32 s36, s36, s3
352 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
353 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
354 ; GFX8-NEXT: s_getpc_b64 s[0:1]
355 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
356 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
357 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
358 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
359 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
360 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
361 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
362 ; GFX8-NEXT: s_mov_b32 s32, 0
363 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
364 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
365 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 17, v0
366 ; GFX8-NEXT: v_mov_b32_e32 v2, 3
367 ; GFX8-NEXT: v_and_b32_e32 v1, 0xfe000000, v1
368 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
369 ; GFX8-NEXT: v_or_b32_e32 v0, v1, v0
370 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
371 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s34, v0
372 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, 0, v2, vcc
373 ; GFX8-NEXT: s_movk_i32 s0, 0x5000
374 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, s0, v0
375 ; GFX8-NEXT: v_mov_b32_e32 v4, 0
376 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, 0, v3, vcc
377 ; GFX8-NEXT: v_mov_b32_e32 v5, 0
378 ; GFX8-NEXT: s_movk_i32 s0, 0x7f
379 ; GFX8-NEXT: .LBB1_1: ; %for.cond.preheader
380 ; GFX8-NEXT: ; =>This Loop Header: Depth=1
381 ; GFX8-NEXT: ; Child Loop BB1_2 Depth 2
382 ; GFX8-NEXT: v_mov_b32_e32 v7, v3
383 ; GFX8-NEXT: v_mov_b32_e32 v6, v2
384 ; GFX8-NEXT: s_mov_b32 s1, 0
385 ; GFX8-NEXT: .LBB1_2: ; %for.body
386 ; GFX8-NEXT: ; Parent Loop BB1_1 Depth=1
387 ; GFX8-NEXT: ; => This Inner Loop Header: Depth=2
388 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0xffffb000, v6
389 ; GFX8-NEXT: v_addc_u32_e32 v9, vcc, -1, v7, vcc
390 ; GFX8-NEXT: v_add_u32_e32 v10, vcc, 0xffffb800, v6
391 ; GFX8-NEXT: v_addc_u32_e32 v11, vcc, -1, v7, vcc
392 ; GFX8-NEXT: v_add_u32_e32 v12, vcc, 0xffffc000, v6
393 ; GFX8-NEXT: flat_load_dwordx2 v[8:9], v[8:9]
394 ; GFX8-NEXT: flat_load_dwordx2 v[10:11], v[10:11]
395 ; GFX8-NEXT: v_addc_u32_e32 v13, vcc, -1, v7, vcc
396 ; GFX8-NEXT: v_add_u32_e32 v14, vcc, 0xffffc800, v6
397 ; GFX8-NEXT: v_addc_u32_e32 v15, vcc, -1, v7, vcc
398 ; GFX8-NEXT: v_add_u32_e32 v16, vcc, 0xffffd000, v6
399 ; GFX8-NEXT: flat_load_dwordx2 v[12:13], v[12:13]
400 ; GFX8-NEXT: flat_load_dwordx2 v[14:15], v[14:15]
401 ; GFX8-NEXT: v_addc_u32_e32 v17, vcc, -1, v7, vcc
402 ; GFX8-NEXT: v_add_u32_e32 v18, vcc, 0xffffd800, v6
403 ; GFX8-NEXT: v_addc_u32_e32 v19, vcc, -1, v7, vcc
404 ; GFX8-NEXT: flat_load_dwordx2 v[16:17], v[16:17]
405 ; GFX8-NEXT: flat_load_dwordx2 v[18:19], v[18:19]
406 ; GFX8-NEXT: v_add_u32_e32 v20, vcc, 0xffffe000, v6
407 ; GFX8-NEXT: v_addc_u32_e32 v21, vcc, -1, v7, vcc
408 ; GFX8-NEXT: v_add_u32_e32 v22, vcc, 0xffffe800, v6
409 ; GFX8-NEXT: flat_load_dwordx2 v[20:21], v[20:21]
410 ; GFX8-NEXT: v_addc_u32_e32 v23, vcc, -1, v7, vcc
411 ; GFX8-NEXT: flat_load_dwordx2 v[22:23], v[22:23]
412 ; GFX8-NEXT: v_add_u32_e32 v24, vcc, 0xfffff000, v6
413 ; GFX8-NEXT: v_addc_u32_e32 v25, vcc, -1, v7, vcc
414 ; GFX8-NEXT: flat_load_dwordx2 v[24:25], v[24:25]
415 ; GFX8-NEXT: v_add_u32_e32 v26, vcc, 0xfffff800, v6
416 ; GFX8-NEXT: v_addc_u32_e32 v27, vcc, -1, v7, vcc
417 ; GFX8-NEXT: flat_load_dwordx2 v[26:27], v[26:27]
418 ; GFX8-NEXT: flat_load_dwordx2 v[28:29], v[6:7]
419 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x10000, v6
420 ; GFX8-NEXT: v_addc_u32_e32 v7, vcc, 0, v7, vcc
421 ; GFX8-NEXT: s_addk_i32 s1, 0x2000
422 ; GFX8-NEXT: s_cmp_gt_u32 s1, 0x3fffff
423 ; GFX8-NEXT: s_waitcnt vmcnt(10)
424 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v8, v4
425 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v9, v5, vcc
426 ; GFX8-NEXT: s_waitcnt vmcnt(9)
427 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v10, v0
428 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v11, v4, vcc
429 ; GFX8-NEXT: s_waitcnt vmcnt(8)
430 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v12, v0
431 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v13, v4, vcc
432 ; GFX8-NEXT: s_waitcnt vmcnt(7)
433 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v14, v0
434 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v15, v4, vcc
435 ; GFX8-NEXT: s_waitcnt vmcnt(6)
436 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v16, v0
437 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v17, v4, vcc
438 ; GFX8-NEXT: s_waitcnt vmcnt(5)
439 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v18, v0
440 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v19, v4, vcc
441 ; GFX8-NEXT: s_waitcnt vmcnt(4)
442 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v20, v0
443 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v21, v4, vcc
444 ; GFX8-NEXT: s_waitcnt vmcnt(3)
445 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v22, v0
446 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v23, v4, vcc
447 ; GFX8-NEXT: s_waitcnt vmcnt(2)
448 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v24, v0
449 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v25, v4, vcc
450 ; GFX8-NEXT: s_waitcnt vmcnt(1)
451 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v26, v0
452 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v27, v4, vcc
453 ; GFX8-NEXT: s_waitcnt vmcnt(0)
454 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, v28, v0
455 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v29, v5, vcc
456 ; GFX8-NEXT: s_cbranch_scc0 .LBB1_2
457 ; GFX8-NEXT: ; %bb.3: ; %while.cond.loopexit
458 ; GFX8-NEXT: ; in Loop: Header=BB1_1 Depth=1
459 ; GFX8-NEXT: s_add_i32 s1, s0, -1
460 ; GFX8-NEXT: s_cmp_eq_u32 s0, 0
461 ; GFX8-NEXT: s_cbranch_scc1 .LBB1_5
462 ; GFX8-NEXT: ; %bb.4: ; in Loop: Header=BB1_1 Depth=1
463 ; GFX8-NEXT: s_mov_b32 s0, s1
464 ; GFX8-NEXT: s_branch .LBB1_1
465 ; GFX8-NEXT: .LBB1_5: ; %while.end
466 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
467 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s34, v1
468 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v2, vcc
469 ; GFX8-NEXT: flat_store_dwordx2 v[0:1], v[4:5]
470 ; GFX8-NEXT: s_endpgm
472 ; GFX900-LABEL: clmem_read:
473 ; GFX900: ; %bb.0: ; %entry
474 ; GFX900-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
475 ; GFX900-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
476 ; GFX900-NEXT: s_mov_b32 s38, -1
477 ; GFX900-NEXT: s_mov_b32 s39, 0xe00000
478 ; GFX900-NEXT: s_add_u32 s36, s36, s3
479 ; GFX900-NEXT: s_addc_u32 s37, s37, 0
480 ; GFX900-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
481 ; GFX900-NEXT: s_getpc_b64 s[0:1]
482 ; GFX900-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
483 ; GFX900-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
484 ; GFX900-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
485 ; GFX900-NEXT: s_mov_b64 s[0:1], s[36:37]
486 ; GFX900-NEXT: v_mov_b32_e32 v31, v0
487 ; GFX900-NEXT: s_mov_b64 s[2:3], s[38:39]
488 ; GFX900-NEXT: v_mov_b32_e32 v0, 0
489 ; GFX900-NEXT: s_mov_b32 s32, 0
490 ; GFX900-NEXT: s_waitcnt lgkmcnt(0)
491 ; GFX900-NEXT: s_swappc_b64 s[30:31], s[4:5]
492 ; GFX900-NEXT: v_and_b32_e32 v1, 0xff, v0
493 ; GFX900-NEXT: v_lshlrev_b32_e32 v0, 17, v0
494 ; GFX900-NEXT: v_and_b32_e32 v0, 0xfe000000, v0
495 ; GFX900-NEXT: v_lshl_or_b32 v1, v1, 3, v0
496 ; GFX900-NEXT: v_mov_b32_e32 v2, s35
497 ; GFX900-NEXT: v_add_co_u32_e32 v1, vcc, s34, v1
498 ; GFX900-NEXT: v_addc_co_u32_e32 v2, vcc, 0, v2, vcc
499 ; GFX900-NEXT: v_add_co_u32_e32 v1, vcc, 0x5000, v1
500 ; GFX900-NEXT: v_mov_b32_e32 v3, 0
501 ; GFX900-NEXT: v_addc_co_u32_e32 v2, vcc, 0, v2, vcc
502 ; GFX900-NEXT: s_movk_i32 s2, 0x7f
503 ; GFX900-NEXT: v_mov_b32_e32 v4, 0
504 ; GFX900-NEXT: s_movk_i32 s0, 0xd000
505 ; GFX900-NEXT: s_movk_i32 s1, 0xe000
506 ; GFX900-NEXT: s_movk_i32 s3, 0xf000
507 ; GFX900-NEXT: .LBB1_1: ; %for.cond.preheader
508 ; GFX900-NEXT: ; =>This Loop Header: Depth=1
509 ; GFX900-NEXT: ; Child Loop BB1_2 Depth 2
510 ; GFX900-NEXT: v_mov_b32_e32 v6, v2
511 ; GFX900-NEXT: v_mov_b32_e32 v5, v1
512 ; GFX900-NEXT: s_mov_b32 s4, 0
513 ; GFX900-NEXT: .LBB1_2: ; %for.body
514 ; GFX900-NEXT: ; Parent Loop BB1_1 Depth=1
515 ; GFX900-NEXT: ; => This Inner Loop Header: Depth=2
516 ; GFX900-NEXT: v_add_co_u32_e32 v7, vcc, 0xffffb000, v5
517 ; GFX900-NEXT: v_addc_co_u32_e32 v8, vcc, -1, v6, vcc
518 ; GFX900-NEXT: global_load_dwordx2 v[9:10], v[5:6], off offset:-4096
519 ; GFX900-NEXT: global_load_dwordx2 v[11:12], v[5:6], off offset:-2048
520 ; GFX900-NEXT: v_add_co_u32_e32 v13, vcc, 0xffffc000, v5
521 ; GFX900-NEXT: global_load_dwordx2 v[7:8], v[7:8], off
522 ; GFX900-NEXT: v_addc_co_u32_e32 v14, vcc, -1, v6, vcc
523 ; GFX900-NEXT: global_load_dwordx2 v[17:18], v[13:14], off offset:-2048
524 ; GFX900-NEXT: v_add_co_u32_e32 v15, vcc, s0, v5
525 ; GFX900-NEXT: v_addc_co_u32_e32 v16, vcc, -1, v6, vcc
526 ; GFX900-NEXT: global_load_dwordx2 v[15:16], v[15:16], off offset:-2048
527 ; GFX900-NEXT: v_add_co_u32_e32 v19, vcc, s1, v5
528 ; GFX900-NEXT: global_load_dwordx2 v[13:14], v[13:14], off
529 ; GFX900-NEXT: v_addc_co_u32_e32 v20, vcc, -1, v6, vcc
530 ; GFX900-NEXT: global_load_dwordx2 v[23:24], v[19:20], off offset:-4096
531 ; GFX900-NEXT: global_load_dwordx2 v[25:26], v[19:20], off offset:-2048
532 ; GFX900-NEXT: global_load_dwordx2 v[27:28], v[19:20], off
533 ; GFX900-NEXT: v_add_co_u32_e32 v21, vcc, s3, v5
534 ; GFX900-NEXT: v_addc_co_u32_e32 v22, vcc, -1, v6, vcc
535 ; GFX900-NEXT: global_load_dwordx2 v[19:20], v[21:22], off offset:-2048
536 ; GFX900-NEXT: global_load_dwordx2 v[29:30], v[5:6], off
537 ; GFX900-NEXT: v_add_co_u32_e32 v5, vcc, 0x10000, v5
538 ; GFX900-NEXT: v_addc_co_u32_e32 v6, vcc, 0, v6, vcc
539 ; GFX900-NEXT: s_addk_i32 s4, 0x2000
540 ; GFX900-NEXT: s_cmp_gt_u32 s4, 0x3fffff
541 ; GFX900-NEXT: s_waitcnt vmcnt(8)
542 ; GFX900-NEXT: v_add_co_u32_e32 v3, vcc, v7, v3
543 ; GFX900-NEXT: v_addc_co_u32_e32 v4, vcc, v8, v4, vcc
544 ; GFX900-NEXT: s_waitcnt vmcnt(7)
545 ; GFX900-NEXT: v_add_co_u32_e32 v3, vcc, v17, v3
546 ; GFX900-NEXT: v_addc_co_u32_e32 v4, vcc, v18, v4, vcc
547 ; GFX900-NEXT: s_waitcnt vmcnt(5)
548 ; GFX900-NEXT: v_add_co_u32_e32 v3, vcc, v13, v3
549 ; GFX900-NEXT: v_addc_co_u32_e32 v4, vcc, v14, v4, vcc
550 ; GFX900-NEXT: v_add_co_u32_e32 v3, vcc, v15, v3
551 ; GFX900-NEXT: v_addc_co_u32_e32 v4, vcc, v16, v4, vcc
552 ; GFX900-NEXT: s_waitcnt vmcnt(4)
553 ; GFX900-NEXT: v_add_co_u32_e32 v3, vcc, v23, v3
554 ; GFX900-NEXT: v_addc_co_u32_e32 v4, vcc, v24, v4, vcc
555 ; GFX900-NEXT: s_waitcnt vmcnt(3)
556 ; GFX900-NEXT: v_add_co_u32_e32 v3, vcc, v25, v3
557 ; GFX900-NEXT: v_addc_co_u32_e32 v4, vcc, v26, v4, vcc
558 ; GFX900-NEXT: s_waitcnt vmcnt(2)
559 ; GFX900-NEXT: v_add_co_u32_e32 v3, vcc, v27, v3
560 ; GFX900-NEXT: v_addc_co_u32_e32 v4, vcc, v28, v4, vcc
561 ; GFX900-NEXT: s_waitcnt vmcnt(1)
562 ; GFX900-NEXT: v_add_co_u32_e32 v3, vcc, v19, v3
563 ; GFX900-NEXT: v_addc_co_u32_e32 v4, vcc, v20, v4, vcc
564 ; GFX900-NEXT: v_add_co_u32_e32 v3, vcc, v9, v3
565 ; GFX900-NEXT: v_addc_co_u32_e32 v4, vcc, v10, v4, vcc
566 ; GFX900-NEXT: v_add_co_u32_e32 v3, vcc, v11, v3
567 ; GFX900-NEXT: v_addc_co_u32_e32 v4, vcc, v12, v4, vcc
568 ; GFX900-NEXT: s_waitcnt vmcnt(0)
569 ; GFX900-NEXT: v_add_co_u32_e32 v3, vcc, v29, v3
570 ; GFX900-NEXT: v_addc_co_u32_e32 v4, vcc, v30, v4, vcc
571 ; GFX900-NEXT: s_cbranch_scc0 .LBB1_2
572 ; GFX900-NEXT: ; %bb.3: ; %while.cond.loopexit
573 ; GFX900-NEXT: ; in Loop: Header=BB1_1 Depth=1
574 ; GFX900-NEXT: s_add_i32 s4, s2, -1
575 ; GFX900-NEXT: s_cmp_eq_u32 s2, 0
576 ; GFX900-NEXT: s_cbranch_scc1 .LBB1_5
577 ; GFX900-NEXT: ; %bb.4: ; in Loop: Header=BB1_1 Depth=1
578 ; GFX900-NEXT: s_mov_b32 s2, s4
579 ; GFX900-NEXT: s_branch .LBB1_1
580 ; GFX900-NEXT: .LBB1_5: ; %while.end
581 ; GFX900-NEXT: v_mov_b32_e32 v1, s35
582 ; GFX900-NEXT: v_add_co_u32_e32 v0, vcc, s34, v0
583 ; GFX900-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
584 ; GFX900-NEXT: global_store_dwordx2 v[0:1], v[3:4], off
585 ; GFX900-NEXT: s_endpgm
587 ; GFX10-LABEL: clmem_read:
588 ; GFX10: ; %bb.0: ; %entry
589 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
590 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
591 ; GFX10-NEXT: s_mov_b32 s38, -1
592 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
593 ; GFX10-NEXT: s_add_u32 s36, s36, s3
594 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
595 ; GFX10-NEXT: s_getpc_b64 s[2:3]
596 ; GFX10-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
597 ; GFX10-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
598 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
599 ; GFX10-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
600 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
601 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
602 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
603 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
604 ; GFX10-NEXT: s_mov_b32 s32, 0
605 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
606 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[4:5]
607 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 17, v0
608 ; GFX10-NEXT: v_and_b32_e32 v2, 0xff, v0
609 ; GFX10-NEXT: v_mov_b32_e32 v3, 0
610 ; GFX10-NEXT: v_mov_b32_e32 v4, 0
611 ; GFX10-NEXT: s_movk_i32 s1, 0x7f
612 ; GFX10-NEXT: v_and_b32_e32 v0, 0xfe000000, v1
613 ; GFX10-NEXT: v_lshl_or_b32 v1, v2, 3, v0
614 ; GFX10-NEXT: v_add_co_u32 v1, s0, v1, s34
615 ; GFX10-NEXT: v_add_co_ci_u32_e64 v2, s0, 0, s35, s0
616 ; GFX10-NEXT: v_add_co_u32 v1, vcc_lo, 0x5000, v1
617 ; GFX10-NEXT: v_add_co_ci_u32_e32 v2, vcc_lo, 0, v2, vcc_lo
618 ; GFX10-NEXT: .LBB1_1: ; %for.cond.preheader
619 ; GFX10-NEXT: ; =>This Loop Header: Depth=1
620 ; GFX10-NEXT: ; Child Loop BB1_2 Depth 2
621 ; GFX10-NEXT: v_mov_b32_e32 v6, v2
622 ; GFX10-NEXT: v_mov_b32_e32 v5, v1
623 ; GFX10-NEXT: s_mov_b32 s2, 0
624 ; GFX10-NEXT: .LBB1_2: ; %for.body
625 ; GFX10-NEXT: ; Parent Loop BB1_1 Depth=1
626 ; GFX10-NEXT: ; => This Inner Loop Header: Depth=2
627 ; GFX10-NEXT: v_add_co_u32 v7, vcc_lo, v5, 0xffffb800
628 ; GFX10-NEXT: v_add_co_ci_u32_e32 v8, vcc_lo, -1, v6, vcc_lo
629 ; GFX10-NEXT: v_add_co_u32 v9, vcc_lo, v5, 0xffffc800
630 ; GFX10-NEXT: v_add_co_ci_u32_e32 v10, vcc_lo, -1, v6, vcc_lo
631 ; GFX10-NEXT: v_add_co_u32 v13, vcc_lo, v5, 0xffffd800
632 ; GFX10-NEXT: v_add_co_ci_u32_e32 v14, vcc_lo, -1, v6, vcc_lo
633 ; GFX10-NEXT: v_add_co_u32 v17, vcc_lo, v5, 0xffffe800
634 ; GFX10-NEXT: s_clause 0x2
635 ; GFX10-NEXT: global_load_dwordx2 v[11:12], v[7:8], off offset:-2048
636 ; GFX10-NEXT: global_load_dwordx2 v[15:16], v[9:10], off offset:-2048
637 ; GFX10-NEXT: global_load_dwordx2 v[19:20], v[13:14], off offset:-2048
638 ; GFX10-NEXT: v_add_co_ci_u32_e32 v18, vcc_lo, -1, v6, vcc_lo
639 ; GFX10-NEXT: v_add_co_u32 v21, vcc_lo, 0xfffff000, v5
640 ; GFX10-NEXT: v_add_co_ci_u32_e32 v22, vcc_lo, -1, v6, vcc_lo
641 ; GFX10-NEXT: s_clause 0x7
642 ; GFX10-NEXT: global_load_dwordx2 v[23:24], v[17:18], off offset:-2048
643 ; GFX10-NEXT: global_load_dwordx2 v[7:8], v[7:8], off
644 ; GFX10-NEXT: global_load_dwordx2 v[9:10], v[9:10], off
645 ; GFX10-NEXT: global_load_dwordx2 v[13:14], v[13:14], off
646 ; GFX10-NEXT: global_load_dwordx2 v[25:26], v[17:18], off
647 ; GFX10-NEXT: global_load_dwordx2 v[27:28], v[21:22], off
648 ; GFX10-NEXT: global_load_dwordx2 v[29:30], v[5:6], off offset:-2048
649 ; GFX10-NEXT: global_load_dwordx2 v[31:32], v[5:6], off
650 ; GFX10-NEXT: v_add_co_u32 v5, vcc_lo, 0x10000, v5
651 ; GFX10-NEXT: v_add_co_ci_u32_e32 v6, vcc_lo, 0, v6, vcc_lo
652 ; GFX10-NEXT: s_addk_i32 s2, 0x2000
653 ; GFX10-NEXT: s_cmp_gt_u32 s2, 0x3fffff
654 ; GFX10-NEXT: s_waitcnt vmcnt(10)
655 ; GFX10-NEXT: v_add_co_u32 v3, s0, v11, v3
656 ; GFX10-NEXT: v_add_co_ci_u32_e64 v4, s0, v12, v4, s0
657 ; GFX10-NEXT: s_waitcnt vmcnt(6)
658 ; GFX10-NEXT: v_add_co_u32 v3, s0, v7, v3
659 ; GFX10-NEXT: v_add_co_ci_u32_e64 v4, s0, v8, v4, s0
660 ; GFX10-NEXT: v_add_co_u32 v3, s0, v15, v3
661 ; GFX10-NEXT: v_add_co_ci_u32_e64 v4, s0, v16, v4, s0
662 ; GFX10-NEXT: s_waitcnt vmcnt(5)
663 ; GFX10-NEXT: v_add_co_u32 v3, s0, v9, v3
664 ; GFX10-NEXT: v_add_co_ci_u32_e64 v4, s0, v10, v4, s0
665 ; GFX10-NEXT: v_add_co_u32 v3, s0, v19, v3
666 ; GFX10-NEXT: v_add_co_ci_u32_e64 v4, s0, v20, v4, s0
667 ; GFX10-NEXT: s_waitcnt vmcnt(4)
668 ; GFX10-NEXT: v_add_co_u32 v3, s0, v13, v3
669 ; GFX10-NEXT: v_add_co_ci_u32_e64 v4, s0, v14, v4, s0
670 ; GFX10-NEXT: v_add_co_u32 v3, s0, v23, v3
671 ; GFX10-NEXT: v_add_co_ci_u32_e64 v4, s0, v24, v4, s0
672 ; GFX10-NEXT: s_waitcnt vmcnt(3)
673 ; GFX10-NEXT: v_add_co_u32 v3, s0, v25, v3
674 ; GFX10-NEXT: v_add_co_ci_u32_e64 v4, s0, v26, v4, s0
675 ; GFX10-NEXT: s_waitcnt vmcnt(2)
676 ; GFX10-NEXT: v_add_co_u32 v3, s0, v27, v3
677 ; GFX10-NEXT: v_add_co_ci_u32_e64 v4, s0, v28, v4, s0
678 ; GFX10-NEXT: s_waitcnt vmcnt(1)
679 ; GFX10-NEXT: v_add_co_u32 v3, s0, v29, v3
680 ; GFX10-NEXT: v_add_co_ci_u32_e64 v4, s0, v30, v4, s0
681 ; GFX10-NEXT: s_waitcnt vmcnt(0)
682 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, v31, v3
683 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, v32, v4, vcc_lo
684 ; GFX10-NEXT: s_cbranch_scc0 .LBB1_2
685 ; GFX10-NEXT: ; %bb.3: ; %while.cond.loopexit
686 ; GFX10-NEXT: ; in Loop: Header=BB1_1 Depth=1
687 ; GFX10-NEXT: s_add_i32 s0, s1, -1
688 ; GFX10-NEXT: s_cmp_eq_u32 s1, 0
689 ; GFX10-NEXT: s_cbranch_scc1 .LBB1_5
690 ; GFX10-NEXT: ; %bb.4: ; in Loop: Header=BB1_1 Depth=1
691 ; GFX10-NEXT: s_mov_b32 s1, s0
692 ; GFX10-NEXT: s_branch .LBB1_1
693 ; GFX10-NEXT: .LBB1_5: ; %while.end
694 ; GFX10-NEXT: v_add_co_u32 v0, s0, s34, v0
695 ; GFX10-NEXT: v_add_co_ci_u32_e64 v1, s0, s35, 0, s0
696 ; GFX10-NEXT: global_store_dwordx2 v[0:1], v[3:4], off
697 ; GFX10-NEXT: s_endpgm
699 ; GFX90A-LABEL: clmem_read:
700 ; GFX90A: ; %bb.0: ; %entry
701 ; GFX90A-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
702 ; GFX90A-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
703 ; GFX90A-NEXT: s_mov_b32 s38, -1
704 ; GFX90A-NEXT: s_mov_b32 s39, 0xe00000
705 ; GFX90A-NEXT: s_add_u32 s36, s36, s3
706 ; GFX90A-NEXT: s_addc_u32 s37, s37, 0
707 ; GFX90A-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
708 ; GFX90A-NEXT: s_getpc_b64 s[0:1]
709 ; GFX90A-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
710 ; GFX90A-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
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: v_mov_b32_e32 v31, v0
714 ; GFX90A-NEXT: s_mov_b64 s[2:3], s[38:39]
715 ; GFX90A-NEXT: v_mov_b32_e32 v0, 0
716 ; GFX90A-NEXT: s_mov_b32 s32, 0
717 ; GFX90A-NEXT: s_waitcnt lgkmcnt(0)
718 ; GFX90A-NEXT: s_swappc_b64 s[30:31], s[4:5]
719 ; GFX90A-NEXT: v_and_b32_e32 v1, 0xff, v0
720 ; GFX90A-NEXT: v_lshlrev_b32_e32 v0, 17, v0
721 ; GFX90A-NEXT: v_and_b32_e32 v0, 0xfe000000, v0
722 ; GFX90A-NEXT: v_lshl_or_b32 v1, v1, 3, v0
723 ; GFX90A-NEXT: v_mov_b32_e32 v2, s35
724 ; GFX90A-NEXT: v_add_co_u32_e32 v1, vcc, s34, v1
725 ; GFX90A-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v2, vcc
726 ; GFX90A-NEXT: v_add_co_u32_e32 v2, vcc, 0x5000, 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[2:3]
815 ; GFX11-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
816 ; GFX11-NEXT: s_addc_u32 s3, s3, _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[2:3], s[2:3], 0x0
819 ; GFX11-NEXT: s_load_b64 s[34:35], s[0:1], 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[2:3]
823 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 17, v0
824 ; GFX11-NEXT: v_dual_mov_b32 v3, 0 :: v_dual_and_b32 v2, 0xff, v0
825 ; GFX11-NEXT: v_mov_b32_e32 v4, 0
826 ; GFX11-NEXT: s_movk_i32 s1, 0x7f
827 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
828 ; GFX11-NEXT: v_and_b32_e32 v0, 0xfe000000, v1
829 ; GFX11-NEXT: v_lshl_or_b32 v1, v2, 3, v0
830 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
831 ; GFX11-NEXT: v_add_co_u32 v1, s0, v1, s34
832 ; GFX11-NEXT: v_add_co_ci_u32_e64 v2, null, 0, s35, s0
833 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
834 ; GFX11-NEXT: v_add_co_u32 v1, vcc_lo, 0x5000, v1
835 ; GFX11-NEXT: v_add_co_ci_u32_e32 v2, vcc_lo, 0, v2, vcc_lo
836 ; GFX11-NEXT: .LBB1_1: ; %for.cond.preheader
837 ; GFX11-NEXT: ; =>This Loop Header: Depth=1
838 ; GFX11-NEXT: ; Child Loop BB1_2 Depth 2
839 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
840 ; GFX11-NEXT: v_dual_mov_b32 v6, v2 :: v_dual_mov_b32 v5, v1
841 ; GFX11-NEXT: s_mov_b32 s2, 0
842 ; GFX11-NEXT: .LBB1_2: ; %for.body
843 ; GFX11-NEXT: ; Parent Loop BB1_1 Depth=1
844 ; GFX11-NEXT: ; => This Inner Loop Header: Depth=2
845 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_2)
846 ; GFX11-NEXT: v_add_co_u32 v7, vcc_lo, v5, 0xffffc000
847 ; GFX11-NEXT: v_add_co_ci_u32_e32 v8, vcc_lo, -1, v6, vcc_lo
848 ; GFX11-NEXT: v_add_co_u32 v9, vcc_lo, 0xffffc000, v5
849 ; GFX11-NEXT: v_add_co_ci_u32_e32 v10, vcc_lo, -1, v6, vcc_lo
850 ; GFX11-NEXT: v_add_co_u32 v11, vcc_lo, 0xffffd000, v5
851 ; GFX11-NEXT: s_clause 0x1
852 ; GFX11-NEXT: global_load_b64 v[13:14], v[7:8], off offset:-4096
853 ; GFX11-NEXT: global_load_b64 v[9:10], v[9:10], off offset:-2048
854 ; GFX11-NEXT: v_add_co_ci_u32_e32 v12, vcc_lo, -1, v6, vcc_lo
855 ; GFX11-NEXT: v_add_co_u32 v15, vcc_lo, v5, 0xffffe000
856 ; GFX11-NEXT: v_add_co_ci_u32_e32 v16, vcc_lo, -1, v6, vcc_lo
857 ; GFX11-NEXT: global_load_b64 v[11:12], v[11:12], off offset:-2048
858 ; GFX11-NEXT: v_add_co_u32 v17, vcc_lo, 0xffffe000, v5
859 ; GFX11-NEXT: s_clause 0x1
860 ; GFX11-NEXT: global_load_b64 v[19:20], v[15:16], off offset:-4096
861 ; GFX11-NEXT: global_load_b64 v[7:8], v[7:8], off
862 ; GFX11-NEXT: v_add_co_ci_u32_e32 v18, vcc_lo, -1, v6, vcc_lo
863 ; GFX11-NEXT: v_add_co_u32 v21, vcc_lo, 0xfffff000, v5
864 ; GFX11-NEXT: v_add_co_ci_u32_e32 v22, vcc_lo, -1, v6, vcc_lo
865 ; GFX11-NEXT: s_clause 0x5
866 ; GFX11-NEXT: global_load_b64 v[17:18], v[17:18], off offset:-2048
867 ; GFX11-NEXT: global_load_b64 v[15:16], v[15:16], off
868 ; GFX11-NEXT: global_load_b64 v[21:22], v[21:22], off offset:-2048
869 ; GFX11-NEXT: global_load_b64 v[23:24], v[5:6], off offset:-4096
870 ; GFX11-NEXT: global_load_b64 v[25:26], v[5:6], off offset:-2048
871 ; GFX11-NEXT: global_load_b64 v[27:28], v[5:6], off
872 ; GFX11-NEXT: v_add_co_u32 v5, vcc_lo, 0x10000, v5
873 ; GFX11-NEXT: v_add_co_ci_u32_e32 v6, vcc_lo, 0, v6, vcc_lo
874 ; GFX11-NEXT: s_addk_i32 s2, 0x2000
875 ; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | instskip(SKIP_2) | instid1(VALU_DEP_1)
876 ; GFX11-NEXT: s_cmp_gt_u32 s2, 0x3fffff
877 ; GFX11-NEXT: s_waitcnt vmcnt(10)
878 ; GFX11-NEXT: v_add_co_u32 v3, s0, v13, v3
879 ; GFX11-NEXT: v_add_co_ci_u32_e64 v4, s0, v14, v4, s0
880 ; GFX11-NEXT: s_waitcnt vmcnt(9)
881 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
882 ; GFX11-NEXT: v_add_co_u32 v3, s0, v9, v3
883 ; GFX11-NEXT: v_add_co_ci_u32_e64 v4, s0, v10, v4, s0
884 ; GFX11-NEXT: s_waitcnt vmcnt(6)
885 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
886 ; GFX11-NEXT: v_add_co_u32 v3, s0, v7, v3
887 ; GFX11-NEXT: v_add_co_ci_u32_e64 v4, s0, v8, v4, s0
888 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
889 ; GFX11-NEXT: v_add_co_u32 v3, s0, v11, v3
890 ; GFX11-NEXT: v_add_co_ci_u32_e64 v4, s0, v12, v4, s0
891 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
892 ; GFX11-NEXT: v_add_co_u32 v3, s0, v19, v3
893 ; GFX11-NEXT: v_add_co_ci_u32_e64 v4, s0, v20, v4, s0
894 ; GFX11-NEXT: s_waitcnt vmcnt(5)
895 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
896 ; GFX11-NEXT: v_add_co_u32 v3, s0, v17, v3
897 ; GFX11-NEXT: v_add_co_ci_u32_e64 v4, s0, v18, v4, s0
898 ; GFX11-NEXT: s_waitcnt vmcnt(4)
899 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
900 ; GFX11-NEXT: v_add_co_u32 v3, s0, v15, v3
901 ; GFX11-NEXT: v_add_co_ci_u32_e64 v4, s0, v16, v4, s0
902 ; GFX11-NEXT: s_waitcnt vmcnt(3)
903 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
904 ; GFX11-NEXT: v_add_co_u32 v3, s0, v21, v3
905 ; GFX11-NEXT: v_add_co_ci_u32_e64 v4, s0, v22, v4, s0
906 ; GFX11-NEXT: s_waitcnt vmcnt(2)
907 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
908 ; GFX11-NEXT: v_add_co_u32 v3, s0, v23, v3
909 ; GFX11-NEXT: v_add_co_ci_u32_e64 v4, s0, v24, v4, s0
910 ; GFX11-NEXT: s_waitcnt vmcnt(1)
911 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
912 ; GFX11-NEXT: v_add_co_u32 v3, s0, v25, v3
913 ; GFX11-NEXT: v_add_co_ci_u32_e64 v4, s0, v26, v4, s0
914 ; GFX11-NEXT: s_waitcnt vmcnt(0)
915 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
916 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, v27, v3
917 ; GFX11-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, v28, v4, vcc_lo
918 ; GFX11-NEXT: s_cbranch_scc0 .LBB1_2
919 ; GFX11-NEXT: ; %bb.3: ; %while.cond.loopexit
920 ; GFX11-NEXT: ; in Loop: Header=BB1_1 Depth=1
921 ; GFX11-NEXT: s_add_i32 s0, s1, -1
922 ; GFX11-NEXT: s_cmp_eq_u32 s1, 0
923 ; GFX11-NEXT: s_cbranch_scc1 .LBB1_5
924 ; GFX11-NEXT: ; %bb.4: ; in Loop: Header=BB1_1 Depth=1
925 ; GFX11-NEXT: s_mov_b32 s1, s0
926 ; GFX11-NEXT: s_branch .LBB1_1
927 ; GFX11-NEXT: .LBB1_5: ; %while.end
928 ; GFX11-NEXT: v_add_co_u32 v0, s0, s34, v0
929 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
930 ; GFX11-NEXT: v_add_co_ci_u32_e64 v1, null, s35, 0, s0
931 ; GFX11-NEXT: global_store_b64 v[0:1], v[3:4], off
932 ; GFX11-NEXT: s_nop 0
933 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
934 ; GFX11-NEXT: s_endpgm
936 %call = tail call i64 @_Z13get_global_idj(i32 0)
937 %conv = and i64 %call, 255
938 %a0 = shl i64 %call, 17
939 %idx.ext11 = and i64 %a0, 4261412864
940 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
941 %add.ptr6 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 %conv
942 br label %for.cond.preheader
944 while.cond.loopexit: ; preds = %for.body
945 %dec = add nsw i32 %dec31, -1
946 %tobool = icmp eq i32 %dec31, 0
947 br i1 %tobool, label %while.end, label %for.cond.preheader
949 for.cond.preheader: ; preds = %entry, %while.cond.loopexit
950 %dec31 = phi i32 [ 127, %entry ], [ %dec, %while.cond.loopexit ]
951 %sum.030 = phi i64 [ 0, %entry ], [ %add.10, %while.cond.loopexit ]
954 for.body: ; preds = %for.body, %for.cond.preheader
955 %block.029 = phi i32 [ 0, %for.cond.preheader ], [ %add9.31, %for.body ]
956 %sum.128 = phi i64 [ %sum.030, %for.cond.preheader ], [ %add.10, %for.body ]
957 %conv3 = zext i32 %block.029 to i64
958 %add.ptr8 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3
959 %load1 = load i64, ptr addrspace(1) %add.ptr8, align 8
960 %add = add i64 %load1, %sum.128
962 %add9 = or i32 %block.029, 256
963 %conv3.1 = zext i32 %add9 to i64
964 %add.ptr8.1 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.1
965 %load2 = load i64, ptr addrspace(1) %add.ptr8.1, align 8
966 %add.1 = add i64 %load2, %add
968 %add9.1 = or i32 %block.029, 512
969 %conv3.2 = zext i32 %add9.1 to i64
970 %add.ptr8.2 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.2
971 %l3 = load i64, ptr addrspace(1) %add.ptr8.2, align 8
972 %add.2 = add i64 %l3, %add.1
974 %add9.2 = or i32 %block.029, 768
975 %conv3.3 = zext i32 %add9.2 to i64
976 %add.ptr8.3 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.3
977 %l4 = load i64, ptr addrspace(1) %add.ptr8.3, align 8
978 %add.3 = add i64 %l4, %add.2
980 %add9.3 = or i32 %block.029, 1024
981 %conv3.4 = zext i32 %add9.3 to i64
982 %add.ptr8.4 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.4
983 %l5 = load i64, ptr addrspace(1) %add.ptr8.4, align 8
984 %add.4 = add i64 %l5, %add.3
986 %add9.4 = or i32 %block.029, 1280
987 %conv3.5 = zext i32 %add9.4 to i64
988 %add.ptr8.5 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.5
989 %l6 = load i64, ptr addrspace(1) %add.ptr8.5, align 8
990 %add.5 = add i64 %l6, %add.4
992 %add9.5 = or i32 %block.029, 1536
993 %conv3.6 = zext i32 %add9.5 to i64
994 %add.ptr8.6 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.6
995 %load7 = load i64, ptr addrspace(1) %add.ptr8.6, align 8
996 %add.6 = add i64 %load7, %add.5
998 %add9.6 = or i32 %block.029, 1792
999 %conv3.7 = zext i32 %add9.6 to i64
1000 %add.ptr8.7 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.7
1001 %load8 = load i64, ptr addrspace(1) %add.ptr8.7, align 8
1002 %add.7 = add i64 %load8, %add.6
1004 %add9.7 = or i32 %block.029, 2048
1005 %conv3.8 = zext i32 %add9.7 to i64
1006 %add.ptr8.8 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.8
1007 %load9 = load i64, ptr addrspace(1) %add.ptr8.8, align 8
1008 %add.8 = add i64 %load9, %add.7
1010 %add9.8 = or i32 %block.029, 2304
1011 %conv3.9 = zext i32 %add9.8 to i64
1012 %add.ptr8.9 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.9
1013 %load10 = load i64, ptr addrspace(1) %add.ptr8.9, align 8
1014 %add.9 = add i64 %load10, %add.8
1016 %add9.9 = or i32 %block.029, 2560
1017 %conv3.10 = zext i32 %add9.9 to i64
1018 %add.ptr8.10 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr6, i64 %conv3.10
1019 %load11 = load i64, ptr addrspace(1) %add.ptr8.10, align 8
1020 %add.10 = add i64 %load11, %add.9
1022 %add9.31 = add nuw nsw i32 %block.029, 8192
1023 %cmp.31 = icmp ult i32 %add9.31, 4194304
1024 br i1 %cmp.31, label %for.body, label %while.cond.loopexit
1026 while.end: ; preds = %while.cond.loopexit
1027 store i64 %add.10, ptr addrspace(1) %add.ptr12, align 8
1031 ; using 32bit address.
1032 define amdgpu_kernel void @Address32(ptr addrspace(1) %buffer) {
1033 ; GFX8-LABEL: Address32:
1034 ; GFX8: ; %bb.0: ; %entry
1035 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1036 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1037 ; GFX8-NEXT: s_mov_b32 s38, -1
1038 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
1039 ; GFX8-NEXT: s_add_u32 s36, s36, s3
1040 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
1041 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
1042 ; GFX8-NEXT: s_getpc_b64 s[0:1]
1043 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1044 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1045 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1046 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
1047 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
1048 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
1049 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
1050 ; GFX8-NEXT: s_mov_b32 s32, 0
1051 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1052 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
1053 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1054 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff8000, v1
1055 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
1056 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, s34, v1
1057 ; GFX8-NEXT: v_mov_b32_e32 v3, 2
1058 ; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc
1059 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1060 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v1, v0
1061 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v2, vcc
1062 ; GFX8-NEXT: s_movk_i32 s0, 0x400
1063 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, s0, v3
1064 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v4, vcc
1065 ; GFX8-NEXT: s_movk_i32 s0, 0x800
1066 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, s0, v3
1067 ; GFX8-NEXT: v_addc_u32_e32 v8, vcc, 0, v4, vcc
1068 ; GFX8-NEXT: s_movk_i32 s0, 0xc00
1069 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, s0, v3
1070 ; GFX8-NEXT: v_addc_u32_e32 v10, vcc, 0, v4, vcc
1071 ; GFX8-NEXT: s_movk_i32 s0, 0x1000
1072 ; GFX8-NEXT: v_add_u32_e32 v11, vcc, s0, v3
1073 ; GFX8-NEXT: v_addc_u32_e32 v12, vcc, 0, v4, vcc
1074 ; GFX8-NEXT: s_movk_i32 s0, 0x1400
1075 ; GFX8-NEXT: v_add_u32_e32 v13, vcc, s0, v3
1076 ; GFX8-NEXT: v_addc_u32_e32 v14, vcc, 0, v4, vcc
1077 ; GFX8-NEXT: s_movk_i32 s0, 0x1800
1078 ; GFX8-NEXT: v_add_u32_e32 v15, vcc, s0, v3
1079 ; GFX8-NEXT: v_addc_u32_e32 v16, vcc, 0, v4, vcc
1080 ; GFX8-NEXT: s_movk_i32 s0, 0x1c00
1081 ; GFX8-NEXT: v_add_u32_e32 v17, vcc, s0, v3
1082 ; GFX8-NEXT: v_addc_u32_e32 v18, vcc, 0, v4, vcc
1083 ; GFX8-NEXT: s_movk_i32 s0, 0x2000
1084 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
1085 ; GFX8-NEXT: flat_load_dword v19, v[5:6]
1086 ; GFX8-NEXT: flat_load_dword v7, v[7:8]
1087 ; GFX8-NEXT: flat_load_dword v8, v[9:10]
1088 ; GFX8-NEXT: flat_load_dword v9, v[11:12]
1089 ; GFX8-NEXT: flat_load_dword v10, v[13:14]
1090 ; GFX8-NEXT: flat_load_dword v11, v[15:16]
1091 ; GFX8-NEXT: flat_load_dword v12, v[17:18]
1092 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, s0, v3
1093 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v4, vcc
1094 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x2400, v3
1095 ; GFX8-NEXT: flat_load_dword v5, v[5:6]
1096 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v4, vcc
1097 ; GFX8-NEXT: flat_load_dword v3, v[3:4]
1098 ; GFX8-NEXT: s_waitcnt vmcnt(8)
1099 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v19, v0
1100 ; GFX8-NEXT: s_waitcnt vmcnt(7)
1101 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v7, v0
1102 ; GFX8-NEXT: s_waitcnt vmcnt(6)
1103 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v8, v0
1104 ; GFX8-NEXT: s_waitcnt vmcnt(5)
1105 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v9, v0
1106 ; GFX8-NEXT: s_waitcnt vmcnt(4)
1107 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v10, v0
1108 ; GFX8-NEXT: s_waitcnt vmcnt(3)
1109 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v11, v0
1110 ; GFX8-NEXT: s_waitcnt vmcnt(2)
1111 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v12, v0
1112 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1113 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v5, v0
1114 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1115 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v3, v0
1116 ; GFX8-NEXT: flat_store_dword v[1:2], v0
1117 ; GFX8-NEXT: s_endpgm
1119 ; GFX9-LABEL: Address32:
1120 ; GFX9: ; %bb.0: ; %entry
1121 ; GFX9-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1122 ; GFX9-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1123 ; GFX9-NEXT: s_mov_b32 s38, -1
1124 ; GFX9-NEXT: s_mov_b32 s39, 0xe00000
1125 ; GFX9-NEXT: s_add_u32 s36, s36, s3
1126 ; GFX9-NEXT: s_addc_u32 s37, s37, 0
1127 ; GFX9-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
1128 ; GFX9-NEXT: s_getpc_b64 s[0:1]
1129 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1130 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1131 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1132 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37]
1133 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
1134 ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39]
1135 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
1136 ; GFX9-NEXT: s_mov_b32 s32, 0
1137 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
1138 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
1139 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1140 ; GFX9-NEXT: v_and_b32_e32 v4, 0xffff8000, v1
1141 ; GFX9-NEXT: v_mov_b32_e32 v1, s35
1142 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s34, v4
1143 ; GFX9-NEXT: v_mov_b32_e32 v3, 2
1144 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1145 ; GFX9-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1146 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v2, v0
1147 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1148 ; GFX9-NEXT: s_movk_i32 s0, 0x1000
1149 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s0, v0
1150 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v1, vcc
1151 ; GFX9-NEXT: global_load_dword v5, v[0:1], off
1152 ; GFX9-NEXT: global_load_dword v6, v[0:1], off offset:1024
1153 ; GFX9-NEXT: global_load_dword v7, v[0:1], off offset:2048
1154 ; GFX9-NEXT: global_load_dword v8, v[0:1], off offset:3072
1155 ; GFX9-NEXT: global_load_dword v9, v[2:3], off
1156 ; GFX9-NEXT: global_load_dword v10, v[2:3], off offset:1024
1157 ; GFX9-NEXT: global_load_dword v11, v[2:3], off offset:2048
1158 ; GFX9-NEXT: global_load_dword v12, v[2:3], off offset:3072
1159 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, 0x2000, v0
1160 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1161 ; GFX9-NEXT: global_load_dword v2, v[0:1], off
1162 ; GFX9-NEXT: global_load_dword v3, v[0:1], off offset:1024
1163 ; GFX9-NEXT: s_waitcnt vmcnt(8)
1164 ; GFX9-NEXT: v_add_u32_e32 v0, v6, v5
1165 ; GFX9-NEXT: s_waitcnt vmcnt(6)
1166 ; GFX9-NEXT: v_add3_u32 v0, v7, v0, v8
1167 ; GFX9-NEXT: s_waitcnt vmcnt(4)
1168 ; GFX9-NEXT: v_add3_u32 v0, v9, v0, v10
1169 ; GFX9-NEXT: s_waitcnt vmcnt(2)
1170 ; GFX9-NEXT: v_add3_u32 v0, v11, v0, v12
1171 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1172 ; GFX9-NEXT: v_add3_u32 v0, v2, v0, v3
1173 ; GFX9-NEXT: global_store_dword v4, v0, s[34:35]
1174 ; GFX9-NEXT: s_endpgm
1176 ; GFX10-LABEL: Address32:
1177 ; GFX10: ; %bb.0: ; %entry
1178 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1179 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1180 ; GFX10-NEXT: s_mov_b32 s38, -1
1181 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
1182 ; GFX10-NEXT: s_add_u32 s36, s36, s3
1183 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
1184 ; GFX10-NEXT: s_getpc_b64 s[2:3]
1185 ; GFX10-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
1186 ; GFX10-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
1187 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
1188 ; GFX10-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
1189 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
1190 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
1191 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
1192 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
1193 ; GFX10-NEXT: s_mov_b32 s32, 0
1194 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1195 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[4:5]
1196 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1197 ; GFX10-NEXT: v_mov_b32_e32 v2, 2
1198 ; GFX10-NEXT: v_and_b32_e32 v8, 0xffff8000, v1
1199 ; GFX10-NEXT: v_lshlrev_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1200 ; GFX10-NEXT: v_add_co_u32 v1, s0, s34, v8
1201 ; GFX10-NEXT: v_add_co_ci_u32_e64 v2, s0, s35, 0, s0
1202 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
1203 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
1204 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, 0x800, v0
1205 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
1206 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, v0, 0x1000
1207 ; GFX10-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
1208 ; GFX10-NEXT: v_add_co_u32 v6, vcc_lo, 0x1000, v0
1209 ; GFX10-NEXT: s_clause 0x4
1210 ; GFX10-NEXT: global_load_dword v9, v[0:1], off
1211 ; GFX10-NEXT: global_load_dword v10, v[0:1], off offset:1024
1212 ; GFX10-NEXT: global_load_dword v11, v[2:3], off offset:1024
1213 ; GFX10-NEXT: global_load_dword v12, v[4:5], off offset:-2048
1214 ; GFX10-NEXT: global_load_dword v13, v[4:5], off
1215 ; GFX10-NEXT: v_add_co_ci_u32_e32 v7, vcc_lo, 0, v1, vcc_lo
1216 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, 0x1800, v0
1217 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
1218 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, v0, 0x2000
1219 ; GFX10-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
1220 ; GFX10-NEXT: s_clause 0x1
1221 ; GFX10-NEXT: global_load_dword v14, v[6:7], off offset:1024
1222 ; GFX10-NEXT: global_load_dword v15, v[2:3], off offset:1024
1223 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x2000, v0
1224 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
1225 ; GFX10-NEXT: s_clause 0x2
1226 ; GFX10-NEXT: global_load_dword v2, v[4:5], off offset:-2048
1227 ; GFX10-NEXT: global_load_dword v3, v[4:5], off
1228 ; GFX10-NEXT: global_load_dword v6, v[0:1], off offset:1024
1229 ; GFX10-NEXT: s_waitcnt vmcnt(8)
1230 ; GFX10-NEXT: v_add_nc_u32_e32 v0, v10, v9
1231 ; GFX10-NEXT: s_waitcnt vmcnt(6)
1232 ; GFX10-NEXT: v_add3_u32 v0, v12, v0, v11
1233 ; GFX10-NEXT: s_waitcnt vmcnt(4)
1234 ; GFX10-NEXT: v_add3_u32 v0, v13, v0, v14
1235 ; GFX10-NEXT: s_waitcnt vmcnt(2)
1236 ; GFX10-NEXT: v_add3_u32 v0, v2, v0, v15
1237 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1238 ; GFX10-NEXT: v_add3_u32 v0, v3, v0, v6
1239 ; GFX10-NEXT: global_store_dword v8, v0, s[34:35]
1240 ; GFX10-NEXT: s_endpgm
1242 ; GFX11-LABEL: Address32:
1243 ; GFX11: ; %bb.0: ; %entry
1244 ; GFX11-NEXT: s_getpc_b64 s[2:3]
1245 ; GFX11-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
1246 ; GFX11-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
1247 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
1248 ; GFX11-NEXT: s_load_b64 s[2:3], s[2:3], 0x0
1249 ; GFX11-NEXT: s_load_b64 s[34:35], s[0:1], 0x24
1250 ; GFX11-NEXT: s_mov_b32 s32, 0
1251 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1252 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[2:3]
1253 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1254 ; GFX11-NEXT: v_and_b32_e32 v0, 0xff, v0
1255 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1256 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff8000, v1
1257 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1258 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
1259 ; GFX11-NEXT: v_add_co_u32 v1, s0, s34, v6
1260 ; GFX11-NEXT: v_add_co_ci_u32_e64 v2, null, s35, 0, s0
1261 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1262 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
1263 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
1264 ; GFX11-NEXT: s_clause 0x1
1265 ; GFX11-NEXT: global_load_b32 v7, v[0:1], off
1266 ; GFX11-NEXT: global_load_b32 v8, v[0:1], off offset:1024
1267 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, 0x1000, v0
1268 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
1269 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, v0, 0x2000
1270 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
1271 ; GFX11-NEXT: s_clause 0x5
1272 ; GFX11-NEXT: global_load_b32 v9, v[0:1], off offset:2048
1273 ; GFX11-NEXT: global_load_b32 v10, v[0:1], off offset:3072
1274 ; GFX11-NEXT: global_load_b32 v11, v[4:5], off offset:-4096
1275 ; GFX11-NEXT: global_load_b32 v12, v[2:3], off offset:1024
1276 ; GFX11-NEXT: global_load_b32 v13, v[2:3], off offset:2048
1277 ; GFX11-NEXT: global_load_b32 v2, v[2:3], off offset:3072
1278 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0x2000, v0
1279 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
1280 ; GFX11-NEXT: s_clause 0x1
1281 ; GFX11-NEXT: global_load_b32 v3, v[4:5], off
1282 ; GFX11-NEXT: global_load_b32 v0, v[0:1], off offset:1024
1283 ; GFX11-NEXT: s_waitcnt vmcnt(8)
1284 ; GFX11-NEXT: v_add_nc_u32_e32 v1, v8, v7
1285 ; GFX11-NEXT: s_waitcnt vmcnt(6)
1286 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
1287 ; GFX11-NEXT: v_add3_u32 v1, v9, v1, v10
1288 ; GFX11-NEXT: s_waitcnt vmcnt(4)
1289 ; GFX11-NEXT: v_add3_u32 v1, v11, v1, v12
1290 ; GFX11-NEXT: s_waitcnt vmcnt(2)
1291 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_1)
1292 ; GFX11-NEXT: v_add3_u32 v1, v13, v1, v2
1293 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1294 ; GFX11-NEXT: v_add3_u32 v0, v3, v1, v0
1295 ; GFX11-NEXT: global_store_b32 v6, v0, s[34:35]
1296 ; GFX11-NEXT: s_nop 0
1297 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1298 ; GFX11-NEXT: s_endpgm
1300 %call = tail call i64 @_Z13get_global_idj(i32 0)
1301 %conv = and i64 %call, 255
1302 %id = shl i64 %call, 7
1303 %idx.ext11 = and i64 %id, 4294934528
1304 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
1306 %add.ptr6 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr12, i64 %conv
1307 %load1 = load i32, ptr addrspace(1) %add.ptr6, align 4
1309 %add.ptr8.1 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 256
1310 %load2 = load i32, ptr addrspace(1) %add.ptr8.1, align 4
1311 %add.1 = add i32 %load2, %load1
1313 %add.ptr8.2 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 512
1314 %load3 = load i32, ptr addrspace(1) %add.ptr8.2, align 4
1315 %add.2 = add i32 %load3, %add.1
1317 %add.ptr8.3 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 768
1318 %load4 = load i32, ptr addrspace(1) %add.ptr8.3, align 4
1319 %add.3 = add i32 %load4, %add.2
1321 %add.ptr8.4 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 1024
1322 %load5 = load i32, ptr addrspace(1) %add.ptr8.4, align 4
1323 %add.4 = add i32 %load5, %add.3
1325 %add.ptr8.5 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 1280
1326 %load6 = load i32, ptr addrspace(1) %add.ptr8.5, align 4
1327 %add.5 = add i32 %load6, %add.4
1329 %add.ptr8.6 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 1536
1330 %load7 = load i32, ptr addrspace(1) %add.ptr8.6, align 4
1331 %add.6 = add i32 %load7, %add.5
1333 %add.ptr8.7 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 1792
1334 %load8 = load i32, ptr addrspace(1) %add.ptr8.7, align 4
1335 %add.7 = add i32 %load8, %add.6
1337 %add.ptr8.8 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 2048
1338 %load9 = load i32, ptr addrspace(1) %add.ptr8.8, align 4
1339 %add.8 = add i32 %load9, %add.7
1341 %add.ptr8.9 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr6, i64 2304
1342 %load10 = load i32, ptr addrspace(1) %add.ptr8.9, align 4
1343 %add.9 = add i32 %load10, %add.8
1345 store i32 %add.9, ptr addrspace(1) %add.ptr12, align 4
1349 define amdgpu_kernel void @Offset64(ptr addrspace(1) %buffer) {
1350 ; GFX8-LABEL: Offset64:
1351 ; GFX8: ; %bb.0: ; %entry
1352 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1353 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1354 ; GFX8-NEXT: s_mov_b32 s38, -1
1355 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
1356 ; GFX8-NEXT: s_add_u32 s36, s36, s3
1357 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
1358 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
1359 ; GFX8-NEXT: s_getpc_b64 s[0:1]
1360 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1361 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1362 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1363 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
1364 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
1365 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
1366 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
1367 ; GFX8-NEXT: s_mov_b32 s32, 0
1368 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1369 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
1370 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1371 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff8000, v1
1372 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
1373 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, s34, v1
1374 ; GFX8-NEXT: v_mov_b32_e32 v3, 3
1375 ; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc
1376 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1377 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v1, v0
1378 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v2, vcc
1379 ; GFX8-NEXT: s_movk_i32 s0, 0xf000
1380 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, s0, v3
1381 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v4, vcc
1382 ; GFX8-NEXT: s_movk_i32 s0, 0xf800
1383 ; GFX8-NEXT: flat_load_dwordx2 v[7:8], v[3:4]
1384 ; GFX8-NEXT: flat_load_dwordx2 v[5:6], v[5:6]
1385 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, s0, v3
1386 ; GFX8-NEXT: v_addc_u32_e32 v10, vcc, 0, v4, vcc
1387 ; GFX8-NEXT: flat_load_dwordx2 v[9:10], v[9:10]
1388 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0, v3
1389 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 1, v4, vcc
1390 ; GFX8-NEXT: flat_load_dwordx2 v[3:4], v[3:4]
1391 ; GFX8-NEXT: s_waitcnt vmcnt(2)
1392 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v5, v7
1393 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v6, v8, vcc
1394 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1395 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v9, v0
1396 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v10, v5, vcc
1397 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1398 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v3, v0
1399 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v4, v5, vcc
1400 ; GFX8-NEXT: flat_store_dwordx2 v[1:2], v[3:4]
1401 ; GFX8-NEXT: s_endpgm
1403 ; GFX9-LABEL: Offset64:
1404 ; GFX9: ; %bb.0: ; %entry
1405 ; GFX9-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1406 ; GFX9-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1407 ; GFX9-NEXT: s_mov_b32 s38, -1
1408 ; GFX9-NEXT: s_mov_b32 s39, 0xe00000
1409 ; GFX9-NEXT: s_add_u32 s36, s36, s3
1410 ; GFX9-NEXT: s_addc_u32 s37, s37, 0
1411 ; GFX9-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
1412 ; GFX9-NEXT: s_getpc_b64 s[0:1]
1413 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1414 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1415 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1416 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37]
1417 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
1418 ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39]
1419 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
1420 ; GFX9-NEXT: s_mov_b32 s32, 0
1421 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
1422 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
1423 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1424 ; GFX9-NEXT: v_and_b32_e32 v12, 0xffff8000, v1
1425 ; GFX9-NEXT: v_mov_b32_e32 v1, s35
1426 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s34, v12
1427 ; GFX9-NEXT: v_mov_b32_e32 v3, 3
1428 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1429 ; GFX9-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1430 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v2, v0
1431 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1432 ; GFX9-NEXT: v_add_co_u32_e32 v4, vcc, 0, v0
1433 ; GFX9-NEXT: v_addc_co_u32_e32 v5, vcc, 1, v1, vcc
1434 ; GFX9-NEXT: global_load_dwordx2 v[2:3], v[0:1], off
1435 ; GFX9-NEXT: global_load_dwordx2 v[6:7], v[4:5], off offset:-4096
1436 ; GFX9-NEXT: s_movk_i32 s0, 0xf000
1437 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, s0, v0
1438 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1439 ; GFX9-NEXT: global_load_dwordx2 v[8:9], v[4:5], off
1440 ; GFX9-NEXT: global_load_dwordx2 v[10:11], v[0:1], off offset:2048
1441 ; GFX9-NEXT: s_waitcnt vmcnt(2)
1442 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v6, v2
1443 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v7, v3, vcc
1444 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1445 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v10, v0
1446 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v11, v1, vcc
1447 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v8, v0
1448 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v9, v1, vcc
1449 ; GFX9-NEXT: global_store_dwordx2 v12, v[0:1], s[34:35]
1450 ; GFX9-NEXT: s_endpgm
1452 ; GFX10-LABEL: Offset64:
1453 ; GFX10: ; %bb.0: ; %entry
1454 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1455 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1456 ; GFX10-NEXT: s_mov_b32 s38, -1
1457 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
1458 ; GFX10-NEXT: s_add_u32 s36, s36, s3
1459 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
1460 ; GFX10-NEXT: s_getpc_b64 s[2:3]
1461 ; GFX10-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
1462 ; GFX10-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
1463 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
1464 ; GFX10-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
1465 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
1466 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
1467 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
1468 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
1469 ; GFX10-NEXT: s_mov_b32 s32, 0
1470 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1471 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[4:5]
1472 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1473 ; GFX10-NEXT: v_mov_b32_e32 v2, 3
1474 ; GFX10-NEXT: v_and_b32_e32 v12, 0xffff8000, v1
1475 ; GFX10-NEXT: v_lshlrev_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1476 ; GFX10-NEXT: v_add_co_u32 v1, s0, s34, v12
1477 ; GFX10-NEXT: v_add_co_ci_u32_e64 v2, s0, s35, 0, s0
1478 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
1479 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
1480 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v0, 0xfffff800
1481 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
1482 ; GFX10-NEXT: s_clause 0x1
1483 ; GFX10-NEXT: global_load_dwordx2 v[4:5], v[0:1], off
1484 ; GFX10-NEXT: global_load_dwordx2 v[6:7], v[2:3], off offset:-2048
1485 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0, v0
1486 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 1, v1, vcc_lo
1487 ; GFX10-NEXT: s_clause 0x1
1488 ; GFX10-NEXT: global_load_dwordx2 v[8:9], v[2:3], off
1489 ; GFX10-NEXT: global_load_dwordx2 v[10:11], v[0:1], off
1490 ; GFX10-NEXT: s_waitcnt vmcnt(2)
1491 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v6, v4
1492 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v7, v5, vcc_lo
1493 ; GFX10-NEXT: s_waitcnt vmcnt(1)
1494 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v8, v0
1495 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v9, v1, vcc_lo
1496 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1497 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v10, v0
1498 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v11, v1, vcc_lo
1499 ; GFX10-NEXT: global_store_dwordx2 v12, v[0:1], s[34:35]
1500 ; GFX10-NEXT: s_endpgm
1502 ; GFX11-LABEL: Offset64:
1503 ; GFX11: ; %bb.0: ; %entry
1504 ; GFX11-NEXT: s_getpc_b64 s[2:3]
1505 ; GFX11-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
1506 ; GFX11-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
1507 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
1508 ; GFX11-NEXT: s_load_b64 s[2:3], s[2:3], 0x0
1509 ; GFX11-NEXT: s_load_b64 s[34:35], s[0:1], 0x24
1510 ; GFX11-NEXT: s_mov_b32 s32, 0
1511 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1512 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[2:3]
1513 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1514 ; GFX11-NEXT: v_and_b32_e32 v0, 0xff, v0
1515 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1516 ; GFX11-NEXT: v_and_b32_e32 v8, 0xffff8000, v1
1517 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 3, v0
1518 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
1519 ; GFX11-NEXT: v_add_co_u32 v1, s0, s34, v8
1520 ; GFX11-NEXT: v_add_co_ci_u32_e64 v2, null, s35, 0, s0
1521 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1522 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
1523 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
1524 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1525 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, v0, 0
1526 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 1, v1, vcc_lo
1527 ; GFX11-NEXT: global_load_b64 v[2:3], v[0:1], off
1528 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0xfffff000, v0
1529 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
1530 ; GFX11-NEXT: s_clause 0x2
1531 ; GFX11-NEXT: global_load_b64 v[6:7], v[4:5], off offset:-4096
1532 ; GFX11-NEXT: global_load_b64 v[4:5], v[4:5], off
1533 ; GFX11-NEXT: global_load_b64 v[0:1], v[0:1], off offset:2048
1534 ; GFX11-NEXT: s_waitcnt vmcnt(2)
1535 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v6, v2
1536 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v7, v3, vcc_lo
1537 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1538 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1539 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v0, v2
1540 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v1, v3, vcc_lo
1541 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1542 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v4, v0
1543 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v5, v1, vcc_lo
1544 ; GFX11-NEXT: global_store_b64 v8, v[0:1], s[34:35]
1545 ; GFX11-NEXT: s_nop 0
1546 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1547 ; GFX11-NEXT: s_endpgm
1549 %call = tail call i64 @_Z13get_global_idj(i32 0)
1550 %conv = and i64 %call, 255
1551 %a0 = shl i64 %call, 7
1552 %idx.ext11 = and i64 %a0, 4294934528
1553 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
1555 %addr1 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 %conv
1556 %load1 = load i64, ptr addrspace(1) %addr1, align 8
1558 %addr2 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 536870400
1559 %load2 = load i64, ptr addrspace(1) %addr2, align 8
1561 %add1 = add i64 %load2, %load1
1563 %addr3 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 536870656
1564 %load3 = load i64, ptr addrspace(1) %addr3, align 8
1566 %add2 = add i64 %load3, %add1
1568 %addr4 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 536870912
1569 %load4 = load i64, ptr addrspace(1) %addr4, align 8
1570 %add4 = add i64 %load4, %add2
1572 store i64 %add4, ptr addrspace(1) %add.ptr12, align 8
1576 ; TODO: Support load4 as anchor instruction.
1577 define amdgpu_kernel void @p32Offset64(ptr addrspace(1) %buffer) {
1578 ; GFX8-LABEL: p32Offset64:
1579 ; GFX8: ; %bb.0: ; %entry
1580 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1581 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1582 ; GFX8-NEXT: s_mov_b32 s38, -1
1583 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
1584 ; GFX8-NEXT: s_add_u32 s36, s36, s3
1585 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
1586 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
1587 ; GFX8-NEXT: s_getpc_b64 s[0:1]
1588 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1589 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1590 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1591 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
1592 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
1593 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
1594 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
1595 ; GFX8-NEXT: s_mov_b32 s32, 0
1596 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1597 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
1598 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1599 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff8000, v1
1600 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
1601 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, s34, v1
1602 ; GFX8-NEXT: v_mov_b32_e32 v3, 2
1603 ; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc
1604 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1605 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v1, v0
1606 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v2, vcc
1607 ; GFX8-NEXT: s_mov_b32 s0, 0x7ffff800
1608 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, s0, v3
1609 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v4, vcc
1610 ; GFX8-NEXT: s_mov_b32 s0, 0x7ffffc00
1611 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, s0, v3
1612 ; GFX8-NEXT: v_addc_u32_e32 v8, vcc, 0, v4, vcc
1613 ; GFX8-NEXT: flat_load_dword v0, v[3:4]
1614 ; GFX8-NEXT: flat_load_dword v5, v[5:6]
1615 ; GFX8-NEXT: flat_load_dword v6, v[7:8]
1616 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x80000000, v3
1617 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v4, vcc
1618 ; GFX8-NEXT: flat_load_dword v3, v[3:4]
1619 ; GFX8-NEXT: s_waitcnt vmcnt(2)
1620 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v5, v0
1621 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1622 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v6, v0
1623 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1624 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v3, v0
1625 ; GFX8-NEXT: flat_store_dword v[1:2], v0
1626 ; GFX8-NEXT: s_endpgm
1628 ; GFX9-LABEL: p32Offset64:
1629 ; GFX9: ; %bb.0: ; %entry
1630 ; GFX9-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1631 ; GFX9-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1632 ; GFX9-NEXT: s_mov_b32 s38, -1
1633 ; GFX9-NEXT: s_mov_b32 s39, 0xe00000
1634 ; GFX9-NEXT: s_add_u32 s36, s36, s3
1635 ; GFX9-NEXT: s_addc_u32 s37, s37, 0
1636 ; GFX9-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
1637 ; GFX9-NEXT: s_getpc_b64 s[0:1]
1638 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1639 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1640 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1641 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37]
1642 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
1643 ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39]
1644 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
1645 ; GFX9-NEXT: s_mov_b32 s32, 0
1646 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
1647 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
1648 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1649 ; GFX9-NEXT: v_and_b32_e32 v6, 0xffff8000, v1
1650 ; GFX9-NEXT: v_mov_b32_e32 v1, s35
1651 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s34, v6
1652 ; GFX9-NEXT: v_mov_b32_e32 v3, 2
1653 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1654 ; GFX9-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1655 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v2, v0
1656 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
1657 ; GFX9-NEXT: s_mov_b32 s0, 0x7ffff000
1658 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s0, v0
1659 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v1, vcc
1660 ; GFX9-NEXT: v_add_co_u32_e32 v4, vcc, 0x80000000, v0
1661 ; GFX9-NEXT: v_addc_co_u32_e32 v5, vcc, 0, v1, vcc
1662 ; GFX9-NEXT: global_load_dword v7, v[0:1], off
1663 ; GFX9-NEXT: global_load_dword v8, v[2:3], off offset:2048
1664 ; GFX9-NEXT: global_load_dword v9, v[2:3], off offset:3072
1665 ; GFX9-NEXT: global_load_dword v10, v[4:5], off
1666 ; GFX9-NEXT: s_waitcnt vmcnt(2)
1667 ; GFX9-NEXT: v_add_u32_e32 v0, v8, v7
1668 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1669 ; GFX9-NEXT: v_add3_u32 v0, v9, v0, v10
1670 ; GFX9-NEXT: global_store_dword v6, v0, s[34:35]
1671 ; GFX9-NEXT: s_endpgm
1673 ; GFX10-LABEL: p32Offset64:
1674 ; GFX10: ; %bb.0: ; %entry
1675 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
1676 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
1677 ; GFX10-NEXT: s_mov_b32 s38, -1
1678 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
1679 ; GFX10-NEXT: s_add_u32 s36, s36, s3
1680 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
1681 ; GFX10-NEXT: s_getpc_b64 s[2:3]
1682 ; GFX10-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
1683 ; GFX10-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
1684 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
1685 ; GFX10-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
1686 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
1687 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
1688 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
1689 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
1690 ; GFX10-NEXT: s_mov_b32 s32, 0
1691 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1692 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[4:5]
1693 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1694 ; GFX10-NEXT: v_mov_b32_e32 v2, 2
1695 ; GFX10-NEXT: v_and_b32_e32 v4, 0xffff8000, v1
1696 ; GFX10-NEXT: v_lshlrev_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
1697 ; GFX10-NEXT: v_add_co_u32 v1, s0, s34, v4
1698 ; GFX10-NEXT: v_add_co_ci_u32_e64 v2, s0, s35, 0, s0
1699 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
1700 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
1701 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v0, 0x80000000
1702 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
1703 ; GFX10-NEXT: global_load_dword v5, v[0:1], off
1704 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x7ffff800, v0
1705 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
1706 ; GFX10-NEXT: s_clause 0x2
1707 ; GFX10-NEXT: global_load_dword v6, v[2:3], off offset:-2048
1708 ; GFX10-NEXT: global_load_dword v7, v[2:3], off
1709 ; GFX10-NEXT: global_load_dword v8, v[0:1], off offset:1024
1710 ; GFX10-NEXT: s_waitcnt vmcnt(2)
1711 ; GFX10-NEXT: v_add_nc_u32_e32 v0, v6, v5
1712 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1713 ; GFX10-NEXT: v_add3_u32 v0, v8, v0, v7
1714 ; GFX10-NEXT: global_store_dword v4, v0, s[34:35]
1715 ; GFX10-NEXT: s_endpgm
1717 ; GFX11-LABEL: p32Offset64:
1718 ; GFX11: ; %bb.0: ; %entry
1719 ; GFX11-NEXT: s_getpc_b64 s[2:3]
1720 ; GFX11-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
1721 ; GFX11-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
1722 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
1723 ; GFX11-NEXT: s_load_b64 s[2:3], s[2:3], 0x0
1724 ; GFX11-NEXT: s_load_b64 s[34:35], s[0:1], 0x24
1725 ; GFX11-NEXT: s_mov_b32 s32, 0
1726 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1727 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[2:3]
1728 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 7, v0
1729 ; GFX11-NEXT: v_and_b32_e32 v0, 0xff, v0
1730 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1731 ; GFX11-NEXT: v_and_b32_e32 v6, 0xffff8000, v1
1732 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 2, v0
1733 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
1734 ; GFX11-NEXT: v_add_co_u32 v1, s0, s34, v6
1735 ; GFX11-NEXT: v_add_co_ci_u32_e64 v2, null, s35, 0, s0
1736 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1737 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
1738 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
1739 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
1740 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, 0x7ffff000, v0
1741 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
1742 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0x80000000, v0
1743 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
1744 ; GFX11-NEXT: s_clause 0x3
1745 ; GFX11-NEXT: global_load_b32 v0, v[0:1], off
1746 ; GFX11-NEXT: global_load_b32 v1, v[2:3], off offset:2048
1747 ; GFX11-NEXT: global_load_b32 v2, v[2:3], off offset:3072
1748 ; GFX11-NEXT: global_load_b32 v3, v[4:5], off
1749 ; GFX11-NEXT: s_waitcnt vmcnt(2)
1750 ; GFX11-NEXT: v_add_nc_u32_e32 v0, v1, v0
1751 ; GFX11-NEXT: s_waitcnt vmcnt(0)
1752 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1)
1753 ; GFX11-NEXT: v_add3_u32 v0, v2, v0, v3
1754 ; GFX11-NEXT: global_store_b32 v6, v0, s[34:35]
1755 ; GFX11-NEXT: s_nop 0
1756 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
1757 ; GFX11-NEXT: s_endpgm
1759 %call = tail call i64 @_Z13get_global_idj(i32 0)
1760 %conv = and i64 %call, 255
1761 %a0 = shl i64 %call, 7
1762 %idx.ext11 = and i64 %a0, 4294934528
1763 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
1765 %addr1 = getelementptr inbounds i32, ptr addrspace(1) %add.ptr12, i64 %conv
1766 %load1 = load i32, ptr addrspace(1) %addr1, align 8
1768 %addr2 = getelementptr inbounds i32, ptr addrspace(1) %addr1, i64 536870400
1769 %load2 = load i32, ptr addrspace(1) %addr2, align 8
1771 %add1 = add i32 %load2, %load1
1773 %addr3 = getelementptr inbounds i32, ptr addrspace(1) %addr1, i64 536870656
1774 %load3 = load i32, ptr addrspace(1) %addr3, align 8
1776 %add2 = add i32 %load3, %add1
1778 %addr4 = getelementptr inbounds i32, ptr addrspace(1) %addr1, i64 536870912
1779 %load4 = load i32, ptr addrspace(1) %addr4, align 8
1780 %add4 = add i32 %load4, %add2
1782 store i32 %add4, ptr addrspace(1) %add.ptr12, align 8
1786 define amdgpu_kernel void @DiffBase(ptr addrspace(1) %buffer1,
1787 ; GFX8-LABEL: DiffBase:
1788 ; GFX8: ; %bb.0: ; %entry
1789 ; GFX8-NEXT: s_mov_b32 s40, SCRATCH_RSRC_DWORD0
1790 ; GFX8-NEXT: s_mov_b32 s41, SCRATCH_RSRC_DWORD1
1791 ; GFX8-NEXT: s_mov_b32 s42, -1
1792 ; GFX8-NEXT: s_mov_b32 s43, 0xe80000
1793 ; GFX8-NEXT: s_add_u32 s40, s40, s3
1794 ; GFX8-NEXT: s_addc_u32 s41, s41, 0
1795 ; GFX8-NEXT: s_load_dwordx4 s[36:39], s[0:1], 0x24
1796 ; GFX8-NEXT: s_getpc_b64 s[0:1]
1797 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1798 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1799 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1800 ; GFX8-NEXT: s_mov_b64 s[0:1], s[40:41]
1801 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
1802 ; GFX8-NEXT: s_mov_b64 s[2:3], s[42:43]
1803 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
1804 ; GFX8-NEXT: s_mov_b32 s32, 0
1805 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
1806 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
1807 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 7, v0
1808 ; GFX8-NEXT: v_and_b32_e32 v2, 0xffff8000, v0
1809 ; GFX8-NEXT: v_mov_b32_e32 v1, s37
1810 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, s36, v2
1811 ; GFX8-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc
1812 ; GFX8-NEXT: v_mov_b32_e32 v3, s39
1813 ; GFX8-NEXT: v_add_u32_e32 v12, vcc, s38, v2
1814 ; GFX8-NEXT: v_addc_u32_e32 v13, vcc, 0, v3, vcc
1815 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, 0x1000, v0
1816 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, 0, v1, vcc
1817 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, 0x1800, v0
1818 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, 0, v1, vcc
1819 ; GFX8-NEXT: v_add_u32_e32 v6, vcc, 0x2000, v0
1820 ; GFX8-NEXT: v_addc_u32_e32 v7, vcc, 0, v1, vcc
1821 ; GFX8-NEXT: v_add_u32_e32 v8, vcc, 0x2800, v12
1822 ; GFX8-NEXT: flat_load_dwordx2 v[2:3], v[2:3]
1823 ; GFX8-NEXT: flat_load_dwordx2 v[4:5], v[4:5]
1824 ; GFX8-NEXT: flat_load_dwordx2 v[6:7], v[6:7]
1825 ; GFX8-NEXT: v_addc_u32_e32 v9, vcc, 0, v13, vcc
1826 ; GFX8-NEXT: v_add_u32_e32 v10, vcc, 0x3000, v12
1827 ; GFX8-NEXT: v_addc_u32_e32 v11, vcc, 0, v13, vcc
1828 ; GFX8-NEXT: flat_load_dwordx2 v[8:9], v[8:9]
1829 ; GFX8-NEXT: flat_load_dwordx2 v[10:11], v[10:11]
1830 ; GFX8-NEXT: v_add_u32_e32 v12, vcc, 0x3800, v12
1831 ; GFX8-NEXT: v_addc_u32_e32 v13, vcc, 0, v13, vcc
1832 ; GFX8-NEXT: flat_load_dwordx2 v[12:13], v[12:13]
1833 ; GFX8-NEXT: s_waitcnt vmcnt(4)
1834 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v4, v2
1835 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v5, v3, vcc
1836 ; GFX8-NEXT: s_waitcnt vmcnt(3)
1837 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v6, v2
1838 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v7, v3, vcc
1839 ; GFX8-NEXT: s_waitcnt vmcnt(1)
1840 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, v10, v8
1841 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v11, v9, vcc
1842 ; GFX8-NEXT: s_waitcnt vmcnt(0)
1843 ; GFX8-NEXT: v_add_u32_e32 v4, vcc, v12, v4
1844 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v13, v5, vcc
1845 ; GFX8-NEXT: v_add_u32_e32 v2, vcc, v2, v4
1846 ; GFX8-NEXT: v_addc_u32_e32 v3, vcc, v3, v5, vcc
1847 ; GFX8-NEXT: flat_store_dwordx2 v[0:1], v[2:3]
1848 ; GFX8-NEXT: s_endpgm
1850 ; GFX9-LABEL: DiffBase:
1851 ; GFX9: ; %bb.0: ; %entry
1852 ; GFX9-NEXT: s_mov_b32 s40, SCRATCH_RSRC_DWORD0
1853 ; GFX9-NEXT: s_mov_b32 s41, SCRATCH_RSRC_DWORD1
1854 ; GFX9-NEXT: s_mov_b32 s42, -1
1855 ; GFX9-NEXT: s_mov_b32 s43, 0xe00000
1856 ; GFX9-NEXT: s_add_u32 s40, s40, s3
1857 ; GFX9-NEXT: s_addc_u32 s41, s41, 0
1858 ; GFX9-NEXT: s_load_dwordx4 s[36:39], s[0:1], 0x24
1859 ; GFX9-NEXT: s_getpc_b64 s[0:1]
1860 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
1861 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
1862 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
1863 ; GFX9-NEXT: s_mov_b64 s[0:1], s[40:41]
1864 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
1865 ; GFX9-NEXT: s_mov_b64 s[2:3], s[42:43]
1866 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
1867 ; GFX9-NEXT: s_mov_b32 s32, 0
1868 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
1869 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
1870 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 7, v0
1871 ; GFX9-NEXT: v_and_b32_e32 v16, 0xffff8000, v0
1872 ; GFX9-NEXT: v_mov_b32_e32 v0, s37
1873 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s36, v16
1874 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v0, vcc
1875 ; GFX9-NEXT: v_mov_b32_e32 v0, s39
1876 ; GFX9-NEXT: v_add_co_u32_e32 v10, vcc, s38, v16
1877 ; GFX9-NEXT: v_addc_co_u32_e32 v11, vcc, 0, v0, vcc
1878 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, 0x1000, v2
1879 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v3, vcc
1880 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, 0x2000, v2
1881 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v3, vcc
1882 ; GFX9-NEXT: global_load_dwordx2 v[4:5], v[0:1], off
1883 ; GFX9-NEXT: global_load_dwordx2 v[6:7], v[0:1], off offset:2048
1884 ; GFX9-NEXT: global_load_dwordx2 v[8:9], v[2:3], off
1885 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, 0x2000, v10
1886 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v11, vcc
1887 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, 0x3000, v10
1888 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v11, vcc
1889 ; GFX9-NEXT: global_load_dwordx2 v[10:11], v[0:1], off offset:2048
1890 ; GFX9-NEXT: global_load_dwordx2 v[12:13], v[2:3], off
1891 ; GFX9-NEXT: global_load_dwordx2 v[14:15], v[2:3], off offset:2048
1892 ; GFX9-NEXT: s_waitcnt vmcnt(4)
1893 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v6, v4
1894 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v7, v5, vcc
1895 ; GFX9-NEXT: s_waitcnt vmcnt(3)
1896 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v8, v0
1897 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v9, v1, vcc
1898 ; GFX9-NEXT: s_waitcnt vmcnt(1)
1899 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, v12, v10
1900 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, v13, v11, vcc
1901 ; GFX9-NEXT: s_waitcnt vmcnt(0)
1902 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, v14, v2
1903 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, v15, v3, vcc
1904 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v0, v2
1905 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v1, v3, vcc
1906 ; GFX9-NEXT: global_store_dwordx2 v16, v[0:1], s[36:37]
1907 ; GFX9-NEXT: s_endpgm
1909 ; GFX10-LABEL: DiffBase:
1910 ; GFX10: ; %bb.0: ; %entry
1911 ; GFX10-NEXT: s_mov_b32 s40, SCRATCH_RSRC_DWORD0
1912 ; GFX10-NEXT: s_mov_b32 s41, SCRATCH_RSRC_DWORD1
1913 ; GFX10-NEXT: s_mov_b32 s42, -1
1914 ; GFX10-NEXT: s_mov_b32 s43, 0x31c16000
1915 ; GFX10-NEXT: s_add_u32 s40, s40, s3
1916 ; GFX10-NEXT: s_addc_u32 s41, s41, 0
1917 ; GFX10-NEXT: s_getpc_b64 s[2:3]
1918 ; GFX10-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
1919 ; GFX10-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
1920 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
1921 ; GFX10-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
1922 ; GFX10-NEXT: s_load_dwordx4 s[36:39], s[0:1], 0x24
1923 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
1924 ; GFX10-NEXT: s_mov_b64 s[0:1], s[40:41]
1925 ; GFX10-NEXT: s_mov_b64 s[2:3], s[42:43]
1926 ; GFX10-NEXT: s_mov_b32 s32, 0
1927 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
1928 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[4:5]
1929 ; GFX10-NEXT: v_lshlrev_b32_e32 v0, 7, v0
1930 ; GFX10-NEXT: v_and_b32_e32 v16, 0xffff8000, v0
1931 ; GFX10-NEXT: v_add_co_u32 v8, s0, s36, v16
1932 ; GFX10-NEXT: v_add_co_ci_u32_e64 v9, s0, s37, 0, s0
1933 ; GFX10-NEXT: v_add_co_u32 v12, s0, s38, v16
1934 ; GFX10-NEXT: v_add_co_ci_u32_e64 v13, s0, s39, 0, s0
1935 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v8, 0x1800
1936 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v9, vcc_lo
1937 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v12, 0x3000
1938 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v13, vcc_lo
1939 ; GFX10-NEXT: s_clause 0x1
1940 ; GFX10-NEXT: global_load_dwordx2 v[4:5], v[0:1], off offset:-2048
1941 ; GFX10-NEXT: global_load_dwordx2 v[6:7], v[0:1], off
1942 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x2000, v8
1943 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v9, vcc_lo
1944 ; GFX10-NEXT: s_clause 0x1
1945 ; GFX10-NEXT: global_load_dwordx2 v[8:9], v[2:3], off offset:-2048
1946 ; GFX10-NEXT: global_load_dwordx2 v[10:11], v[2:3], off
1947 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, 0x3800, v12
1948 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v13, vcc_lo
1949 ; GFX10-NEXT: global_load_dwordx2 v[12:13], v[0:1], off
1950 ; GFX10-NEXT: global_load_dwordx2 v[14:15], v[2:3], off
1951 ; GFX10-NEXT: s_waitcnt vmcnt(4)
1952 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v6, v4
1953 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v7, v5, vcc_lo
1954 ; GFX10-NEXT: s_waitcnt vmcnt(2)
1955 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v10, v8
1956 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v11, v9, vcc_lo
1957 ; GFX10-NEXT: s_waitcnt vmcnt(1)
1958 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v12, v0
1959 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v13, v1, vcc_lo
1960 ; GFX10-NEXT: s_waitcnt vmcnt(0)
1961 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, v14, v2
1962 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v15, v3, vcc_lo
1963 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v0, v2
1964 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v1, v3, vcc_lo
1965 ; GFX10-NEXT: global_store_dwordx2 v16, v[0:1], s[36:37]
1966 ; GFX10-NEXT: s_endpgm
1968 ; GFX11-LABEL: DiffBase:
1969 ; GFX11: ; %bb.0: ; %entry
1970 ; GFX11-NEXT: s_getpc_b64 s[2:3]
1971 ; GFX11-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
1972 ; GFX11-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
1973 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
1974 ; GFX11-NEXT: s_load_b64 s[2:3], s[2:3], 0x0
1975 ; GFX11-NEXT: s_load_b128 s[36:39], s[0:1], 0x24
1976 ; GFX11-NEXT: s_mov_b32 s32, 0
1977 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
1978 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[2:3]
1979 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 7, v0
1980 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
1981 ; GFX11-NEXT: v_and_b32_e32 v12, 0xffff8000, v0
1982 ; GFX11-NEXT: v_add_co_u32 v2, s0, s36, v12
1983 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_3)
1984 ; GFX11-NEXT: v_add_co_ci_u32_e64 v3, null, s37, 0, s0
1985 ; GFX11-NEXT: v_add_co_u32 v8, s0, s38, v12
1986 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0x1000, v2
1987 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(SKIP_4) | instid1(VALU_DEP_4)
1988 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v3, vcc_lo
1989 ; GFX11-NEXT: v_add_co_ci_u32_e64 v9, null, s39, 0, s0
1990 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v2, 0x2000
1991 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v3, vcc_lo
1992 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, 0x2000, v8
1993 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v9, vcc_lo
1994 ; GFX11-NEXT: v_add_co_u32 v8, vcc_lo, 0x3000, v8
1995 ; GFX11-NEXT: global_load_b64 v[6:7], v[2:3], off offset:-4096
1996 ; GFX11-NEXT: v_add_co_ci_u32_e32 v9, vcc_lo, 0, v9, vcc_lo
1997 ; GFX11-NEXT: global_load_b64 v[0:1], v[0:1], off offset:2048
1998 ; GFX11-NEXT: s_clause 0x1
1999 ; GFX11-NEXT: global_load_b64 v[4:5], v[4:5], off offset:2048
2000 ; GFX11-NEXT: global_load_b64 v[10:11], v[8:9], off
2001 ; GFX11-NEXT: global_load_b64 v[2:3], v[2:3], off
2002 ; GFX11-NEXT: global_load_b64 v[8:9], v[8:9], off offset:2048
2003 ; GFX11-NEXT: s_waitcnt vmcnt(4)
2004 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v0, v6
2005 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v1, v7, vcc_lo
2006 ; GFX11-NEXT: s_waitcnt vmcnt(2)
2007 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, v10, v4
2008 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, v11, v5, vcc_lo
2009 ; GFX11-NEXT: s_waitcnt vmcnt(1)
2010 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v2, v0
2011 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v3, v1, vcc_lo
2012 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2013 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v8, v4
2014 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v9, v5, vcc_lo
2015 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2016 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v0, v2
2017 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v1, v3, vcc_lo
2018 ; GFX11-NEXT: global_store_b64 v12, v[0:1], s[36:37]
2019 ; GFX11-NEXT: s_nop 0
2020 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2021 ; GFX11-NEXT: s_endpgm
2022 ptr addrspace(1) %buffer2) {
2024 %call = tail call i64 @_Z13get_global_idj(i32 0)
2025 %conv = and i64 %call, 255
2026 %a0 = shl i64 %call, 7
2027 %idx.ext11 = and i64 %a0, 4294934528
2028 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer1, i64 %idx.ext11
2030 %add.ptr2 = getelementptr inbounds i8, ptr addrspace(1) %buffer2, i64 %idx.ext11
2032 %addr1 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 512
2033 %load1 = load i64, ptr addrspace(1) %addr1, align 8
2034 %add.ptr8.3 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 768
2035 %load2 = load i64, ptr addrspace(1) %add.ptr8.3, align 8
2036 %add1 = add i64 %load2, %load1
2037 %add.ptr8.4 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 1024
2038 %load3 = load i64, ptr addrspace(1) %add.ptr8.4, align 8
2039 %add2 = add i64 %load3, %add1
2041 %add.ptr8.5 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr2, i64 1280
2042 %load4 = load i64, ptr addrspace(1) %add.ptr8.5, align 8
2044 %add.ptr8.6 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr2, i64 1536
2045 %load5 = load i64, ptr addrspace(1) %add.ptr8.6, align 8
2046 %add3 = add i64 %load5, %load4
2048 %add.ptr8.7 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr2, i64 1792
2049 %load6 = load i64, ptr addrspace(1) %add.ptr8.7, align 8
2050 %add4 = add i64 %load6, %add3
2052 %add5 = add i64 %add2, %add4
2054 store i64 %add5, ptr addrspace(1) %add.ptr12, align 8
2058 define amdgpu_kernel void @ReverseOrder(ptr addrspace(1) %buffer) {
2059 ; GFX8-LABEL: ReverseOrder:
2060 ; GFX8: ; %bb.0: ; %entry
2061 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
2062 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
2063 ; GFX8-NEXT: s_mov_b32 s38, -1
2064 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
2065 ; GFX8-NEXT: s_add_u32 s36, s36, s3
2066 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
2067 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
2068 ; GFX8-NEXT: s_getpc_b64 s[0:1]
2069 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
2070 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
2071 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
2072 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
2073 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
2074 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
2075 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
2076 ; GFX8-NEXT: s_mov_b32 s32, 0
2077 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2078 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
2079 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2080 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff8000, v1
2081 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
2082 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, s34, v1
2083 ; GFX8-NEXT: v_mov_b32_e32 v3, 3
2084 ; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc
2085 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
2086 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v1, v0
2087 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v2, vcc
2088 ; GFX8-NEXT: s_movk_i32 s0, 0x3800
2089 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, s0, v3
2090 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v4, vcc
2091 ; GFX8-NEXT: s_movk_i32 s0, 0x3000
2092 ; GFX8-NEXT: v_add_u32_e32 v7, vcc, s0, v3
2093 ; GFX8-NEXT: v_addc_u32_e32 v8, vcc, 0, v4, vcc
2094 ; GFX8-NEXT: s_movk_i32 s0, 0x2800
2095 ; GFX8-NEXT: v_add_u32_e32 v9, vcc, s0, v3
2096 ; GFX8-NEXT: v_addc_u32_e32 v10, vcc, 0, v4, vcc
2097 ; GFX8-NEXT: flat_load_dwordx2 v[11:12], v[3:4]
2098 ; GFX8-NEXT: flat_load_dwordx2 v[5:6], v[5:6]
2099 ; GFX8-NEXT: flat_load_dwordx2 v[7:8], v[7:8]
2100 ; GFX8-NEXT: flat_load_dwordx2 v[9:10], v[9:10]
2101 ; GFX8-NEXT: s_movk_i32 s0, 0x2000
2102 ; GFX8-NEXT: v_add_u32_e32 v13, vcc, s0, v3
2103 ; GFX8-NEXT: v_addc_u32_e32 v14, vcc, 0, v4, vcc
2104 ; GFX8-NEXT: s_movk_i32 s0, 0x1800
2105 ; GFX8-NEXT: v_add_u32_e32 v15, vcc, s0, v3
2106 ; GFX8-NEXT: v_addc_u32_e32 v16, vcc, 0, v4, vcc
2107 ; GFX8-NEXT: flat_load_dwordx2 v[13:14], v[13:14]
2108 ; GFX8-NEXT: flat_load_dwordx2 v[15:16], v[15:16]
2109 ; GFX8-NEXT: s_movk_i32 s0, 0x1000
2110 ; GFX8-NEXT: v_add_u32_e32 v17, vcc, s0, v3
2111 ; GFX8-NEXT: v_addc_u32_e32 v18, vcc, 0, v4, vcc
2112 ; GFX8-NEXT: flat_load_dwordx2 v[17:18], v[17:18]
2113 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, 0x800, v3
2114 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, 0, v4, vcc
2115 ; GFX8-NEXT: flat_load_dwordx2 v[3:4], v[3:4]
2116 ; GFX8-NEXT: s_waitcnt vmcnt(6)
2117 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v5, v11
2118 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v6, v12, vcc
2119 ; GFX8-NEXT: s_waitcnt vmcnt(5)
2120 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v7, v0
2121 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v8, v5, vcc
2122 ; GFX8-NEXT: s_waitcnt vmcnt(4)
2123 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v9, v0
2124 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v10, v5, vcc
2125 ; GFX8-NEXT: s_waitcnt vmcnt(3)
2126 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v13, v0
2127 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v14, v5, vcc
2128 ; GFX8-NEXT: s_waitcnt vmcnt(2)
2129 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v15, v0
2130 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v16, v5, vcc
2131 ; GFX8-NEXT: s_waitcnt vmcnt(1)
2132 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v17, v0
2133 ; GFX8-NEXT: v_addc_u32_e32 v5, vcc, v18, v5, vcc
2134 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2135 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v3, v0
2136 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v4, v5, vcc
2137 ; GFX8-NEXT: flat_store_dwordx2 v[1:2], v[3:4]
2138 ; GFX8-NEXT: s_endpgm
2140 ; GFX9-LABEL: ReverseOrder:
2141 ; GFX9: ; %bb.0: ; %entry
2142 ; GFX9-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
2143 ; GFX9-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
2144 ; GFX9-NEXT: s_mov_b32 s38, -1
2145 ; GFX9-NEXT: s_mov_b32 s39, 0xe00000
2146 ; GFX9-NEXT: s_add_u32 s36, s36, s3
2147 ; GFX9-NEXT: s_addc_u32 s37, s37, 0
2148 ; GFX9-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
2149 ; GFX9-NEXT: s_getpc_b64 s[0:1]
2150 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
2151 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
2152 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
2153 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37]
2154 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
2155 ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39]
2156 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
2157 ; GFX9-NEXT: s_mov_b32 s32, 0
2158 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
2159 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
2160 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2161 ; GFX9-NEXT: v_and_b32_e32 v22, 0xffff8000, v1
2162 ; GFX9-NEXT: v_mov_b32_e32 v1, s35
2163 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s34, v22
2164 ; GFX9-NEXT: v_mov_b32_e32 v3, 3
2165 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
2166 ; GFX9-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
2167 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v2, v0
2168 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
2169 ; GFX9-NEXT: s_movk_i32 s0, 0x3000
2170 ; GFX9-NEXT: v_add_co_u32_e32 v4, vcc, s0, v0
2171 ; GFX9-NEXT: global_load_dwordx2 v[2:3], v[0:1], off
2172 ; GFX9-NEXT: v_addc_co_u32_e32 v5, vcc, 0, v1, vcc
2173 ; GFX9-NEXT: global_load_dwordx2 v[6:7], v[4:5], off offset:2048
2174 ; GFX9-NEXT: global_load_dwordx2 v[8:9], v[4:5], off
2175 ; GFX9-NEXT: s_movk_i32 s0, 0x2000
2176 ; GFX9-NEXT: v_add_co_u32_e32 v4, vcc, s0, v0
2177 ; GFX9-NEXT: v_addc_co_u32_e32 v5, vcc, 0, v1, vcc
2178 ; GFX9-NEXT: global_load_dwordx2 v[10:11], v[4:5], off offset:2048
2179 ; GFX9-NEXT: s_movk_i32 s0, 0x1000
2180 ; GFX9-NEXT: v_add_co_u32_e32 v12, vcc, s0, v0
2181 ; GFX9-NEXT: v_addc_co_u32_e32 v13, vcc, 0, v1, vcc
2182 ; GFX9-NEXT: global_load_dwordx2 v[14:15], v[12:13], off
2183 ; GFX9-NEXT: global_load_dwordx2 v[16:17], v[4:5], off
2184 ; GFX9-NEXT: global_load_dwordx2 v[18:19], v[12:13], off offset:2048
2185 ; GFX9-NEXT: global_load_dwordx2 v[20:21], v[0:1], off offset:2048
2186 ; GFX9-NEXT: s_waitcnt vmcnt(6)
2187 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v6, v2
2188 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v7, v3, vcc
2189 ; GFX9-NEXT: s_waitcnt vmcnt(5)
2190 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v8, v0
2191 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v9, v1, vcc
2192 ; GFX9-NEXT: s_waitcnt vmcnt(4)
2193 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v10, v0
2194 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v11, v1, vcc
2195 ; GFX9-NEXT: s_waitcnt vmcnt(2)
2196 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v16, v0
2197 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v17, v1, vcc
2198 ; GFX9-NEXT: s_waitcnt vmcnt(1)
2199 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v18, v0
2200 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v19, v1, vcc
2201 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v14, v0
2202 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v15, v1, vcc
2203 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2204 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v20, v0
2205 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v21, v1, vcc
2206 ; GFX9-NEXT: global_store_dwordx2 v22, v[0:1], s[34:35]
2207 ; GFX9-NEXT: s_endpgm
2209 ; GFX10-LABEL: ReverseOrder:
2210 ; GFX10: ; %bb.0: ; %entry
2211 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
2212 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
2213 ; GFX10-NEXT: s_mov_b32 s38, -1
2214 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
2215 ; GFX10-NEXT: s_add_u32 s36, s36, s3
2216 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
2217 ; GFX10-NEXT: s_getpc_b64 s[2:3]
2218 ; GFX10-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
2219 ; GFX10-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
2220 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
2221 ; GFX10-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
2222 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
2223 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
2224 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
2225 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
2226 ; GFX10-NEXT: s_mov_b32 s32, 0
2227 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
2228 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[4:5]
2229 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2230 ; GFX10-NEXT: v_mov_b32_e32 v2, 3
2231 ; GFX10-NEXT: v_and_b32_e32 v20, 0xffff8000, v1
2232 ; GFX10-NEXT: v_lshlrev_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
2233 ; GFX10-NEXT: v_add_co_u32 v1, s0, s34, v20
2234 ; GFX10-NEXT: v_add_co_ci_u32_e64 v2, s0, s35, 0, s0
2235 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
2236 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
2237 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, 0x3800, v0
2238 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
2239 ; GFX10-NEXT: v_add_co_u32 v4, vcc_lo, 0x3000, v0
2240 ; GFX10-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v1, vcc_lo
2241 ; GFX10-NEXT: s_clause 0x1
2242 ; GFX10-NEXT: global_load_dwordx2 v[6:7], v[0:1], off
2243 ; GFX10-NEXT: global_load_dwordx2 v[8:9], v[2:3], off
2244 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, 0x2800, v0
2245 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
2246 ; GFX10-NEXT: v_add_co_u32 v10, vcc_lo, 0x2000, v0
2247 ; GFX10-NEXT: v_add_co_ci_u32_e32 v11, vcc_lo, 0, v1, vcc_lo
2248 ; GFX10-NEXT: v_add_co_u32 v12, vcc_lo, 0x1800, v0
2249 ; GFX10-NEXT: s_clause 0x1
2250 ; GFX10-NEXT: global_load_dwordx2 v[4:5], v[4:5], off
2251 ; GFX10-NEXT: global_load_dwordx2 v[10:11], v[10:11], off
2252 ; GFX10-NEXT: v_add_co_ci_u32_e32 v13, vcc_lo, 0, v1, vcc_lo
2253 ; GFX10-NEXT: v_add_co_u32 v14, vcc_lo, 0x1000, v0
2254 ; GFX10-NEXT: v_add_co_ci_u32_e32 v15, vcc_lo, 0, v1, vcc_lo
2255 ; GFX10-NEXT: s_clause 0x1
2256 ; GFX10-NEXT: global_load_dwordx2 v[12:13], v[12:13], off
2257 ; GFX10-NEXT: global_load_dwordx2 v[2:3], v[2:3], off
2258 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x800, v0
2259 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v1, vcc_lo
2260 ; GFX10-NEXT: s_clause 0x1
2261 ; GFX10-NEXT: global_load_dwordx2 v[16:17], v[14:15], off
2262 ; GFX10-NEXT: global_load_dwordx2 v[18:19], v[0:1], off
2263 ; GFX10-NEXT: s_waitcnt vmcnt(6)
2264 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v8, v6
2265 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v9, v7, vcc_lo
2266 ; GFX10-NEXT: s_waitcnt vmcnt(5)
2267 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v4, v0
2268 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v5, v1, vcc_lo
2269 ; GFX10-NEXT: s_waitcnt vmcnt(2)
2270 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v2, v0
2271 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v3, v1, vcc_lo
2272 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v10, v0
2273 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v11, v1, vcc_lo
2274 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v12, v0
2275 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v13, v1, vcc_lo
2276 ; GFX10-NEXT: s_waitcnt vmcnt(1)
2277 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v16, v0
2278 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v17, v1, vcc_lo
2279 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2280 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v18, v0
2281 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v19, v1, vcc_lo
2282 ; GFX10-NEXT: global_store_dwordx2 v20, v[0:1], s[34:35]
2283 ; GFX10-NEXT: s_endpgm
2285 ; GFX11-LABEL: ReverseOrder:
2286 ; GFX11: ; %bb.0: ; %entry
2287 ; GFX11-NEXT: s_getpc_b64 s[2:3]
2288 ; GFX11-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
2289 ; GFX11-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
2290 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
2291 ; GFX11-NEXT: s_load_b64 s[2:3], s[2:3], 0x0
2292 ; GFX11-NEXT: s_load_b64 s[34:35], s[0:1], 0x24
2293 ; GFX11-NEXT: s_mov_b32 s32, 0
2294 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2295 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[2:3]
2296 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2297 ; GFX11-NEXT: v_and_b32_e32 v0, 0xff, v0
2298 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2299 ; GFX11-NEXT: v_and_b32_e32 v16, 0xffff8000, v1
2300 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 3, v0
2301 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
2302 ; GFX11-NEXT: v_add_co_u32 v1, s0, s34, v16
2303 ; GFX11-NEXT: v_add_co_ci_u32_e64 v2, null, s35, 0, s0
2304 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2305 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v1, v0
2306 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, 0, v2, vcc_lo
2307 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2308 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, 0x3000, v0
2309 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, 0, v1, vcc_lo
2310 ; GFX11-NEXT: v_add_co_u32 v8, vcc_lo, 0x2000, v0
2311 ; GFX11-NEXT: s_clause 0x2
2312 ; GFX11-NEXT: global_load_b64 v[4:5], v[0:1], off
2313 ; GFX11-NEXT: global_load_b64 v[6:7], v[2:3], off offset:2048
2314 ; GFX11-NEXT: global_load_b64 v[2:3], v[2:3], off
2315 ; GFX11-NEXT: v_add_co_ci_u32_e32 v9, vcc_lo, 0, v1, vcc_lo
2316 ; GFX11-NEXT: v_add_co_u32 v10, vcc_lo, 0x1000, v0
2317 ; GFX11-NEXT: v_add_co_ci_u32_e32 v11, vcc_lo, 0, v1, vcc_lo
2318 ; GFX11-NEXT: s_clause 0x4
2319 ; GFX11-NEXT: global_load_b64 v[12:13], v[8:9], off offset:2048
2320 ; GFX11-NEXT: global_load_b64 v[14:15], v[10:11], off
2321 ; GFX11-NEXT: global_load_b64 v[8:9], v[8:9], off
2322 ; GFX11-NEXT: global_load_b64 v[10:11], v[10:11], off offset:2048
2323 ; GFX11-NEXT: global_load_b64 v[0:1], v[0:1], off offset:2048
2324 ; GFX11-NEXT: s_waitcnt vmcnt(6)
2325 ; GFX11-NEXT: v_add_co_u32 v4, vcc_lo, v6, v4
2326 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, v7, v5, vcc_lo
2327 ; GFX11-NEXT: s_waitcnt vmcnt(5)
2328 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2329 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v2, v4
2330 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v3, v5, vcc_lo
2331 ; GFX11-NEXT: s_waitcnt vmcnt(4)
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, v12, v2
2334 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v13, v3, vcc_lo
2335 ; GFX11-NEXT: s_waitcnt vmcnt(2)
2336 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2337 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v8, v2
2338 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v9, v3, vcc_lo
2339 ; GFX11-NEXT: s_waitcnt vmcnt(1)
2340 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2341 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v10, v2
2342 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v11, v3, vcc_lo
2343 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2344 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, v14, v2
2345 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, v15, v3, vcc_lo
2346 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2347 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2348 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v0, v2
2349 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v1, v3, vcc_lo
2350 ; GFX11-NEXT: global_store_b64 v16, v[0:1], s[34:35]
2351 ; GFX11-NEXT: s_nop 0
2352 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2353 ; GFX11-NEXT: s_endpgm
2355 %call = tail call i64 @_Z13get_global_idj(i32 0)
2356 %conv = and i64 %call, 255
2357 %a0 = shl i64 %call, 7
2358 %idx.ext11 = and i64 %a0, 4294934528
2359 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
2361 %addr1 = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 %conv
2362 %load1 = load i64, ptr addrspace(1) %addr1, align 8
2364 %add.ptr8.7 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1792
2365 %load8 = load i64, ptr addrspace(1) %add.ptr8.7, align 8
2366 %add7 = add i64 %load8, %load1
2368 %add.ptr8.6 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1536
2369 %load7 = load i64, ptr addrspace(1) %add.ptr8.6, align 8
2370 %add6 = add i64 %load7, %add7
2372 %add.ptr8.5 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1280
2373 %load6 = load i64, ptr addrspace(1) %add.ptr8.5, align 8
2374 %add5 = add i64 %load6, %add6
2376 %add.ptr8.4 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 1024
2377 %load5 = load i64, ptr addrspace(1) %add.ptr8.4, align 8
2378 %add4 = add i64 %load5, %add5
2380 %add.ptr8.3 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 768
2381 %load4 = load i64, ptr addrspace(1) %add.ptr8.3, align 8
2382 %add3 = add i64 %load4, %add4
2384 %add.ptr8.2 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 512
2385 %load3 = load i64, ptr addrspace(1) %add.ptr8.2, align 8
2386 %add2 = add i64 %load3, %add3
2388 %addr2 = getelementptr inbounds i64, ptr addrspace(1) %addr1, i64 256
2389 %load2 = load i64, ptr addrspace(1) %addr2, align 8
2390 %add1 = add i64 %load2, %add2
2392 store i64 %add1, ptr addrspace(1) %add.ptr12, align 8
2396 define hidden amdgpu_kernel void @negativeoffset(ptr addrspace(1) nocapture %buffer) {
2397 ; GFX8-LABEL: negativeoffset:
2398 ; GFX8: ; %bb.0: ; %entry
2399 ; GFX8-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
2400 ; GFX8-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
2401 ; GFX8-NEXT: s_mov_b32 s38, -1
2402 ; GFX8-NEXT: s_mov_b32 s39, 0xe80000
2403 ; GFX8-NEXT: s_add_u32 s36, s36, s3
2404 ; GFX8-NEXT: s_addc_u32 s37, s37, 0
2405 ; GFX8-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
2406 ; GFX8-NEXT: s_getpc_b64 s[0:1]
2407 ; GFX8-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
2408 ; GFX8-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
2409 ; GFX8-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
2410 ; GFX8-NEXT: s_mov_b64 s[0:1], s[36:37]
2411 ; GFX8-NEXT: v_mov_b32_e32 v31, v0
2412 ; GFX8-NEXT: s_mov_b64 s[2:3], s[38:39]
2413 ; GFX8-NEXT: v_mov_b32_e32 v0, 0
2414 ; GFX8-NEXT: s_mov_b32 s32, 0
2415 ; GFX8-NEXT: s_waitcnt lgkmcnt(0)
2416 ; GFX8-NEXT: s_swappc_b64 s[30:31], s[4:5]
2417 ; GFX8-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2418 ; GFX8-NEXT: v_and_b32_e32 v1, 0xffff8000, v1
2419 ; GFX8-NEXT: v_mov_b32_e32 v2, s35
2420 ; GFX8-NEXT: v_add_u32_e32 v1, vcc, s34, v1
2421 ; GFX8-NEXT: v_mov_b32_e32 v3, 3
2422 ; GFX8-NEXT: v_addc_u32_e32 v2, vcc, 0, v2, vcc
2423 ; GFX8-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
2424 ; GFX8-NEXT: v_add_u32_e32 v0, vcc, v1, v0
2425 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, 0, v2, vcc
2426 ; GFX8-NEXT: s_movk_i32 s0, 0x800
2427 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, s0, v0
2428 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, -1, v6, vcc
2429 ; GFX8-NEXT: v_add_u32_e32 v5, vcc, 0, v0
2430 ; GFX8-NEXT: v_addc_u32_e32 v6, vcc, -1, v6, vcc
2431 ; GFX8-NEXT: flat_load_dwordx2 v[3:4], v[3:4]
2432 ; GFX8-NEXT: flat_load_dwordx2 v[5:6], v[5:6]
2433 ; GFX8-NEXT: s_waitcnt vmcnt(0)
2434 ; GFX8-NEXT: v_add_u32_e32 v3, vcc, v5, v3
2435 ; GFX8-NEXT: v_addc_u32_e32 v4, vcc, v6, v4, vcc
2436 ; GFX8-NEXT: flat_store_dwordx2 v[1:2], v[3:4]
2437 ; GFX8-NEXT: s_endpgm
2439 ; GFX9-LABEL: negativeoffset:
2440 ; GFX9: ; %bb.0: ; %entry
2441 ; GFX9-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
2442 ; GFX9-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
2443 ; GFX9-NEXT: s_mov_b32 s38, -1
2444 ; GFX9-NEXT: s_mov_b32 s39, 0xe00000
2445 ; GFX9-NEXT: s_add_u32 s36, s36, s3
2446 ; GFX9-NEXT: s_addc_u32 s37, s37, 0
2447 ; GFX9-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
2448 ; GFX9-NEXT: s_getpc_b64 s[0:1]
2449 ; GFX9-NEXT: s_add_u32 s0, s0, _Z13get_global_idj@gotpcrel32@lo+4
2450 ; GFX9-NEXT: s_addc_u32 s1, s1, _Z13get_global_idj@gotpcrel32@hi+12
2451 ; GFX9-NEXT: s_load_dwordx2 s[4:5], s[0:1], 0x0
2452 ; GFX9-NEXT: s_mov_b64 s[0:1], s[36:37]
2453 ; GFX9-NEXT: v_mov_b32_e32 v31, v0
2454 ; GFX9-NEXT: s_mov_b64 s[2:3], s[38:39]
2455 ; GFX9-NEXT: v_mov_b32_e32 v0, 0
2456 ; GFX9-NEXT: s_mov_b32 s32, 0
2457 ; GFX9-NEXT: s_waitcnt lgkmcnt(0)
2458 ; GFX9-NEXT: s_swappc_b64 s[30:31], s[4:5]
2459 ; GFX9-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2460 ; GFX9-NEXT: v_and_b32_e32 v8, 0xffff8000, v1
2461 ; GFX9-NEXT: v_mov_b32_e32 v1, s35
2462 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, s34, v8
2463 ; GFX9-NEXT: v_mov_b32_e32 v3, 3
2464 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc
2465 ; GFX9-NEXT: v_lshlrev_b32_sdwa v0, v3, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
2466 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, v2, v0
2467 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, 0, v1, vcc
2468 ; GFX9-NEXT: s_movk_i32 s0, 0x1000
2469 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, s0, v2
2470 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, -1, v3, vcc
2471 ; GFX9-NEXT: v_add_co_u32_e32 v2, vcc, 0, v2
2472 ; GFX9-NEXT: v_addc_co_u32_e32 v3, vcc, -1, v3, vcc
2473 ; GFX9-NEXT: global_load_dwordx2 v[4:5], v[0:1], off offset:-2048
2474 ; GFX9-NEXT: global_load_dwordx2 v[6:7], v[2:3], off
2475 ; GFX9-NEXT: s_waitcnt vmcnt(0)
2476 ; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, v6, v4
2477 ; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, v7, v5, vcc
2478 ; GFX9-NEXT: global_store_dwordx2 v8, v[0:1], s[34:35]
2479 ; GFX9-NEXT: s_endpgm
2481 ; GFX10-LABEL: negativeoffset:
2482 ; GFX10: ; %bb.0: ; %entry
2483 ; GFX10-NEXT: s_mov_b32 s36, SCRATCH_RSRC_DWORD0
2484 ; GFX10-NEXT: s_mov_b32 s37, SCRATCH_RSRC_DWORD1
2485 ; GFX10-NEXT: s_mov_b32 s38, -1
2486 ; GFX10-NEXT: s_mov_b32 s39, 0x31c16000
2487 ; GFX10-NEXT: s_add_u32 s36, s36, s3
2488 ; GFX10-NEXT: s_addc_u32 s37, s37, 0
2489 ; GFX10-NEXT: s_getpc_b64 s[2:3]
2490 ; GFX10-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
2491 ; GFX10-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
2492 ; GFX10-NEXT: v_mov_b32_e32 v31, v0
2493 ; GFX10-NEXT: s_load_dwordx2 s[4:5], s[2:3], 0x0
2494 ; GFX10-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
2495 ; GFX10-NEXT: v_mov_b32_e32 v0, 0
2496 ; GFX10-NEXT: s_mov_b64 s[0:1], s[36:37]
2497 ; GFX10-NEXT: s_mov_b64 s[2:3], s[38:39]
2498 ; GFX10-NEXT: s_mov_b32 s32, 0
2499 ; GFX10-NEXT: s_waitcnt lgkmcnt(0)
2500 ; GFX10-NEXT: s_swappc_b64 s[30:31], s[4:5]
2501 ; GFX10-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2502 ; GFX10-NEXT: v_mov_b32_e32 v2, 3
2503 ; GFX10-NEXT: v_and_b32_e32 v8, 0xffff8000, v1
2504 ; GFX10-NEXT: v_lshlrev_b32_sdwa v0, v2, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:BYTE_0
2505 ; GFX10-NEXT: v_add_co_u32 v1, s0, s34, v8
2506 ; GFX10-NEXT: v_add_co_ci_u32_e64 v2, s0, s35, 0, s0
2507 ; GFX10-NEXT: v_add_co_u32 v3, vcc_lo, v1, v0
2508 ; GFX10-NEXT: v_add_co_ci_u32_e32 v4, vcc_lo, 0, v2, vcc_lo
2509 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, 0x800, v3
2510 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v4, vcc_lo
2511 ; GFX10-NEXT: v_add_co_u32 v2, vcc_lo, 0, v3
2512 ; GFX10-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, -1, v4, vcc_lo
2513 ; GFX10-NEXT: s_clause 0x1
2514 ; GFX10-NEXT: global_load_dwordx2 v[4:5], v[0:1], off
2515 ; GFX10-NEXT: global_load_dwordx2 v[6:7], v[2:3], off
2516 ; GFX10-NEXT: s_waitcnt vmcnt(0)
2517 ; GFX10-NEXT: v_add_co_u32 v0, vcc_lo, v6, v4
2518 ; GFX10-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v7, v5, vcc_lo
2519 ; GFX10-NEXT: global_store_dwordx2 v8, v[0:1], s[34:35]
2520 ; GFX10-NEXT: s_endpgm
2522 ; GFX11-LABEL: negativeoffset:
2523 ; GFX11: ; %bb.0: ; %entry
2524 ; GFX11-NEXT: s_getpc_b64 s[2:3]
2525 ; GFX11-NEXT: s_add_u32 s2, s2, _Z13get_global_idj@gotpcrel32@lo+4
2526 ; GFX11-NEXT: s_addc_u32 s3, s3, _Z13get_global_idj@gotpcrel32@hi+12
2527 ; GFX11-NEXT: v_dual_mov_b32 v31, v0 :: v_dual_mov_b32 v0, 0
2528 ; GFX11-NEXT: s_load_b64 s[2:3], s[2:3], 0x0
2529 ; GFX11-NEXT: s_load_b64 s[34:35], s[0:1], 0x24
2530 ; GFX11-NEXT: s_mov_b32 s32, 0
2531 ; GFX11-NEXT: s_waitcnt lgkmcnt(0)
2532 ; GFX11-NEXT: s_swappc_b64 s[30:31], s[2:3]
2533 ; GFX11-NEXT: v_lshlrev_b32_e32 v1, 7, v0
2534 ; GFX11-NEXT: v_and_b32_e32 v0, 0xff, v0
2535 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2536 ; GFX11-NEXT: v_and_b32_e32 v4, 0xffff8000, v1
2537 ; GFX11-NEXT: v_lshlrev_b32_e32 v0, 3, v0
2538 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
2539 ; GFX11-NEXT: v_add_co_u32 v1, s0, s34, v4
2540 ; GFX11-NEXT: v_add_co_ci_u32_e64 v2, null, s35, 0, s0
2541 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2542 ; GFX11-NEXT: v_add_co_u32 v3, vcc_lo, v1, v0
2543 ; GFX11-NEXT: v_add_co_ci_u32_e32 v5, vcc_lo, 0, v2, vcc_lo
2544 ; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_2)
2545 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, 0x1000, v3
2546 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, -1, v5, vcc_lo
2547 ; GFX11-NEXT: v_add_co_u32 v2, vcc_lo, 0, v3
2548 ; GFX11-NEXT: v_add_co_ci_u32_e32 v3, vcc_lo, -1, v5, vcc_lo
2549 ; GFX11-NEXT: s_clause 0x1
2550 ; GFX11-NEXT: global_load_b64 v[0:1], v[0:1], off offset:-2048
2551 ; GFX11-NEXT: global_load_b64 v[2:3], v[2:3], off
2552 ; GFX11-NEXT: s_waitcnt vmcnt(0)
2553 ; GFX11-NEXT: v_add_co_u32 v0, vcc_lo, v2, v0
2554 ; GFX11-NEXT: v_add_co_ci_u32_e32 v1, vcc_lo, v3, v1, vcc_lo
2555 ; GFX11-NEXT: global_store_b64 v4, v[0:1], s[34:35]
2556 ; GFX11-NEXT: s_nop 0
2557 ; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
2558 ; GFX11-NEXT: s_endpgm
2560 %call = tail call i64 @_Z13get_global_idj(i32 0) #2
2561 %conv = and i64 %call, 255
2562 %0 = shl i64 %call, 7
2563 %idx.ext11 = and i64 %0, 4294934528
2564 %add.ptr12 = getelementptr inbounds i8, ptr addrspace(1) %buffer, i64 %idx.ext11
2566 %buffer_wave = getelementptr inbounds i64, ptr addrspace(1) %add.ptr12, i64 %conv
2568 %addr1 = getelementptr inbounds i64, ptr addrspace(1) %buffer_wave, i64 -536870656
2569 %load1 = load i64, ptr addrspace(1) %addr1, align 8
2571 %addr2 = getelementptr inbounds i64, ptr addrspace(1) %buffer_wave, i64 -536870912
2572 %load2 = load i64, ptr addrspace(1) %addr2, align 8
2575 %add = add i64 %load2, %load1
2577 store i64 %add, ptr addrspace(1) %add.ptr12, align 8
2581 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" }