1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-unknown-unknown -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
5 name: add_sext_s32_to_s64
9 tracksRegLiveness: true
10 machineFunctionInfo: {}
14 ; CHECK-LABEL: name: add_sext_s32_to_s64
15 ; CHECK: liveins: $w1, $x2
17 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w1
18 ; CHECK-NEXT: %add_lhs:gpr64sp = COPY $x2
19 ; CHECK-NEXT: %res:gpr64sp = ADDXrx %add_lhs, [[COPY]], 48
20 ; CHECK-NEXT: $x3 = COPY %res
21 ; CHECK-NEXT: RET_ReallyLR implicit $x3
22 %1:gpr(s32) = COPY $w1
23 %ext:gpr(s64) = G_SEXT %1(s32)
24 %add_lhs:gpr(s64) = COPY $x2
25 %res:gpr(s64) = G_ADD %add_lhs, %ext
27 RET_ReallyLR implicit $x3
30 name: add_and_s32_to_s64
34 tracksRegLiveness: true
35 machineFunctionInfo: {}
39 ; CHECK-LABEL: name: add_and_s32_to_s64
40 ; CHECK: liveins: $x1, $x2
42 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64all = COPY $x1
43 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32all = COPY [[COPY]].sub_32
44 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY [[COPY1]]
45 ; CHECK-NEXT: %add_lhs:gpr64sp = COPY $x2
46 ; CHECK-NEXT: %res:gpr64sp = ADDXrx %add_lhs, [[COPY2]], 16
47 ; CHECK-NEXT: $x3 = COPY %res
48 ; CHECK-NEXT: RET_ReallyLR implicit $x3
49 %1:gpr(s64) = COPY $x1
50 %mask:gpr(s64) = G_CONSTANT i64 4294967295 ; 0xffff
51 %ext:gpr(s64) = G_AND %1(s64), %mask
52 %add_lhs:gpr(s64) = COPY $x2
53 %res:gpr(s64) = G_ADD %add_lhs, %ext
55 RET_ReallyLR implicit $x3
58 name: add_sext_s16_to_s32
62 tracksRegLiveness: true
63 machineFunctionInfo: {}
66 liveins: $w1, $w2, $x2
67 ; CHECK-LABEL: name: add_sext_s16_to_s32
68 ; CHECK: liveins: $w1, $w2, $x2
70 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
71 ; CHECK-NEXT: %add_lhs:gpr32sp = COPY $w2
72 ; CHECK-NEXT: %res:gpr32sp = ADDWrx %add_lhs, %wide_1, 40
73 ; CHECK-NEXT: $w3 = COPY %res
74 ; CHECK-NEXT: RET_ReallyLR implicit $w3
75 %wide_1:gpr(s32) = COPY $w1
76 %1:gpr(s16) = G_TRUNC %wide_1
77 %ext:gpr(s32) = G_SEXT %1(s16)
78 %add_lhs:gpr(s32) = COPY $w2
79 %res:gpr(s32) = G_ADD %add_lhs, %ext
81 RET_ReallyLR implicit $w3
84 name: add_zext_s16_to_s32
88 tracksRegLiveness: true
89 machineFunctionInfo: {}
92 liveins: $w1, $w2, $x2
93 ; CHECK-LABEL: name: add_zext_s16_to_s32
94 ; CHECK: liveins: $w1, $w2, $x2
96 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
97 ; CHECK-NEXT: %add_lhs:gpr32sp = COPY $w2
98 ; CHECK-NEXT: %res:gpr32sp = ADDWrx %add_lhs, %wide_1, 8
99 ; CHECK-NEXT: $w3 = COPY %res
100 ; CHECK-NEXT: RET_ReallyLR implicit $w3
101 %wide_1:gpr(s32) = COPY $w1
102 %1:gpr(s16) = G_TRUNC %wide_1
103 %ext:gpr(s32) = G_ZEXT %1(s16)
104 %add_lhs:gpr(s32) = COPY $w2
105 %res:gpr(s32) = G_ADD %add_lhs, %ext
107 RET_ReallyLR implicit $w3
110 name: add_anyext_s16_to_s32
113 regBankSelected: true
114 tracksRegLiveness: true
115 machineFunctionInfo: {}
118 liveins: $w1, $w2, $x2
119 ; CHECK-LABEL: name: add_anyext_s16_to_s32
120 ; CHECK: liveins: $w1, $w2, $x2
122 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
123 ; CHECK-NEXT: %add_lhs:gpr32sp = COPY $w2
124 ; CHECK-NEXT: %res:gpr32sp = ADDWrx %add_lhs, %wide_1, 8
125 ; CHECK-NEXT: $w3 = COPY %res
126 ; CHECK-NEXT: RET_ReallyLR implicit $w3
127 %wide_1:gpr(s32) = COPY $w1
128 %1:gpr(s16) = G_TRUNC %wide_1
129 %ext:gpr(s32) = G_ANYEXT %1(s16)
130 %add_lhs:gpr(s32) = COPY $w2
131 %res:gpr(s32) = G_ADD %add_lhs, %ext
133 RET_ReallyLR implicit $w3
136 name: add_and_s16_to_s32_uxtb
139 regBankSelected: true
140 tracksRegLiveness: true
141 machineFunctionInfo: {}
144 liveins: $w1, $w2, $x2
145 ; CHECK-LABEL: name: add_and_s16_to_s32_uxtb
146 ; CHECK: liveins: $w1, $w2, $x2
148 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w1
149 ; CHECK-NEXT: %add_lhs:gpr32sp = COPY $w2
150 ; CHECK-NEXT: %res:gpr32sp = ADDWrx %add_lhs, [[COPY]], 0
151 ; CHECK-NEXT: $w3 = COPY %res
152 ; CHECK-NEXT: RET_ReallyLR implicit $w3
153 %1:gpr(s32) = COPY $w1
154 %mask:gpr(s32) = G_CONSTANT i32 255 ; 0xff
155 %ext:gpr(s32) = G_AND %1(s32), %mask
156 %add_lhs:gpr(s32) = COPY $w2
157 %res:gpr(s32) = G_ADD %add_lhs, %ext
159 RET_ReallyLR implicit $w3
162 name: add_and_s16_to_s32_uxth
165 regBankSelected: true
166 tracksRegLiveness: true
167 machineFunctionInfo: {}
170 liveins: $w1, $w2, $x2
171 ; CHECK-LABEL: name: add_and_s16_to_s32_uxth
172 ; CHECK: liveins: $w1, $w2, $x2
174 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w1
175 ; CHECK-NEXT: %add_lhs:gpr32sp = COPY $w2
176 ; CHECK-NEXT: %res:gpr32sp = ADDWrx %add_lhs, [[COPY]], 8
177 ; CHECK-NEXT: $w3 = COPY %res
178 ; CHECK-NEXT: RET_ReallyLR implicit $w3
179 %1:gpr(s32) = COPY $w1
180 %mask:gpr(s32) = G_CONSTANT i32 65535 ; 0xffff
181 %ext:gpr(s32) = G_AND %1(s32), %mask
182 %add_lhs:gpr(s32) = COPY $w2
183 %res:gpr(s32) = G_ADD %add_lhs, %ext
185 RET_ReallyLR implicit $w3
188 name: add_sext_s8_to_s32
191 regBankSelected: true
192 tracksRegLiveness: true
193 machineFunctionInfo: {}
196 liveins: $w1, $w2, $x2
197 ; CHECK-LABEL: name: add_sext_s8_to_s32
198 ; CHECK: liveins: $w1, $w2, $x2
200 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
201 ; CHECK-NEXT: %add_lhs:gpr32sp = COPY $w2
202 ; CHECK-NEXT: %res:gpr32sp = ADDWrx %add_lhs, %wide_1, 32
203 ; CHECK-NEXT: $w3 = COPY %res
204 ; CHECK-NEXT: RET_ReallyLR implicit $w3
205 %wide_1:gpr(s32) = COPY $w1
206 %1:gpr(s8) = G_TRUNC %wide_1
207 %ext:gpr(s32) = G_SEXT %1(s8)
208 %add_lhs:gpr(s32) = COPY $w2
209 %res:gpr(s32) = G_ADD %add_lhs, %ext
211 RET_ReallyLR implicit $w3
214 name: add_zext_s8_to_s32
217 regBankSelected: true
218 tracksRegLiveness: true
219 machineFunctionInfo: {}
222 liveins: $w1, $w2, $x2
223 ; CHECK-LABEL: name: add_zext_s8_to_s32
224 ; CHECK: liveins: $w1, $w2, $x2
226 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
227 ; CHECK-NEXT: %add_lhs:gpr32sp = COPY $w2
228 ; CHECK-NEXT: %res:gpr32sp = ADDWrx %add_lhs, %wide_1, 0
229 ; CHECK-NEXT: $w3 = COPY %res
230 ; CHECK-NEXT: RET_ReallyLR implicit $w3
231 %wide_1:gpr(s32) = COPY $w1
232 %1:gpr(s8) = G_TRUNC %wide_1
233 %ext:gpr(s32) = G_ZEXT %1(s8)
234 %add_lhs:gpr(s32) = COPY $w2
235 %res:gpr(s32) = G_ADD %add_lhs, %ext
237 RET_ReallyLR implicit $w3
240 name: add_anyext_s8_to_s32
243 regBankSelected: true
244 tracksRegLiveness: true
245 machineFunctionInfo: {}
248 liveins: $w1, $w2, $x2
249 ; CHECK-LABEL: name: add_anyext_s8_to_s32
250 ; CHECK: liveins: $w1, $w2, $x2
252 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
253 ; CHECK-NEXT: %add_lhs:gpr32sp = COPY $w2
254 ; CHECK-NEXT: %res:gpr32sp = ADDWrx %add_lhs, %wide_1, 0
255 ; CHECK-NEXT: $w3 = COPY %res
256 ; CHECK-NEXT: RET_ReallyLR implicit $w3
257 %wide_1:gpr(s32) = COPY $w1
258 %1:gpr(s8) = G_TRUNC %wide_1
259 %ext:gpr(s32) = G_ANYEXT %1(s8)
260 %add_lhs:gpr(s32) = COPY $w2
261 %res:gpr(s32) = G_ADD %add_lhs, %ext
263 RET_ReallyLR implicit $w3
266 name: add_sext_with_shl
269 regBankSelected: true
270 tracksRegLiveness: true
271 machineFunctionInfo: {}
274 liveins: $w1, $w2, $x2
275 ; CHECK-LABEL: name: add_sext_with_shl
276 ; CHECK: liveins: $w1, $w2, $x2
278 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
279 ; CHECK-NEXT: %add_lhs:gpr32sp = COPY $w2
280 ; CHECK-NEXT: %res:gpr32sp = ADDWrx %add_lhs, %wide_1, 43
281 ; CHECK-NEXT: $w3 = COPY %res
282 ; CHECK-NEXT: RET_ReallyLR implicit $w3
283 %wide_1:gpr(s32) = COPY $w1
284 %1:gpr(s16) = G_TRUNC %wide_1
285 %ext:gpr(s32) = G_SEXT %1(s16)
286 %imm:gpr(s32) = G_CONSTANT i32 3
287 %shl:gpr(s32) = G_SHL %ext, %imm
288 %add_lhs:gpr(s32) = COPY $w2
289 %res:gpr(s32) = G_ADD %add_lhs, %shl
291 RET_ReallyLR implicit $w3
294 name: add_and_with_shl
297 regBankSelected: true
298 tracksRegLiveness: true
299 machineFunctionInfo: {}
302 liveins: $w1, $w2, $x2
303 ; CHECK-LABEL: name: add_and_with_shl
304 ; CHECK: liveins: $w1, $w2, $x2
306 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w1
307 ; CHECK-NEXT: %add_lhs:gpr32sp = COPY $w2
308 ; CHECK-NEXT: %res:gpr32sp = ADDWrx %add_lhs, [[COPY]], 3
309 ; CHECK-NEXT: $w3 = COPY %res
310 ; CHECK-NEXT: RET_ReallyLR implicit $w3
311 %1:gpr(s32) = COPY $w1
312 %mask:gpr(s32) = G_CONSTANT i32 255 ; 0xff
313 %ext:gpr(s32) = G_AND %1(s32), %mask
314 %imm:gpr(s32) = G_CONSTANT i32 3
315 %shl:gpr(s32) = G_SHL %ext, %imm
316 %add_lhs:gpr(s32) = COPY $w2
317 %res:gpr(s32) = G_ADD %add_lhs, %shl
319 RET_ReallyLR implicit $w3
322 name: dont_fold_invalid_mask
325 regBankSelected: true
326 tracksRegLiveness: true
327 machineFunctionInfo: {}
330 ; Check that we only fold when we have a supported AND mask.
331 liveins: $w1, $w2, $x2
332 ; CHECK-LABEL: name: dont_fold_invalid_mask
333 ; CHECK: liveins: $w1, $w2, $x2
335 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w1
336 ; CHECK-NEXT: %mask:gpr32 = MOVi32imm 42
337 ; CHECK-NEXT: %ext:gpr32 = ANDWrr [[COPY]], %mask
338 ; CHECK-NEXT: %add_lhs:gpr32 = COPY $w2
339 ; CHECK-NEXT: %res:gpr32 = ADDWrr %add_lhs, %ext
340 ; CHECK-NEXT: $w3 = COPY %res
341 ; CHECK-NEXT: RET_ReallyLR implicit $w3
342 %1:gpr(s32) = COPY $w1
343 %mask:gpr(s32) = G_CONSTANT i32 42
344 %ext:gpr(s32) = G_AND %1(s32), %mask
345 %add_lhs:gpr(s32) = COPY $w2
346 %res:gpr(s32) = G_ADD %add_lhs, %ext
348 RET_ReallyLR implicit $w3
351 name: dont_fold_invalid_shl
354 regBankSelected: true
355 tracksRegLiveness: true
356 machineFunctionInfo: {}
359 liveins: $w1, $w2, $x2
360 ; CHECK-LABEL: name: dont_fold_invalid_shl
361 ; CHECK: liveins: $w1, $w2, $x2
363 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
364 ; CHECK-NEXT: %ext:gpr32 = SBFMWri %wide_1, 0, 15
365 ; CHECK-NEXT: %add_lhs:gpr32 = COPY $w2
366 ; CHECK-NEXT: %res:gpr32 = ADDWrs %add_lhs, %ext, 5
367 ; CHECK-NEXT: $w3 = COPY %res
368 ; CHECK-NEXT: RET_ReallyLR implicit $w3
369 %wide_1:gpr(s32) = COPY $w1
370 %1:gpr(s16) = G_TRUNC %wide_1
371 %ext:gpr(s32) = G_SEXT %1(s16)
372 %imm:gpr(s32) = G_CONSTANT i32 5
373 %shl:gpr(s32) = G_SHL %ext, %imm
374 %add_lhs:gpr(s32) = COPY $w2
375 %res:gpr(s32) = G_ADD %add_lhs, %shl
377 RET_ReallyLR implicit $w3
380 name: sub_sext_s32_to_s64
383 regBankSelected: true
384 tracksRegLiveness: true
385 machineFunctionInfo: {}
389 ; CHECK-LABEL: name: sub_sext_s32_to_s64
390 ; CHECK: liveins: $w1, $x2
392 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w1
393 ; CHECK-NEXT: %sub_lhs:gpr64sp = COPY $x2
394 ; CHECK-NEXT: %res:gpr64 = SUBSXrx %sub_lhs, [[COPY]], 48, implicit-def dead $nzcv
395 ; CHECK-NEXT: $x3 = COPY %res
396 ; CHECK-NEXT: RET_ReallyLR implicit $x3
397 %1:gpr(s32) = COPY $w1
398 %ext:gpr(s64) = G_SEXT %1(s32)
399 %sub_lhs:gpr(s64) = COPY $x2
400 %res:gpr(s64) = G_SUB %sub_lhs, %ext
402 RET_ReallyLR implicit $x3
405 name: sub_sext_s16_to_s32
408 regBankSelected: true
409 tracksRegLiveness: true
410 machineFunctionInfo: {}
413 liveins: $w1, $w2, $x2
414 ; CHECK-LABEL: name: sub_sext_s16_to_s32
415 ; CHECK: liveins: $w1, $w2, $x2
417 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
418 ; CHECK-NEXT: %sub_lhs:gpr32sp = COPY $w2
419 ; CHECK-NEXT: %res:gpr32 = SUBSWrx %sub_lhs, %wide_1, 40, implicit-def dead $nzcv
420 ; CHECK-NEXT: $w3 = COPY %res
421 ; CHECK-NEXT: RET_ReallyLR implicit $w3
422 %wide_1:gpr(s32) = COPY $w1
423 %1:gpr(s16) = G_TRUNC %wide_1
424 %ext:gpr(s32) = G_SEXT %1(s16)
425 %sub_lhs:gpr(s32) = COPY $w2
426 %res:gpr(s32) = G_SUB %sub_lhs, %ext
428 RET_ReallyLR implicit $w3
431 name: sub_zext_s16_to_s32
434 regBankSelected: true
435 tracksRegLiveness: true
436 machineFunctionInfo: {}
439 liveins: $w1, $w2, $x2
440 ; CHECK-LABEL: name: sub_zext_s16_to_s32
441 ; CHECK: liveins: $w1, $w2, $x2
443 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
444 ; CHECK-NEXT: %sub_lhs:gpr32sp = COPY $w2
445 ; CHECK-NEXT: %res:gpr32 = SUBSWrx %sub_lhs, %wide_1, 8, implicit-def dead $nzcv
446 ; CHECK-NEXT: $w3 = COPY %res
447 ; CHECK-NEXT: RET_ReallyLR implicit $w3
448 %wide_1:gpr(s32) = COPY $w1
449 %1:gpr(s16) = G_TRUNC %wide_1
450 %ext:gpr(s32) = G_ZEXT %1(s16)
451 %sub_lhs:gpr(s32) = COPY $w2
452 %res:gpr(s32) = G_SUB %sub_lhs, %ext
454 RET_ReallyLR implicit $w3
457 name: sub_anyext_s16_to_s32
460 regBankSelected: true
461 tracksRegLiveness: true
462 machineFunctionInfo: {}
465 liveins: $w1, $w2, $x2
466 ; CHECK-LABEL: name: sub_anyext_s16_to_s32
467 ; CHECK: liveins: $w1, $w2, $x2
469 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
470 ; CHECK-NEXT: %sub_lhs:gpr32sp = COPY $w2
471 ; CHECK-NEXT: %res:gpr32 = SUBSWrx %sub_lhs, %wide_1, 8, implicit-def dead $nzcv
472 ; CHECK-NEXT: $w3 = COPY %res
473 ; CHECK-NEXT: RET_ReallyLR implicit $w3
474 %wide_1:gpr(s32) = COPY $w1
475 %1:gpr(s16) = G_TRUNC %wide_1
476 %ext:gpr(s32) = G_ANYEXT %1(s16)
477 %sub_lhs:gpr(s32) = COPY $w2
478 %res:gpr(s32) = G_SUB %sub_lhs, %ext
480 RET_ReallyLR implicit $w3
483 name: sub_and_s16_to_s32_uxtb
486 regBankSelected: true
487 tracksRegLiveness: true
488 machineFunctionInfo: {}
491 liveins: $w1, $w2, $x2
492 ; CHECK-LABEL: name: sub_and_s16_to_s32_uxtb
493 ; CHECK: liveins: $w1, $w2, $x2
495 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w1
496 ; CHECK-NEXT: %sub_lhs:gpr32sp = COPY $w2
497 ; CHECK-NEXT: %res:gpr32 = SUBSWrx %sub_lhs, [[COPY]], 0, implicit-def dead $nzcv
498 ; CHECK-NEXT: $w3 = COPY %res
499 ; CHECK-NEXT: RET_ReallyLR implicit $w3
500 %1:gpr(s32) = COPY $w1
501 %mask:gpr(s32) = G_CONSTANT i32 255 ; 0xff
502 %ext:gpr(s32) = G_AND %1(s32), %mask
503 %sub_lhs:gpr(s32) = COPY $w2
504 %res:gpr(s32) = G_SUB %sub_lhs, %ext
506 RET_ReallyLR implicit $w3
509 name: sub_and_s16_to_s32_uxth
512 regBankSelected: true
513 tracksRegLiveness: true
514 machineFunctionInfo: {}
517 liveins: $w1, $w2, $x2
518 ; CHECK-LABEL: name: sub_and_s16_to_s32_uxth
519 ; CHECK: liveins: $w1, $w2, $x2
521 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w1
522 ; CHECK-NEXT: %sub_lhs:gpr32sp = COPY $w2
523 ; CHECK-NEXT: %res:gpr32 = SUBSWrx %sub_lhs, [[COPY]], 8, implicit-def dead $nzcv
524 ; CHECK-NEXT: $w3 = COPY %res
525 ; CHECK-NEXT: RET_ReallyLR implicit $w3
526 %1:gpr(s32) = COPY $w1
527 %mask:gpr(s32) = G_CONSTANT i32 65535 ; 0xffff
528 %ext:gpr(s32) = G_AND %1(s32), %mask
529 %sub_lhs:gpr(s32) = COPY $w2
530 %res:gpr(s32) = G_SUB %sub_lhs, %ext
532 RET_ReallyLR implicit $w3
534 name: sub_sext_s8_to_s32
537 regBankSelected: true
538 tracksRegLiveness: true
539 machineFunctionInfo: {}
542 liveins: $w1, $w2, $x2
543 %wide_1:gpr(s32) = COPY $w1
544 %1:gpr(s8) = G_TRUNC %wide_1
545 %ext:gpr(s32) = G_SEXT %1(s8)
546 %sub_lhs:gpr(s32) = COPY $w2
547 %res:gpr(s32) = G_SUB %sub_lhs, %ext
549 RET_ReallyLR implicit $w3
552 name: sub_zext_s8_to_s32
555 regBankSelected: true
556 tracksRegLiveness: true
557 machineFunctionInfo: {}
560 liveins: $w1, $w2, $x2
561 ; CHECK-LABEL: name: sub_zext_s8_to_s32
562 ; CHECK: liveins: $w1, $w2, $x2
564 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
565 ; CHECK-NEXT: %sub_lhs:gpr32sp = COPY $w2
566 ; CHECK-NEXT: %res:gpr32 = SUBSWrx %sub_lhs, %wide_1, 0, implicit-def dead $nzcv
567 ; CHECK-NEXT: $w3 = COPY %res
568 ; CHECK-NEXT: RET_ReallyLR implicit $w3
569 %wide_1:gpr(s32) = COPY $w1
570 %1:gpr(s8) = G_TRUNC %wide_1
571 %ext:gpr(s32) = G_ZEXT %1(s8)
572 %sub_lhs:gpr(s32) = COPY $w2
573 %res:gpr(s32) = G_SUB %sub_lhs, %ext
575 RET_ReallyLR implicit $w3
578 name: sub_anyext_s8_to_s32
581 regBankSelected: true
582 tracksRegLiveness: true
583 machineFunctionInfo: {}
586 liveins: $w1, $w2, $x2
587 ; CHECK-LABEL: name: sub_anyext_s8_to_s32
588 ; CHECK: liveins: $w1, $w2, $x2
590 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
591 ; CHECK-NEXT: %sub_lhs:gpr32sp = COPY $w2
592 ; CHECK-NEXT: %res:gpr32 = SUBSWrx %sub_lhs, %wide_1, 0, implicit-def dead $nzcv
593 ; CHECK-NEXT: $w3 = COPY %res
594 ; CHECK-NEXT: RET_ReallyLR implicit $w3
595 %wide_1:gpr(s32) = COPY $w1
596 %1:gpr(s8) = G_TRUNC %wide_1
597 %ext:gpr(s32) = G_ANYEXT %1(s8)
598 %sub_lhs:gpr(s32) = COPY $w2
599 %res:gpr(s32) = G_SUB %sub_lhs, %ext
601 RET_ReallyLR implicit $w3
605 name: sub_sext_with_shl
608 regBankSelected: true
609 tracksRegLiveness: true
610 machineFunctionInfo: {}
613 liveins: $w1, $w2, $x2
614 ; CHECK-LABEL: name: sub_sext_with_shl
615 ; CHECK: liveins: $w1, $w2, $x2
617 ; CHECK-NEXT: %wide_1:gpr32 = COPY $w1
618 ; CHECK-NEXT: %sub_lhs:gpr32sp = COPY $w2
619 ; CHECK-NEXT: %res:gpr32 = SUBSWrx %sub_lhs, %wide_1, 43, implicit-def dead $nzcv
620 ; CHECK-NEXT: $w3 = COPY %res
621 ; CHECK-NEXT: RET_ReallyLR implicit $w3
622 %wide_1:gpr(s32) = COPY $w1
623 %1:gpr(s16) = G_TRUNC %wide_1
624 %ext:gpr(s32) = G_SEXT %1(s16)
625 %imm:gpr(s32) = G_CONSTANT i32 3
626 %shl:gpr(s32) = G_SHL %ext, %imm
627 %sub_lhs:gpr(s32) = COPY $w2
628 %res:gpr(s32) = G_SUB %sub_lhs, %shl
630 RET_ReallyLR implicit $w3
633 name: sub_and_with_shl
636 regBankSelected: true
637 tracksRegLiveness: true
638 machineFunctionInfo: {}
641 liveins: $w1, $w2, $x2
642 ; CHECK-LABEL: name: sub_and_with_shl
643 ; CHECK: liveins: $w1, $w2, $x2
645 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr32 = COPY $w1
646 ; CHECK-NEXT: %sub_lhs:gpr32sp = COPY $w2
647 ; CHECK-NEXT: %res:gpr32 = SUBSWrx %sub_lhs, [[COPY]], 3, implicit-def dead $nzcv
648 ; CHECK-NEXT: $w3 = COPY %res
649 ; CHECK-NEXT: RET_ReallyLR implicit $w3
650 %1:gpr(s32) = COPY $w1
651 %mask:gpr(s32) = G_CONSTANT i32 255 ; 0xff
652 %ext:gpr(s32) = G_AND %1(s32), %mask
653 %imm:gpr(s32) = G_CONSTANT i32 3
654 %shl:gpr(s32) = G_SHL %ext, %imm
655 %sub_lhs:gpr(s32) = COPY $w2
656 %res:gpr(s32) = G_SUB %sub_lhs, %shl
658 RET_ReallyLR implicit $w3
664 regBankSelected: true
665 tracksRegLiveness: true
672 liveins: $x0, $x1, $x2
674 ; CHECK-LABEL: name: store_16b_zext
675 ; CHECK: liveins: $x0, $x1, $x2
677 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
678 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
679 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64all = COPY $x2
680 ; CHECK-NEXT: [[SUBREG_TO_REG:%[0-9]+]]:gpr64 = SUBREG_TO_REG 0, [[COPY1]], %subreg.sub_32
681 ; CHECK-NEXT: %zext:gpr64 = UBFMXri [[SUBREG_TO_REG]], 0, 15
682 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64 = COPY [[COPY2]]
683 ; CHECK-NEXT: STRXroX [[COPY3]], [[COPY]], %zext, 0, 1 :: (store (p0))
684 ; CHECK-NEXT: RET_ReallyLR
685 %0:gpr(p0) = COPY $x0
686 %1:gpr(s32) = COPY $w1
687 %2:gpr(p0) = COPY $x2
688 %small:gpr(s16) = G_TRUNC %1
689 %zext:gpr(s64) = G_ZEXT %small(s16)
690 %cst:gpr(s64) = G_CONSTANT i64 3
691 %shl:gpr(s64) = G_SHL %zext, %cst(s64)
692 %gep:gpr(p0) = G_PTR_ADD %0, %shl(s64)
693 G_STORE %2(p0), %gep(p0) :: (store (p0))
700 regBankSelected: true
701 tracksRegLiveness: true
708 liveins: $x0, $x1, $x2
710 ; CHECK-LABEL: name: store_8b_zext
711 ; CHECK: liveins: $x0, $x1, $x2
713 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
714 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
715 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64all = COPY $x2
716 ; CHECK-NEXT: [[SUBREG_TO_REG:%[0-9]+]]:gpr64 = SUBREG_TO_REG 0, [[COPY1]], %subreg.sub_32
717 ; CHECK-NEXT: %zext:gpr64 = UBFMXri [[SUBREG_TO_REG]], 0, 7
718 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64 = COPY [[COPY2]]
719 ; CHECK-NEXT: STRXroX [[COPY3]], [[COPY]], %zext, 0, 1 :: (store (p0))
720 ; CHECK-NEXT: RET_ReallyLR
721 %0:gpr(p0) = COPY $x0
722 %1:gpr(s32) = COPY $w1
723 %2:gpr(p0) = COPY $x2
724 %small:gpr(s8) = G_TRUNC %1
725 %zext:gpr(s64) = G_ZEXT %small(s8)
726 %cst:gpr(s64) = G_CONSTANT i64 3
727 %shl:gpr(s64) = G_SHL %zext, %cst(s64)
728 %gep:gpr(p0) = G_PTR_ADD %0, %shl(s64)
729 G_STORE %2(p0), %gep(p0) :: (store (p0))
736 regBankSelected: true
737 tracksRegLiveness: true
744 liveins: $x0, $x1, $x2
746 ; CHECK-LABEL: name: store_16b_sext
747 ; CHECK: liveins: $x0, $x1, $x2
749 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
750 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
751 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64all = COPY $x2
752 ; CHECK-NEXT: [[SUBREG_TO_REG:%[0-9]+]]:gpr64 = SUBREG_TO_REG 0, [[COPY1]], %subreg.sub_32
753 ; CHECK-NEXT: %zext:gpr64 = SBFMXri [[SUBREG_TO_REG]], 0, 15
754 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64 = COPY [[COPY2]]
755 ; CHECK-NEXT: STRXroX [[COPY3]], [[COPY]], %zext, 0, 1 :: (store (p0))
756 ; CHECK-NEXT: RET_ReallyLR
757 %0:gpr(p0) = COPY $x0
758 %1:gpr(s32) = COPY $w1
759 %2:gpr(p0) = COPY $x2
760 %small:gpr(s16) = G_TRUNC %1
761 %zext:gpr(s64) = G_SEXT %small(s16)
762 %cst:gpr(s64) = G_CONSTANT i64 3
763 %shl:gpr(s64) = G_SHL %zext, %cst(s64)
764 %gep:gpr(p0) = G_PTR_ADD %0, %shl(s64)
765 G_STORE %2(p0), %gep(p0) :: (store (p0))
772 regBankSelected: true
773 tracksRegLiveness: true
780 liveins: $x0, $x1, $x2
782 ; CHECK-LABEL: name: store_8b_sext
783 ; CHECK: liveins: $x0, $x1, $x2
785 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
786 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
787 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr64all = COPY $x2
788 ; CHECK-NEXT: [[SUBREG_TO_REG:%[0-9]+]]:gpr64 = SUBREG_TO_REG 0, [[COPY1]], %subreg.sub_32
789 ; CHECK-NEXT: %zext:gpr64 = SBFMXri [[SUBREG_TO_REG]], 0, 7
790 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr64 = COPY [[COPY2]]
791 ; CHECK-NEXT: STRXroX [[COPY3]], [[COPY]], %zext, 0, 1 :: (store (p0))
792 ; CHECK-NEXT: RET_ReallyLR
793 %0:gpr(p0) = COPY $x0
794 %1:gpr(s32) = COPY $w1
795 %2:gpr(p0) = COPY $x2
796 %small:gpr(s8) = G_TRUNC %1
797 %zext:gpr(s64) = G_SEXT %small(s8)
798 %cst:gpr(s64) = G_CONSTANT i64 3
799 %shl:gpr(s64) = G_SHL %zext, %cst(s64)
800 %gep:gpr(p0) = G_PTR_ADD %0, %shl(s64)
801 G_STORE %2(p0), %gep(p0) :: (store (p0))