1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -global-isel -march=amdgcn -mcpu=fiji -run-pass=amdgpu-regbankselect -verify-machineinstrs -o - %s | FileCheck -check-prefix=GFX8 %s
3 # RUN: llc -global-isel -march=amdgcn -mcpu=gfx900 -run-pass=amdgpu-regbankselect -verify-machineinstrs -o - %s | FileCheck -check-prefix=GFX9 %s
4 # RUN: llc -global-isel -march=amdgcn -mcpu=gfx1010 -run-pass=amdgpu-regbankselect -verify-machineinstrs -o - %s | FileCheck -check-prefix=GFX10 %s
6 name: constant_load_i8_align8
12 ; GFX8-LABEL: name: constant_load_i8_align8
13 ; GFX8: liveins: $sgpr0_sgpr1
15 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
16 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), align 8, addrspace 4)
17 ; GFX8-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
18 ; GFX9-LABEL: name: constant_load_i8_align8
19 ; GFX9: liveins: $sgpr0_sgpr1
21 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
22 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), align 8, addrspace 4)
23 ; GFX9-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
24 ; GFX10-LABEL: name: constant_load_i8_align8
25 ; GFX10: liveins: $sgpr0_sgpr1
27 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
28 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), align 8, addrspace 4)
29 ; GFX10-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
30 %0:_(p1) = COPY $sgpr0_sgpr1
31 %1:_(s32) = G_LOAD %0 :: (invariant load (s8), align 8, addrspace 4)
32 S_ENDPGM 0, implicit %1
35 name: constant_load_i8_align4
41 ; GFX8-LABEL: name: constant_load_i8_align4
42 ; GFX8: liveins: $sgpr0_sgpr1
44 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
45 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
46 ; GFX8-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
47 ; GFX9-LABEL: name: constant_load_i8_align4
48 ; GFX9: liveins: $sgpr0_sgpr1
50 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
51 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
52 ; GFX9-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
53 ; GFX10-LABEL: name: constant_load_i8_align4
54 ; GFX10: liveins: $sgpr0_sgpr1
56 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
57 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
58 ; GFX10-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
59 %0:_(p1) = COPY $sgpr0_sgpr1
60 %1:_(s32) = G_LOAD %0 :: (invariant load (s8), align 4, addrspace 4)
61 S_ENDPGM 0, implicit %1
64 name: constant_load_i16_align4
70 ; GFX8-LABEL: name: constant_load_i16_align4
71 ; GFX8: liveins: $sgpr0_sgpr1
73 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
74 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
75 ; GFX8-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
76 ; GFX9-LABEL: name: constant_load_i16_align4
77 ; GFX9: liveins: $sgpr0_sgpr1
79 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
80 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
81 ; GFX9-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
82 ; GFX10-LABEL: name: constant_load_i16_align4
83 ; GFX10: liveins: $sgpr0_sgpr1
85 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
86 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
87 ; GFX10-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
88 %0:_(p1) = COPY $sgpr0_sgpr1
89 %1:_(s32) = G_LOAD %0 :: (invariant load (s16), align 4, addrspace 4)
90 S_ENDPGM 0, implicit %1
93 name: constant_sextload_i8_align4
99 ; GFX8-LABEL: name: constant_sextload_i8_align4
100 ; GFX8: liveins: $sgpr0_sgpr1
102 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
103 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
104 ; GFX8-NEXT: [[SEXT_INREG:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[LOAD]], 8
105 ; GFX8-NEXT: S_ENDPGM 0, implicit [[SEXT_INREG]](s32)
106 ; GFX9-LABEL: name: constant_sextload_i8_align4
107 ; GFX9: liveins: $sgpr0_sgpr1
109 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
110 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
111 ; GFX9-NEXT: [[SEXT_INREG:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[LOAD]], 8
112 ; GFX9-NEXT: S_ENDPGM 0, implicit [[SEXT_INREG]](s32)
113 ; GFX10-LABEL: name: constant_sextload_i8_align4
114 ; GFX10: liveins: $sgpr0_sgpr1
116 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
117 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
118 ; GFX10-NEXT: [[SEXT_INREG:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[LOAD]], 8
119 ; GFX10-NEXT: S_ENDPGM 0, implicit [[SEXT_INREG]](s32)
120 %0:_(p1) = COPY $sgpr0_sgpr1
121 %1:_(s32) = G_SEXTLOAD %0 :: (invariant load (s8), align 4, addrspace 4)
122 S_ENDPGM 0, implicit %1
125 name: constant_sextload_i16_align4
130 liveins: $sgpr0_sgpr1
131 ; GFX8-LABEL: name: constant_sextload_i16_align4
132 ; GFX8: liveins: $sgpr0_sgpr1
134 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
135 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
136 ; GFX8-NEXT: [[SEXT_INREG:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[LOAD]], 16
137 ; GFX8-NEXT: S_ENDPGM 0, implicit [[SEXT_INREG]](s32)
138 ; GFX9-LABEL: name: constant_sextload_i16_align4
139 ; GFX9: liveins: $sgpr0_sgpr1
141 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
142 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
143 ; GFX9-NEXT: [[SEXT_INREG:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[LOAD]], 16
144 ; GFX9-NEXT: S_ENDPGM 0, implicit [[SEXT_INREG]](s32)
145 ; GFX10-LABEL: name: constant_sextload_i16_align4
146 ; GFX10: liveins: $sgpr0_sgpr1
148 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
149 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
150 ; GFX10-NEXT: [[SEXT_INREG:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[LOAD]], 16
151 ; GFX10-NEXT: S_ENDPGM 0, implicit [[SEXT_INREG]](s32)
152 %0:_(p1) = COPY $sgpr0_sgpr1
153 %1:_(s32) = G_SEXTLOAD %0 :: (invariant load (s16), align 4, addrspace 4)
154 S_ENDPGM 0, implicit %1
158 name: constant_zextload_i8_align4
163 liveins: $sgpr0_sgpr1
164 ; GFX8-LABEL: name: constant_zextload_i8_align4
165 ; GFX8: liveins: $sgpr0_sgpr1
167 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
168 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
169 ; GFX8-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 255
170 ; GFX8-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[LOAD]], [[C]]
171 ; GFX8-NEXT: S_ENDPGM 0, implicit [[AND]](s32)
172 ; GFX9-LABEL: name: constant_zextload_i8_align4
173 ; GFX9: liveins: $sgpr0_sgpr1
175 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
176 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
177 ; GFX9-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 255
178 ; GFX9-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[LOAD]], [[C]]
179 ; GFX9-NEXT: S_ENDPGM 0, implicit [[AND]](s32)
180 ; GFX10-LABEL: name: constant_zextload_i8_align4
181 ; GFX10: liveins: $sgpr0_sgpr1
183 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
184 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
185 ; GFX10-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 255
186 ; GFX10-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[LOAD]], [[C]]
187 ; GFX10-NEXT: S_ENDPGM 0, implicit [[AND]](s32)
188 %0:_(p1) = COPY $sgpr0_sgpr1
189 %1:_(s32) = G_ZEXTLOAD %0 :: (invariant load (s8), align 4, addrspace 4)
190 S_ENDPGM 0, implicit %1
193 name: constant_zextload_i16_align4
198 liveins: $sgpr0_sgpr1
199 ; GFX8-LABEL: name: constant_zextload_i16_align4
200 ; GFX8: liveins: $sgpr0_sgpr1
202 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
203 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
204 ; GFX8-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65535
205 ; GFX8-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[LOAD]], [[C]]
206 ; GFX8-NEXT: S_ENDPGM 0, implicit [[AND]](s32)
207 ; GFX9-LABEL: name: constant_zextload_i16_align4
208 ; GFX9: liveins: $sgpr0_sgpr1
210 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
211 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
212 ; GFX9-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65535
213 ; GFX9-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[LOAD]], [[C]]
214 ; GFX9-NEXT: S_ENDPGM 0, implicit [[AND]](s32)
215 ; GFX10-LABEL: name: constant_zextload_i16_align4
216 ; GFX10: liveins: $sgpr0_sgpr1
218 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
219 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 4)
220 ; GFX10-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65535
221 ; GFX10-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[LOAD]], [[C]]
222 ; GFX10-NEXT: S_ENDPGM 0, implicit [[AND]](s32)
223 %0:_(p1) = COPY $sgpr0_sgpr1
224 %1:_(s32) = G_ZEXTLOAD %0 :: (invariant load (s16), align 4, addrspace 4)
225 S_ENDPGM 0, implicit %1
228 name: global_load_i8_align4
233 liveins: $sgpr0_sgpr1
234 ; GFX8-LABEL: name: global_load_i8_align4
235 ; GFX8: liveins: $sgpr0_sgpr1
237 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
238 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 1)
239 ; GFX8-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
240 ; GFX9-LABEL: name: global_load_i8_align4
241 ; GFX9: liveins: $sgpr0_sgpr1
243 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
244 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 1)
245 ; GFX9-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
246 ; GFX10-LABEL: name: global_load_i8_align4
247 ; GFX10: liveins: $sgpr0_sgpr1
249 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
250 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 1)
251 ; GFX10-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
252 %0:_(p1) = COPY $sgpr0_sgpr1
253 %1:_(s32) = G_LOAD %0 :: (invariant load (s8), align 4, addrspace 1)
254 S_ENDPGM 0, implicit %1
257 name: global_load_i16_align4
262 liveins: $sgpr0_sgpr1
263 ; GFX8-LABEL: name: global_load_i16_align4
264 ; GFX8: liveins: $sgpr0_sgpr1
266 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
267 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 1)
268 ; GFX8-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
269 ; GFX9-LABEL: name: global_load_i16_align4
270 ; GFX9: liveins: $sgpr0_sgpr1
272 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
273 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 1)
274 ; GFX9-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
275 ; GFX10-LABEL: name: global_load_i16_align4
276 ; GFX10: liveins: $sgpr0_sgpr1
278 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
279 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 1)
280 ; GFX10-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
281 %0:_(p1) = COPY $sgpr0_sgpr1
282 %1:_(s32) = G_LOAD %0 :: (invariant load (s16), align 4, addrspace 1)
283 S_ENDPGM 0, implicit %1
286 name: global_sextload_i8_alig4
291 liveins: $sgpr0_sgpr1
292 ; GFX8-LABEL: name: global_sextload_i8_alig4
293 ; GFX8: liveins: $sgpr0_sgpr1
295 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
296 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 1)
297 ; GFX8-NEXT: [[SEXT_INREG:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[LOAD]], 8
298 ; GFX8-NEXT: S_ENDPGM 0, implicit [[SEXT_INREG]](s32)
299 ; GFX9-LABEL: name: global_sextload_i8_alig4
300 ; GFX9: liveins: $sgpr0_sgpr1
302 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
303 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 1)
304 ; GFX9-NEXT: [[SEXT_INREG:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[LOAD]], 8
305 ; GFX9-NEXT: S_ENDPGM 0, implicit [[SEXT_INREG]](s32)
306 ; GFX10-LABEL: name: global_sextload_i8_alig4
307 ; GFX10: liveins: $sgpr0_sgpr1
309 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
310 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 1)
311 ; GFX10-NEXT: [[SEXT_INREG:%[0-9]+]]:sgpr(s32) = G_SEXT_INREG [[LOAD]], 8
312 ; GFX10-NEXT: S_ENDPGM 0, implicit [[SEXT_INREG]](s32)
313 %0:_(p1) = COPY $sgpr0_sgpr1
314 %1:_(s32) = G_SEXTLOAD %0 :: (invariant load (s8), align 4, addrspace 1)
315 S_ENDPGM 0, implicit %1
318 name: global_zextload_i16_align4
323 liveins: $sgpr0_sgpr1
324 ; GFX8-LABEL: name: global_zextload_i16_align4
325 ; GFX8: liveins: $sgpr0_sgpr1
327 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
328 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 1)
329 ; GFX8-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65535
330 ; GFX8-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[LOAD]], [[C]]
331 ; GFX8-NEXT: S_ENDPGM 0, implicit [[AND]](s32)
332 ; GFX9-LABEL: name: global_zextload_i16_align4
333 ; GFX9: liveins: $sgpr0_sgpr1
335 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
336 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 1)
337 ; GFX9-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65535
338 ; GFX9-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[LOAD]], [[C]]
339 ; GFX9-NEXT: S_ENDPGM 0, implicit [[AND]](s32)
340 ; GFX10-LABEL: name: global_zextload_i16_align4
341 ; GFX10: liveins: $sgpr0_sgpr1
343 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
344 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:sgpr(s32) = G_LOAD [[COPY]](p1) :: (invariant load (s32), addrspace 1)
345 ; GFX10-NEXT: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65535
346 ; GFX10-NEXT: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[LOAD]], [[C]]
347 ; GFX10-NEXT: S_ENDPGM 0, implicit [[AND]](s32)
348 %0:_(p1) = COPY $sgpr0_sgpr1
349 %1:_(s32) = G_ZEXTLOAD %0 :: (invariant load (s16), align 4, addrspace 1)
350 S_ENDPGM 0, implicit %1
352 # Some negative test cases
354 name: constant_load_i8_align2
358 liveins: $sgpr0_sgpr1
359 ; GFX8-LABEL: name: constant_load_i8_align2
360 ; GFX8: liveins: $sgpr0_sgpr1
362 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
363 ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
364 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:vgpr(s32) = G_LOAD [[COPY1]](p1) :: (invariant load (s8), align 2, addrspace 4)
365 ; GFX8-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
366 ; GFX9-LABEL: name: constant_load_i8_align2
367 ; GFX9: liveins: $sgpr0_sgpr1
369 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
370 ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
371 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:vgpr(s32) = G_LOAD [[COPY1]](p1) :: (invariant load (s8), align 2, addrspace 4)
372 ; GFX9-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
373 ; GFX10-LABEL: name: constant_load_i8_align2
374 ; GFX10: liveins: $sgpr0_sgpr1
376 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
377 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
378 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:vgpr(s32) = G_LOAD [[COPY1]](p1) :: (invariant load (s8), align 2, addrspace 4)
379 ; GFX10-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
380 %0:_(p1) = COPY $sgpr0_sgpr1
381 %1:_(s32) = G_LOAD %0 :: (invariant load (s8), align 2, addrspace 4)
382 S_ENDPGM 0, implicit %1
385 name: constant_load_i16_align2
390 liveins: $sgpr0_sgpr1
391 ; GFX8-LABEL: name: constant_load_i16_align2
392 ; GFX8: liveins: $sgpr0_sgpr1
394 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
395 ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
396 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:vgpr(s32) = G_LOAD [[COPY1]](p1) :: (invariant load (s16), addrspace 4)
397 ; GFX8-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
398 ; GFX9-LABEL: name: constant_load_i16_align2
399 ; GFX9: liveins: $sgpr0_sgpr1
401 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
402 ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
403 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:vgpr(s32) = G_LOAD [[COPY1]](p1) :: (invariant load (s16), addrspace 4)
404 ; GFX9-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
405 ; GFX10-LABEL: name: constant_load_i16_align2
406 ; GFX10: liveins: $sgpr0_sgpr1
408 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
409 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
410 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:vgpr(s32) = G_LOAD [[COPY1]](p1) :: (invariant load (s16), addrspace 4)
411 ; GFX10-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
412 %0:_(p1) = COPY $sgpr0_sgpr1
413 %1:_(s32) = G_LOAD %0 :: (invariant load (s16), align 2, addrspace 4)
414 S_ENDPGM 0, implicit %1
417 name: constant_sextload_i8_align2
422 liveins: $sgpr0_sgpr1
423 ; GFX8-LABEL: name: constant_sextload_i8_align2
424 ; GFX8: liveins: $sgpr0_sgpr1
426 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
427 ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
428 ; GFX8-NEXT: [[SEXTLOAD:%[0-9]+]]:vgpr(s32) = G_SEXTLOAD [[COPY1]](p1) :: (invariant load (s8), align 2, addrspace 4)
429 ; GFX8-NEXT: S_ENDPGM 0, implicit [[SEXTLOAD]](s32)
430 ; GFX9-LABEL: name: constant_sextload_i8_align2
431 ; GFX9: liveins: $sgpr0_sgpr1
433 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
434 ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
435 ; GFX9-NEXT: [[SEXTLOAD:%[0-9]+]]:vgpr(s32) = G_SEXTLOAD [[COPY1]](p1) :: (invariant load (s8), align 2, addrspace 4)
436 ; GFX9-NEXT: S_ENDPGM 0, implicit [[SEXTLOAD]](s32)
437 ; GFX10-LABEL: name: constant_sextload_i8_align2
438 ; GFX10: liveins: $sgpr0_sgpr1
440 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
441 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
442 ; GFX10-NEXT: [[SEXTLOAD:%[0-9]+]]:vgpr(s32) = G_SEXTLOAD [[COPY1]](p1) :: (invariant load (s8), align 2, addrspace 4)
443 ; GFX10-NEXT: S_ENDPGM 0, implicit [[SEXTLOAD]](s32)
444 %0:_(p1) = COPY $sgpr0_sgpr1
445 %1:_(s32) = G_SEXTLOAD %0 :: (invariant load (s8), align 2, addrspace 4)
446 S_ENDPGM 0, implicit %1
449 name: constant_sextload_i16_align2
454 liveins: $sgpr0_sgpr1
455 ; GFX8-LABEL: name: constant_sextload_i16_align2
456 ; GFX8: liveins: $sgpr0_sgpr1
458 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
459 ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
460 ; GFX8-NEXT: [[SEXTLOAD:%[0-9]+]]:vgpr(s32) = G_SEXTLOAD [[COPY1]](p1) :: (invariant load (s16), addrspace 4)
461 ; GFX8-NEXT: S_ENDPGM 0, implicit [[SEXTLOAD]](s32)
462 ; GFX9-LABEL: name: constant_sextload_i16_align2
463 ; GFX9: liveins: $sgpr0_sgpr1
465 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
466 ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
467 ; GFX9-NEXT: [[SEXTLOAD:%[0-9]+]]:vgpr(s32) = G_SEXTLOAD [[COPY1]](p1) :: (invariant load (s16), addrspace 4)
468 ; GFX9-NEXT: S_ENDPGM 0, implicit [[SEXTLOAD]](s32)
469 ; GFX10-LABEL: name: constant_sextload_i16_align2
470 ; GFX10: liveins: $sgpr0_sgpr1
472 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
473 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
474 ; GFX10-NEXT: [[SEXTLOAD:%[0-9]+]]:vgpr(s32) = G_SEXTLOAD [[COPY1]](p1) :: (invariant load (s16), addrspace 4)
475 ; GFX10-NEXT: S_ENDPGM 0, implicit [[SEXTLOAD]](s32)
476 %0:_(p1) = COPY $sgpr0_sgpr1
477 %1:_(s32) = G_SEXTLOAD %0 :: (invariant load (s16), align 2, addrspace 4)
478 S_ENDPGM 0, implicit %1
481 name: constant_zextload_i8_align2
486 liveins: $sgpr0_sgpr1
487 ; GFX8-LABEL: name: constant_zextload_i8_align2
488 ; GFX8: liveins: $sgpr0_sgpr1
490 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
491 ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
492 ; GFX8-NEXT: [[ZEXTLOAD:%[0-9]+]]:vgpr(s32) = G_ZEXTLOAD [[COPY1]](p1) :: (invariant load (s8), align 2, addrspace 4)
493 ; GFX8-NEXT: S_ENDPGM 0, implicit [[ZEXTLOAD]](s32)
494 ; GFX9-LABEL: name: constant_zextload_i8_align2
495 ; GFX9: liveins: $sgpr0_sgpr1
497 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
498 ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
499 ; GFX9-NEXT: [[ZEXTLOAD:%[0-9]+]]:vgpr(s32) = G_ZEXTLOAD [[COPY1]](p1) :: (invariant load (s8), align 2, addrspace 4)
500 ; GFX9-NEXT: S_ENDPGM 0, implicit [[ZEXTLOAD]](s32)
501 ; GFX10-LABEL: name: constant_zextload_i8_align2
502 ; GFX10: liveins: $sgpr0_sgpr1
504 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
505 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
506 ; GFX10-NEXT: [[ZEXTLOAD:%[0-9]+]]:vgpr(s32) = G_ZEXTLOAD [[COPY1]](p1) :: (invariant load (s8), align 2, addrspace 4)
507 ; GFX10-NEXT: S_ENDPGM 0, implicit [[ZEXTLOAD]](s32)
508 %0:_(p1) = COPY $sgpr0_sgpr1
509 %1:_(s32) = G_ZEXTLOAD %0 :: (invariant load (s8), align 2, addrspace 4)
510 S_ENDPGM 0, implicit %1
513 name: constant_zextload_i16_align2
518 liveins: $sgpr0_sgpr1
519 ; GFX8-LABEL: name: constant_zextload_i16_align2
520 ; GFX8: liveins: $sgpr0_sgpr1
522 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
523 ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
524 ; GFX8-NEXT: [[ZEXTLOAD:%[0-9]+]]:vgpr(s32) = G_ZEXTLOAD [[COPY1]](p1) :: (invariant load (s16), addrspace 4)
525 ; GFX8-NEXT: S_ENDPGM 0, implicit [[ZEXTLOAD]](s32)
526 ; GFX9-LABEL: name: constant_zextload_i16_align2
527 ; GFX9: liveins: $sgpr0_sgpr1
529 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
530 ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
531 ; GFX9-NEXT: [[ZEXTLOAD:%[0-9]+]]:vgpr(s32) = G_ZEXTLOAD [[COPY1]](p1) :: (invariant load (s16), addrspace 4)
532 ; GFX9-NEXT: S_ENDPGM 0, implicit [[ZEXTLOAD]](s32)
533 ; GFX10-LABEL: name: constant_zextload_i16_align2
534 ; GFX10: liveins: $sgpr0_sgpr1
536 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
537 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
538 ; GFX10-NEXT: [[ZEXTLOAD:%[0-9]+]]:vgpr(s32) = G_ZEXTLOAD [[COPY1]](p1) :: (invariant load (s16), addrspace 4)
539 ; GFX10-NEXT: S_ENDPGM 0, implicit [[ZEXTLOAD]](s32)
540 %0:_(p1) = COPY $sgpr0_sgpr1
541 %1:_(s32) = G_ZEXTLOAD %0 :: (invariant load (s16), align 2, addrspace 4)
542 S_ENDPGM 0, implicit %1
545 name: local_load_i8_align4
550 liveins: $sgpr0_sgpr1
551 ; GFX8-LABEL: name: local_load_i8_align4
552 ; GFX8: liveins: $sgpr0_sgpr1
554 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
555 ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
556 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:vgpr(s32) = G_LOAD [[COPY1]](p1) :: (load (s8), align 4, addrspace 3)
557 ; GFX8-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
558 ; GFX9-LABEL: name: local_load_i8_align4
559 ; GFX9: liveins: $sgpr0_sgpr1
561 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
562 ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
563 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:vgpr(s32) = G_LOAD [[COPY1]](p1) :: (load (s8), align 4, addrspace 3)
564 ; GFX9-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
565 ; GFX10-LABEL: name: local_load_i8_align4
566 ; GFX10: liveins: $sgpr0_sgpr1
568 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
569 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
570 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:vgpr(s32) = G_LOAD [[COPY1]](p1) :: (load (s8), align 4, addrspace 3)
571 ; GFX10-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
572 %0:_(p1) = COPY $sgpr0_sgpr1
573 %1:_(s32) = G_LOAD %0 :: (load (s8), align 4, addrspace 3)
574 S_ENDPGM 0, implicit %1
577 name: private_load_i8_align4
582 liveins: $sgpr0_sgpr1
583 ; GFX8-LABEL: name: private_load_i8_align4
584 ; GFX8: liveins: $sgpr0_sgpr1
586 ; GFX8-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
587 ; GFX8-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
588 ; GFX8-NEXT: [[LOAD:%[0-9]+]]:vgpr(s32) = G_LOAD [[COPY1]](p1) :: (load (s8), align 4, addrspace 5)
589 ; GFX8-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
590 ; GFX9-LABEL: name: private_load_i8_align4
591 ; GFX9: liveins: $sgpr0_sgpr1
593 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
594 ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
595 ; GFX9-NEXT: [[LOAD:%[0-9]+]]:vgpr(s32) = G_LOAD [[COPY1]](p1) :: (load (s8), align 4, addrspace 5)
596 ; GFX9-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
597 ; GFX10-LABEL: name: private_load_i8_align4
598 ; GFX10: liveins: $sgpr0_sgpr1
600 ; GFX10-NEXT: [[COPY:%[0-9]+]]:sgpr(p1) = COPY $sgpr0_sgpr1
601 ; GFX10-NEXT: [[COPY1:%[0-9]+]]:vgpr(p1) = COPY [[COPY]](p1)
602 ; GFX10-NEXT: [[LOAD:%[0-9]+]]:vgpr(s32) = G_LOAD [[COPY1]](p1) :: (load (s8), align 4, addrspace 5)
603 ; GFX10-NEXT: S_ENDPGM 0, implicit [[LOAD]](s32)
604 %0:_(p1) = COPY $sgpr0_sgpr1
605 %1:_(s32) = G_LOAD %0 :: (load (s8), align 4, addrspace 5)
606 S_ENDPGM 0, implicit %1