1 # RUN: llc -O0 -mtriple thumb-- -mattr=+v6t2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
3 define void @test_trunc_and_zext_s1_to_s32() { ret void }
4 define void @test_trunc_and_sext_s1_to_s32() { ret void }
5 define void @test_trunc_and_anyext_s1_to_s32() { ret void }
7 define void @test_trunc_and_zext_s8_to_s32() { ret void }
8 define void @test_trunc_and_sext_s8_to_s32() { ret void }
9 define void @test_trunc_and_anyext_s8_to_s32() { ret void }
11 define void @test_trunc_and_zext_s16_to_s32() { ret void }
12 define void @test_trunc_and_sext_s16_to_s32() { ret void }
13 define void @test_trunc_and_anyext_s16_to_s32() { ret void }
15 define void @test_trunc_and_zext_s1_to_s16() { ret void }
16 define void @test_trunc_and_sext_s1_to_s16() { ret void }
17 define void @test_trunc_and_anyext_s1_to_s16() { ret void }
19 define void @test_trunc_and_zext_s8_to_s16() { ret void }
20 define void @test_trunc_and_sext_s8_to_s16() { ret void }
21 define void @test_trunc_and_anyext_s8_to_s16() { ret void }
23 define void @test_trunc_and_zext_s1_to_s8() { ret void }
24 define void @test_trunc_and_sext_s1_to_s8() { ret void }
25 define void @test_trunc_and_anyext_s1_to_s8() { ret void }
28 name: test_trunc_and_zext_s1_to_s32
29 # CHECK-LABEL: name: test_trunc_and_zext_s1_to_s32
33 # CHECK: selected: true
34 tracksRegLiveness: true
36 - { id: 0, class: gprb }
37 - { id: 1, class: gprb }
38 - { id: 2, class: gprb }
44 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
46 %1(s1) = G_TRUNC %0(s32)
48 %2(s32) = G_ZEXT %1(s1)
49 ; CHECK: [[RVREG:%[0-9]+]]:rgpr = COPY [[VREG]]
50 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2ANDri [[RVREG]], 1, 14, $noreg, $noreg
53 ; CHECK: $r0 = COPY [[VREGEXT]]
55 BX_RET 14, $noreg, implicit $r0
56 ; CHECK: BX_RET 14, $noreg, implicit $r0
59 name: test_trunc_and_sext_s1_to_s32
60 # CHECK-LABEL: name: test_trunc_and_sext_s1_to_s32
64 # CHECK: selected: true
65 tracksRegLiveness: true
67 - { id: 0, class: gprb }
68 - { id: 1, class: gprb }
69 - { id: 2, class: gprb }
75 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
77 %1(s1) = G_TRUNC %0(s32)
79 %2(s32) = G_SEXT %1(s1)
80 ; CHECK: [[RVREG:%[0-9]+]]:rgpr = COPY [[VREG]]
81 ; CHECK: [[VREGAND:%[0-9]+]]:rgpr = t2ANDri [[RVREG]], 1, 14, $noreg, $noreg
82 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2RSBri [[VREGAND]], 0, 14, $noreg, $noreg
85 ; CHECK: $r0 = COPY [[VREGEXT]]
87 BX_RET 14, $noreg, implicit $r0
88 ; CHECK: BX_RET 14, $noreg, implicit $r0
91 name: test_trunc_and_anyext_s1_to_s32
92 # CHECK-LABEL: name: test_trunc_and_anyext_s1_to_s32
96 # CHECK: selected: true
97 tracksRegLiveness: true
99 - { id: 0, class: gprb }
100 - { id: 1, class: gprb }
101 - { id: 2, class: gprb }
107 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
109 %1(s1) = G_TRUNC %0(s32)
111 %2(s32) = G_ANYEXT %1(s1)
114 ; CHECK: $r0 = COPY [[VREG]]
116 BX_RET 14, $noreg, implicit $r0
117 ; CHECK: BX_RET 14, $noreg, implicit $r0
120 name: test_trunc_and_zext_s8_to_s32
121 # CHECK-LABEL: name: test_trunc_and_zext_s8_to_s32
123 regBankSelected: true
125 # CHECK: selected: true
126 tracksRegLiveness: true
128 - { id: 0, class: gprb }
129 - { id: 1, class: gprb }
130 - { id: 2, class: gprb }
136 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
138 %1(s8) = G_TRUNC %0(s32)
139 ; CHECK: [[VREGTRUNC:%[0-9]+]]:rgpr = COPY [[VREG]]
141 %2(s32) = G_ZEXT %1(s8)
142 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2UXTB [[VREGTRUNC]], 0, 14, $noreg
145 ; CHECK: $r0 = COPY [[VREGEXT]]
147 BX_RET 14, $noreg, implicit $r0
148 ; CHECK: BX_RET 14, $noreg, implicit $r0
151 name: test_trunc_and_sext_s8_to_s32
152 # CHECK-LABEL: name: test_trunc_and_sext_s8_to_s32
154 regBankSelected: true
156 # CHECK: selected: true
157 tracksRegLiveness: true
159 - { id: 0, class: gprb }
160 - { id: 1, class: gprb }
161 - { id: 2, class: gprb }
167 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
169 %1(s8) = G_TRUNC %0(s32)
170 ; CHECK: [[VREGTRUNC:%[0-9]+]]:rgpr = COPY [[VREG]]
172 %2(s32) = G_SEXT %1(s8)
173 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2SXTB [[VREGTRUNC]], 0, 14, $noreg
176 ; CHECK: $r0 = COPY [[VREGEXT]]
178 BX_RET 14, $noreg, implicit $r0
179 ; CHECK: BX_RET 14, $noreg, implicit $r0
182 name: test_trunc_and_anyext_s8_to_s32
183 # CHECK-LABEL: name: test_trunc_and_anyext_s8_to_s32
185 regBankSelected: true
187 # CHECK: selected: true
188 tracksRegLiveness: true
190 - { id: 0, class: gprb }
191 - { id: 1, class: gprb }
192 - { id: 2, class: gprb }
198 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
200 %1(s8) = G_TRUNC %0(s32)
202 %2(s32) = G_ANYEXT %1(s8)
205 ; CHECK: $r0 = COPY [[VREG]]
207 BX_RET 14, $noreg, implicit $r0
208 ; CHECK: BX_RET 14, $noreg, implicit $r0
211 name: test_trunc_and_zext_s16_to_s32
212 # CHECK-LABEL: name: test_trunc_and_zext_s16_to_s32
214 regBankSelected: true
216 # CHECK: selected: true
217 tracksRegLiveness: true
219 - { id: 0, class: gprb }
220 - { id: 1, class: gprb }
221 - { id: 2, class: gprb }
227 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
229 %1(s16) = G_TRUNC %0(s32)
230 ; CHECK: [[VREGTRUNC:%[0-9]+]]:rgpr = COPY [[VREG]]
232 %2(s32) = G_ZEXT %1(s16)
233 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2UXTH [[VREGTRUNC]], 0, 14, $noreg
236 ; CHECK: $r0 = COPY [[VREGEXT]]
238 BX_RET 14, $noreg, implicit $r0
239 ; CHECK: BX_RET 14, $noreg, implicit $r0
242 name: test_trunc_and_sext_s16_to_s32
243 # CHECK-LABEL: name: test_trunc_and_sext_s16_to_s32
245 regBankSelected: true
247 # CHECK: selected: true
248 tracksRegLiveness: true
250 - { id: 0, class: gprb }
251 - { id: 1, class: gprb }
252 - { id: 2, class: gprb }
258 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
260 %1(s16) = G_TRUNC %0(s32)
261 ; CHECK: [[VREGTRUNC:%[0-9]+]]:rgpr = COPY [[VREG]]
263 %2(s32) = G_SEXT %1(s16)
264 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2SXTH [[VREGTRUNC]], 0, 14, $noreg
267 ; CHECK: $r0 = COPY [[VREGEXT]]
269 BX_RET 14, $noreg, implicit $r0
270 ; CHECK: BX_RET 14, $noreg, implicit $r0
273 name: test_trunc_and_anyext_s16_to_s32
274 # CHECK-LABEL: name: test_trunc_and_anyext_s16_to_s32
276 regBankSelected: true
278 # CHECK: selected: true
279 tracksRegLiveness: true
281 - { id: 0, class: gprb }
282 - { id: 1, class: gprb }
283 - { id: 2, class: gprb }
289 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
291 %1(s16) = G_TRUNC %0(s32)
293 %2(s32) = G_ANYEXT %1(s16)
296 ; CHECK: $r0 = COPY [[VREG]]
298 BX_RET 14, $noreg, implicit $r0
299 ; CHECK: BX_RET 14, $noreg, implicit $r0
302 name: test_trunc_and_zext_s1_to_s16
303 # CHECK-LABEL: name: test_trunc_and_zext_s1_to_s16
305 regBankSelected: true
307 # CHECK: selected: true
308 tracksRegLiveness: true
310 - { id: 0, class: gprb }
311 - { id: 1, class: gprb }
312 - { id: 2, class: gprb }
313 - { id: 3, class: gprb }
319 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
322 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
324 %2(s1) = G_TRUNC %1(s32)
326 %3(s16) = G_ZEXT %2(s1)
327 ; CHECK: [[RVREG:%[0-9]+]]:rgpr = COPY [[VREG]]
328 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2ANDri [[RVREG]], 1, 14, $noreg, $noreg
330 G_STORE %3(s16), %0(p0) :: (store 2)
331 ; CHECK: t2STRHi12 [[VREGEXT]], [[PTR]], 0, 14, $noreg :: (store 2)
334 ; CHECK: BX_RET 14, $noreg
337 name: test_trunc_and_sext_s1_to_s16
338 # CHECK-LABEL: name: test_trunc_and_sext_s1_to_s16
340 regBankSelected: true
342 # CHECK: selected: true
343 tracksRegLiveness: true
345 - { id: 0, class: gprb }
346 - { id: 1, class: gprb }
347 - { id: 2, class: gprb }
348 - { id: 3, class: gprb }
354 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
357 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
359 %2(s1) = G_TRUNC %1(s32)
361 %3(s16) = G_SEXT %2(s1)
362 ; CHECK: [[RVREG:%[0-9]+]]:rgpr = COPY [[VREG]]
363 ; CHECK: [[VREGAND:%[0-9]+]]:rgpr = t2ANDri [[RVREG]], 1, 14, $noreg, $noreg
364 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2RSBri [[VREGAND]], 0, 14, $noreg, $noreg
366 G_STORE %3(s16), %0(p0) :: (store 2)
367 ; CHECK: t2STRHi12 [[VREGEXT]], [[PTR]], 0, 14, $noreg :: (store 2)
370 ; CHECK: BX_RET 14, $noreg
373 name: test_trunc_and_anyext_s1_to_s16
374 # CHECK-LABEL: name: test_trunc_and_anyext_s1_to_s16
376 regBankSelected: true
378 # CHECK: selected: true
379 tracksRegLiveness: true
381 - { id: 0, class: gprb }
382 - { id: 1, class: gprb }
383 - { id: 2, class: gprb }
384 - { id: 3, class: gprb }
390 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
393 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
395 %2(s1) = G_TRUNC %1(s32)
397 %3(s16) = G_ANYEXT %2(s1)
399 G_STORE %3(s16), %0(p0) :: (store 2)
400 ; CHECK: [[RVREG:%[0-9]+]]:rgpr = COPY [[VREG]]
401 ; CHECK: t2STRHi12 [[RVREG]], [[PTR]], 0, 14, $noreg :: (store 2)
404 ; CHECK: BX_RET 14, $noreg
407 name: test_trunc_and_zext_s8_to_s16
408 # CHECK-LABEL: name: test_trunc_and_zext_s8_to_s16
410 regBankSelected: true
412 # CHECK: selected: true
413 tracksRegLiveness: true
415 - { id: 0, class: gprb }
416 - { id: 1, class: gprb }
417 - { id: 2, class: gprb }
418 - { id: 3, class: gprb }
424 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
427 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
429 %2(s8) = G_TRUNC %1(s32)
430 ; CHECK: [[VREGTRUNC:%[1-9]+]]:rgpr = COPY [[VREG]]
432 %3(s16) = G_ZEXT %2(s8)
433 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2UXTB [[VREGTRUNC]], 0, 14, $noreg
435 G_STORE %3(s16), %0(p0) :: (store 2)
436 ; CHECK: t2STRHi12 [[VREGEXT]], [[PTR]], 0, 14, $noreg :: (store 2)
439 ; CHECK: BX_RET 14, $noreg
442 name: test_trunc_and_sext_s8_to_s16
443 # CHECK-LABEL: name: test_trunc_and_sext_s8_to_s16
445 regBankSelected: true
447 # CHECK: selected: true
448 tracksRegLiveness: true
450 - { id: 0, class: gprb }
451 - { id: 1, class: gprb }
452 - { id: 2, class: gprb }
453 - { id: 3, class: gprb }
459 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
462 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
464 %2(s8) = G_TRUNC %1(s32)
465 ; CHECK: [[VREGTRUNC:%[1-9]+]]:rgpr = COPY [[VREG]]
467 %3(s16) = G_SEXT %2(s8)
468 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2SXTB [[VREGTRUNC]], 0, 14, $noreg
470 G_STORE %3(s16), %0(p0) :: (store 2)
471 ; CHECK: t2STRHi12 [[VREGEXT]], [[PTR]], 0, 14, $noreg :: (store 2)
474 ; CHECK: BX_RET 14, $noreg
477 name: test_trunc_and_anyext_s8_to_s16
478 # CHECK-LABEL: name: test_trunc_and_anyext_s8_to_s16
480 regBankSelected: true
482 # CHECK: selected: true
483 tracksRegLiveness: true
485 - { id: 0, class: gprb }
486 - { id: 1, class: gprb }
487 - { id: 2, class: gprb }
488 - { id: 3, class: gprb }
494 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
497 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
499 %2(s8) = G_TRUNC %1(s32)
501 %3(s16) = G_ANYEXT %2(s8)
503 G_STORE %3(s16), %0(p0) :: (store 2)
504 ; CHECK: [[VREGR:%[0-9]+]]:rgpr = COPY [[VREG]]
505 ; CHECK: t2STRHi12 [[VREGR]], [[PTR]], 0, 14, $noreg :: (store 2)
508 ; CHECK: BX_RET 14, $noreg
511 name: test_trunc_and_zext_s1_to_s8
512 # CHECK-LABEL: name: test_trunc_and_zext_s1_to_s8
514 regBankSelected: true
516 # CHECK: selected: true
517 tracksRegLiveness: true
519 - { id: 0, class: gprb }
520 - { id: 1, class: gprb }
521 - { id: 2, class: gprb }
522 - { id: 3, class: gprb }
528 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
531 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
533 %2(s1) = G_TRUNC %1(s32)
535 %3(s8) = G_ZEXT %2(s1)
536 ; CHECK: [[RVREG:%[0-9]+]]:rgpr = COPY [[VREG]]
537 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2ANDri [[RVREG]], 1, 14, $noreg, $noreg
539 G_STORE %3(s8), %0(p0) :: (store 1)
540 ; CHECK: t2STRBi12 [[VREGEXT]], [[PTR]], 0, 14, $noreg :: (store 1)
543 ; CHECK: BX_RET 14, $noreg
546 name: test_trunc_and_sext_s1_to_s8
547 # CHECK-LABEL: name: test_trunc_and_sext_s1_to_s8
549 regBankSelected: true
551 # CHECK: selected: true
552 tracksRegLiveness: true
554 - { id: 0, class: gprb }
555 - { id: 1, class: gprb }
556 - { id: 2, class: gprb }
557 - { id: 3, class: gprb }
563 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
566 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
568 %2(s1) = G_TRUNC %1(s32)
570 %3(s8) = G_SEXT %2(s1)
571 ; CHECK: [[RVREG:%[0-9]+]]:rgpr = COPY [[VREG]]
572 ; CHECK: [[VREGAND:%[0-9]+]]:rgpr = t2ANDri [[RVREG]], 1, 14, $noreg, $noreg
573 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2RSBri [[VREGAND]], 0, 14, $noreg, $noreg
575 G_STORE %3(s8), %0(p0) :: (store 1)
576 ; CHECK: t2STRBi12 [[VREGEXT]], [[PTR]], 0, 14, $noreg :: (store 1)
579 ; CHECK: BX_RET 14, $noreg
582 name: test_trunc_and_anyext_s1_to_s8
583 # CHECK-LABEL: name: test_trunc_and_anyext_s1_to_s8
585 regBankSelected: true
587 # CHECK: selected: true
588 tracksRegLiveness: true
590 - { id: 0, class: gprb }
591 - { id: 1, class: gprb }
592 - { id: 2, class: gprb }
593 - { id: 3, class: gprb }
599 ; CHECK: [[PTR:%[0-9]+]]:gpr = COPY $r0
602 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r1
604 %2(s1) = G_TRUNC %1(s32)
606 %3(s8) = G_ANYEXT %2(s1)
608 G_STORE %3(s8), %0(p0) :: (store 1)
609 ; CHECK: [[RVREG:%[0-9]+]]:rgpr = COPY [[VREG]]
610 ; CHECK: t2STRBi12 [[RVREG]], [[PTR]], 0, 14, $noreg :: (store 1)
613 ; CHECK: BX_RET 14, $noreg