1 # RUN: llc -mtriple arm-- -run-pass=legalizer %s -o - | FileCheck %s
2 # RUN: llc -mtriple thumb-- -mattr=+v6t2 -run-pass=legalizer %s -o - | FileCheck %s
4 define void @test_brcond() { ret void }
6 define void @test_phi_s32() { ret void }
7 define void @test_phi_p0() { ret void }
8 define void @test_phi_s8() { ret void }
12 # CHECK-LABEL: name: test_brcond
14 # CHECK: legalized: true
15 regBankSelected: false
17 tracksRegLiveness: true
24 successors: %bb.1(0x40000000), %bb.2(0x40000000)
29 %2(s1) = G_ICMP intpred(sgt), %0(s32), %1
30 G_BRCOND %2(s1), %bb.1
31 ; G_BRCOND with s1 is legal, so we should find it unchanged in the output
32 ; CHECK: G_BRCOND {{%[0-9]+}}(s1), %bb.1
37 BX_RET 14, $noreg, implicit $r0
41 BX_RET 14, $noreg, implicit $r0
46 # CHECK-LABEL: name: test_phi_s32
48 # CHECK: legalized: true
49 regBankSelected: false
51 tracksRegLiveness: true
60 liveins: $r0, $r1, $r2
63 %1(s1) = G_TRUNC %0(s32)
68 G_BRCOND %1(s1), %bb.1
75 %4(s32) = G_PHI %2(s32), %bb.0, %3(s32), %bb.1
76 ; G_PHI with s32 is legal, so we should find it unchanged in the output
77 ; CHECK: G_PHI {{%[0-9]+}}(s32), %bb.0, {{%[0-9]+}}(s32), %bb.1
79 BX_RET 14, $noreg, implicit $r0
83 # CHECK-LABEL: name: test_phi_p0
85 # CHECK: legalized: true
86 regBankSelected: false
88 tracksRegLiveness: true
97 liveins: $r0, $r1, $r2
100 %1(s1) = G_TRUNC %0(s32)
105 G_BRCOND %1(s1), %bb.1
112 %4(p0) = G_PHI %2(p0), %bb.0, %3(p0), %bb.1
113 ; G_PHI with p0 is legal, so we should find it unchanged in the output
114 ; CHECK: G_PHI {{%[0-9]+}}(p0), %bb.0, {{%[0-9]+}}(p0), %bb.1
116 BX_RET 14, $noreg, implicit $r0
120 # CHECK-LABEL: name: test_phi_s8
122 # CHECK: legalized: true
123 regBankSelected: false
125 tracksRegLiveness: true
127 - { id: 0, class: _ }
128 - { id: 1, class: _ }
129 - { id: 2, class: _ }
130 - { id: 3, class: _ }
131 - { id: 4, class: _ }
132 - { id: 5, class: _ }
133 - { id: 6, class: _ }
134 - { id: 7, class: _ }
137 liveins: $r0, $r1, $r2
140 %1(s1) = G_TRUNC %0(s32)
143 %3(s8) = G_TRUNC %2(s32)
144 ; CHECK: [[R1:%[0-9]+]]:_(s32) = COPY $r1
147 %5(s8) = G_TRUNC %4(s32)
148 ; CHECK: [[R2:%[0-9]+]]:_(s32) = COPY $r2
150 G_BRCOND %1(s1), %bb.1
157 %6(s8) = G_PHI %3(s8), %bb.0, %5(s8), %bb.1
158 ; G_PHI with s8 should widen, and all the truncs and exts should be combined
159 ; away into a bunch of redundant copies
160 ; CHECK: [[V:%[0-9]+]]:_(s32) = G_PHI [[R1]](s32), %bb.0, [[R2]](s32), %bb.1
162 %7(s32) = G_ANYEXT %6(s8)
164 ; CHECK: $r0 = COPY [[V]](s32)
165 BX_RET 14, $noreg, implicit $r0