1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -O0 -run-pass=aarch64-prelegalizer-combiner -global-isel -verify-machineinstrs %s -o - | FileCheck %s
8 ; CHECK-LABEL: name: test_anyext
11 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
12 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p0) :: (load (s8))
13 ; CHECK-NEXT: $w0 = COPY [[LOAD]](s32)
15 %1:_(s8) = G_LOAD %0 :: (load (s8))
16 %2:_(s32) = G_ANYEXT %1
21 name: test_anyext_with_copy
25 ; CHECK-LABEL: name: test_anyext_with_copy
28 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
29 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p0) :: (load (s8))
30 ; CHECK-NEXT: $w0 = COPY [[LOAD]](s32)
32 %1:_(s8) = G_LOAD %0 :: (load (s8))
34 %3:_(s32) = G_ANYEXT %1
43 ; CHECK-LABEL: name: test_signext
46 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
47 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p0) :: (load (s8))
48 ; CHECK-NEXT: $w0 = COPY [[SEXTLOAD]](s32)
50 %1:_(s8) = G_LOAD %0 :: (load (s8))
60 ; CHECK-LABEL: name: test_zeroext
63 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
64 ; CHECK-NEXT: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p0) :: (load (s8))
65 ; CHECK-NEXT: $w0 = COPY [[ZEXTLOAD]](s32)
67 %1:_(s8) = G_LOAD %0 :: (load (s8))
77 ; CHECK-LABEL: name: test_2anyext
80 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
81 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p0) :: (load (s8))
82 ; CHECK-NEXT: $w0 = COPY [[LOAD]](s32)
83 ; CHECK-NEXT: $w1 = COPY [[LOAD]](s32)
85 %1:_(s8) = G_LOAD %0 :: (load (s8))
86 %2:_(s32) = G_ANYEXT %1
87 %3:_(s32) = G_ANYEXT %1
93 name: test_1anyext_1signext
97 ; CHECK-LABEL: name: test_1anyext_1signext
100 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
101 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p0) :: (load (s8))
102 ; CHECK-NEXT: $w0 = COPY [[SEXTLOAD]](s32)
103 ; CHECK-NEXT: $w1 = COPY [[SEXTLOAD]](s32)
105 %1:_(s8) = G_LOAD %0 :: (load (s8))
106 %2:_(s32) = G_ANYEXT %1
107 %3:_(s32) = G_SEXT %1
113 name: test_1xor_1signext
117 ; CHECK-LABEL: name: test_1xor_1signext
118 ; CHECK: liveins: $x0
120 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
121 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p0) :: (load (s8))
122 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[SEXTLOAD]](s32)
123 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 -1
124 ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(s8) = G_XOR [[TRUNC]], [[C]]
125 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[XOR]](s8)
126 ; CHECK-NEXT: $w0 = COPY [[ANYEXT]](s32)
127 ; CHECK-NEXT: $w1 = COPY [[SEXTLOAD]](s32)
129 %1:_(s8) = G_LOAD %0 :: (load (s8))
130 %2:_(s8) = G_CONSTANT i8 -1
131 %3:_(s8) = G_XOR %1, %2
132 %5:_(s32) = G_ANYEXT %3
133 %6:_(s32) = G_SEXT %1
139 name: test_1anyext_1zeroext
143 ; CHECK-LABEL: name: test_1anyext_1zeroext
144 ; CHECK: liveins: $x0
146 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
147 ; CHECK-NEXT: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p0) :: (load (s8))
148 ; CHECK-NEXT: $w0 = COPY [[ZEXTLOAD]](s32)
149 ; CHECK-NEXT: $w1 = COPY [[ZEXTLOAD]](s32)
151 %1:_(s8) = G_LOAD %0 :: (load (s8))
152 %2:_(s32) = G_ANYEXT %1
153 %3:_(s32) = G_ZEXT %1
159 name: test_1signext_1zeroext
163 ; CHECK-LABEL: name: test_1signext_1zeroext
164 ; CHECK: liveins: $x0
166 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
167 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p0) :: (load (s8))
168 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[SEXTLOAD]](s32)
169 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[TRUNC]](s8)
170 ; CHECK-NEXT: $w0 = COPY [[ZEXT]](s32)
171 ; CHECK-NEXT: $w1 = COPY [[SEXTLOAD]](s32)
173 %1:_(s8) = G_LOAD %0 :: (load (s8))
174 %2:_(s32) = G_ZEXT %1
175 %3:_(s32) = G_SEXT %1
181 name: test_1anyext64_1signext32
185 ; CHECK-LABEL: name: test_1anyext64_1signext32
186 ; CHECK: liveins: $x0
188 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
189 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p0) :: (load (s8))
190 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SEXTLOAD]](s32)
191 ; CHECK-NEXT: $x0 = COPY [[ANYEXT]](s64)
192 ; CHECK-NEXT: $w1 = COPY [[SEXTLOAD]](s32)
194 %1:_(s8) = G_LOAD %0 :: (load (s8))
195 %2:_(s64) = G_ANYEXT %1
196 %3:_(s32) = G_SEXT %1
202 name: test_1anyext32_1signext64
206 ; CHECK-LABEL: name: test_1anyext32_1signext64
207 ; CHECK: liveins: $x0
209 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
210 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s64) = G_SEXTLOAD [[COPY]](p0) :: (load (s8))
211 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[SEXTLOAD]](s64)
212 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[TRUNC]](s8)
213 ; CHECK-NEXT: $w0 = COPY [[ANYEXT]](s32)
214 ; CHECK-NEXT: $x1 = COPY [[SEXTLOAD]](s64)
216 %1:_(s8) = G_LOAD %0 :: (load (s8))
217 %2:_(s32) = G_ANYEXT %1
218 %3:_(s64) = G_SEXT %1
224 name: test_2anyext32_1signext64
228 ; CHECK-LABEL: name: test_2anyext32_1signext64
229 ; CHECK: liveins: $x0
231 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
232 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s64) = G_SEXTLOAD [[COPY]](p0) :: (load (s8))
233 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[SEXTLOAD]](s64)
234 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[TRUNC]](s8)
235 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[TRUNC]](s8)
236 ; CHECK-NEXT: $w0 = COPY [[ANYEXT]](s32)
237 ; CHECK-NEXT: $x1 = COPY [[SEXTLOAD]](s64)
238 ; CHECK-NEXT: $w2 = COPY [[ANYEXT1]](s32)
240 %1:_(s8) = G_LOAD %0 :: (load (s8))
241 %2:_(s32) = G_ANYEXT %1
242 %3:_(s64) = G_SEXT %1
243 %4:_(s32) = G_ANYEXT %1
250 name: test_multiblock_anyext
252 ; CHECK-LABEL: name: test_multiblock_anyext
254 ; CHECK-NEXT: successors: %bb.1(0x80000000)
255 ; CHECK-NEXT: liveins: $x0
257 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
258 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p0) :: (load (s8))
259 ; CHECK-NEXT: G_BR %bb.1
262 ; CHECK-NEXT: $w0 = COPY [[LOAD]](s32)
266 %1:_(s8) = G_LOAD %0 :: (load (s8))
269 %2:_(s32) = G_ANYEXT %1
274 name: test_multiblock_signext
276 ; CHECK-LABEL: name: test_multiblock_signext
278 ; CHECK-NEXT: successors: %bb.1(0x80000000)
279 ; CHECK-NEXT: liveins: $x0
281 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
282 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p0) :: (load (s8))
283 ; CHECK-NEXT: G_BR %bb.1
286 ; CHECK-NEXT: $w0 = COPY [[SEXTLOAD]](s32)
290 %1:_(s8) = G_LOAD %0 :: (load (s8))
293 %2:_(s32) = G_SEXT %1
298 name: test_multiblock_zeroext
300 ; CHECK-LABEL: name: test_multiblock_zeroext
302 ; CHECK-NEXT: successors: %bb.1(0x80000000)
303 ; CHECK-NEXT: liveins: $x0
305 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
306 ; CHECK-NEXT: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p0) :: (load (s8))
307 ; CHECK-NEXT: G_BR %bb.1
310 ; CHECK-NEXT: $w0 = COPY [[ZEXTLOAD]](s32)
314 %1:_(s8) = G_LOAD %0 :: (load (s8))
317 %2:_(s32) = G_ZEXT %1
322 name: test_multiblock_2anyext
324 ; CHECK-LABEL: name: test_multiblock_2anyext
326 ; CHECK-NEXT: successors: %bb.1(0x80000000)
327 ; CHECK-NEXT: liveins: $x0
329 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
330 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p0) :: (load (s8))
331 ; CHECK-NEXT: G_BR %bb.1
334 ; CHECK-NEXT: $w0 = COPY [[LOAD]](s32)
335 ; CHECK-NEXT: $w1 = COPY [[LOAD]](s32)
339 %1:_(s8) = G_LOAD %0 :: (load (s8))
340 %2:_(s32) = G_ANYEXT %1
343 %3:_(s32) = G_ANYEXT %1
349 name: test_multiblock_1anyext64_1signext32
351 ; CHECK-LABEL: name: test_multiblock_1anyext64_1signext32
353 ; CHECK-NEXT: successors: %bb.1(0x80000000)
354 ; CHECK-NEXT: liveins: $x0
356 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
357 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p0) :: (load (s8))
358 ; CHECK-NEXT: G_BR %bb.1
361 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SEXTLOAD]](s32)
362 ; CHECK-NEXT: $x0 = COPY [[ANYEXT]](s64)
363 ; CHECK-NEXT: $w1 = COPY [[SEXTLOAD]](s32)
367 %1:_(s8) = G_LOAD %0 :: (load (s8))
370 %2:_(s64) = G_ANYEXT %1
371 %3:_(s32) = G_SEXT %1
377 name: test_multiblock_1anyext32_1signext64
379 ; CHECK-LABEL: name: test_multiblock_1anyext32_1signext64
381 ; CHECK-NEXT: successors: %bb.1(0x80000000)
382 ; CHECK-NEXT: liveins: $x0
384 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
385 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s64) = G_SEXTLOAD [[COPY]](p0) :: (load (s8))
386 ; CHECK-NEXT: G_BR %bb.1
389 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[SEXTLOAD]](s64)
390 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[TRUNC]](s8)
391 ; CHECK-NEXT: $w0 = COPY [[ANYEXT]](s32)
392 ; CHECK-NEXT: $x1 = COPY [[SEXTLOAD]](s64)
396 %1:_(s8) = G_LOAD %0 :: (load (s8))
399 %2:_(s32) = G_ANYEXT %1
400 %3:_(s64) = G_SEXT %1
406 name: test_multiblock_2anyext32_1signext64
408 ; CHECK-LABEL: name: test_multiblock_2anyext32_1signext64
410 ; CHECK-NEXT: successors: %bb.1(0x80000000)
411 ; CHECK-NEXT: liveins: $x0
413 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
414 ; CHECK-NEXT: [[SEXTLOAD:%[0-9]+]]:_(s64) = G_SEXTLOAD [[COPY]](p0) :: (load (s8))
415 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[SEXTLOAD]](s64)
416 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[TRUNC]](s8)
417 ; CHECK-NEXT: G_BR %bb.1
420 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[SEXTLOAD]](s64)
421 ; CHECK-NEXT: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[TRUNC1]](s8)
422 ; CHECK-NEXT: $w0 = COPY [[ANYEXT1]](s32)
423 ; CHECK-NEXT: $x1 = COPY [[SEXTLOAD]](s64)
424 ; CHECK-NEXT: $w2 = COPY [[ANYEXT]](s32)
428 %1:_(s8) = G_LOAD %0 :: (load (s8))
429 %4:_(s32) = G_ANYEXT %1
432 %2:_(s32) = G_ANYEXT %1
433 %3:_(s64) = G_SEXT %1
441 tracksRegLiveness: true
448 ; CHECK-LABEL: name: test_atomic
449 ; CHECK: liveins: $x0
451 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
452 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s16) = G_LOAD [[COPY]](p0) :: (load unordered (s16))
453 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[LOAD]](s16)
454 ; CHECK-NEXT: $w0 = COPY [[ZEXT]](s32)
455 ; CHECK-NEXT: RET_ReallyLR implicit $w0
457 %1:_(s16) = G_LOAD %0(p0) :: (load unordered (s16))
458 %2:_(s32) = G_ZEXT %1(s16)
460 RET_ReallyLR implicit $w0
463 name: test_dont_zextload_to_sextload
467 ; CHECK-LABEL: name: test_dont_zextload_to_sextload
468 ; CHECK: liveins: $x0
470 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
471 ; CHECK-NEXT: [[ZEXTLOAD:%[0-9]+]]:_(s64) = G_ZEXTLOAD [[COPY]](p0) :: (load (s8))
472 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[ZEXTLOAD]](s64)
473 ; CHECK-NEXT: [[SEXT:%[0-9]+]]:_(s64) = G_SEXT [[TRUNC]](s32)
474 ; CHECK-NEXT: $x0 = COPY [[ZEXTLOAD]](s64)
475 ; CHECK-NEXT: $x1 = COPY [[SEXT]](s64)
477 %1:_(s32) = G_ZEXTLOAD %0 :: (load (s8))
478 %2:_(s64) = G_ZEXT %1
479 %3:_(s64) = G_SEXT %1