167 lines · plain
1# RUN: llc -mtriple arm-- -run-pass=legalizer %s -o - | FileCheck %s2# RUN: llc -mtriple thumb-- -mattr=+v6t2 -run-pass=legalizer %s -o - | FileCheck %s3--- |4 define void @test_brcond() { ret void }5 6 define void @test_phi_s32() { ret void }7 define void @test_phi_p0() { ret void }8 define void @test_phi_s8() { ret void }9...10---11name: test_brcond12# CHECK-LABEL: name: test_brcond13legalized: false14# CHECK: legalized: true15regBankSelected: false16selected: false17tracksRegLiveness: true18registers:19 - { id: 0, class: _ }20 - { id: 1, class: _ }21 - { id: 2, class: _ }22body: |23 bb.0:24 successors: %bb.1(0x40000000), %bb.2(0x40000000)25 liveins: $r0, $r126 27 %0(s32) = COPY $r028 %1(s32) = COPY $r129 %2(s1) = G_ICMP intpred(sgt), %0(s32), %130 G_BRCOND %2(s1), %bb.131 ; G_BRCOND with s1 is legal, so we should find it unchanged in the output32 ; CHECK: G_BRCOND {{%[0-9]+}}(s1), %bb.133 G_BR %bb.234 35 bb.1:36 $r0 = COPY %1(s32)37 BX_RET 14, $noreg, implicit $r038 39 bb.2:40 $r0 = COPY %0(s32)41 BX_RET 14, $noreg, implicit $r042 43...44---45name: test_phi_s3246# CHECK-LABEL: name: test_phi_s3247legalized: false48# CHECK: legalized: true49regBankSelected: false50selected: false51tracksRegLiveness: true52registers:53 - { id: 0, class: _ }54 - { id: 1, class: _ }55 - { id: 2, class: _ }56 - { id: 3, class: _ }57 - { id: 4, class: _ }58body: |59 bb.0:60 liveins: $r0, $r1, $r261 62 %0(s32) = COPY $r063 %1(s1) = G_TRUNC %0(s32)64 65 %2(s32) = COPY $r166 %3(s32) = COPY $r267 68 G_BRCOND %1(s1), %bb.169 G_BR %bb.270 71 bb.1:72 G_BR %bb.273 74 bb.2:75 %4(s32) = G_PHI %2(s32), %bb.0, %3(s32), %bb.176 ; G_PHI with s32 is legal, so we should find it unchanged in the output77 ; CHECK: G_PHI {{%[0-9]+}}(s32), %bb.0, {{%[0-9]+}}(s32), %bb.178 $r0 = COPY %4(s32)79 BX_RET 14, $noreg, implicit $r080...81---82name: test_phi_p083# CHECK-LABEL: name: test_phi_p084legalized: false85# CHECK: legalized: true86regBankSelected: false87selected: false88tracksRegLiveness: true89registers:90 - { id: 0, class: _ }91 - { id: 1, class: _ }92 - { id: 2, class: _ }93 - { id: 3, class: _ }94 - { id: 4, class: _ }95body: |96 bb.0:97 liveins: $r0, $r1, $r298 99 %0(s32) = COPY $r0100 %1(s1) = G_TRUNC %0(s32)101 102 %2(p0) = COPY $r1103 %3(p0) = COPY $r2104 105 G_BRCOND %1(s1), %bb.1106 G_BR %bb.2107 108 bb.1:109 G_BR %bb.2110 111 bb.2:112 %4(p0) = G_PHI %2(p0), %bb.0, %3(p0), %bb.1113 ; G_PHI with p0 is legal, so we should find it unchanged in the output114 ; CHECK: G_PHI {{%[0-9]+}}(p0), %bb.0, {{%[0-9]+}}(p0), %bb.1115 $r0 = COPY %4(p0)116 BX_RET 14, $noreg, implicit $r0117...118---119name: test_phi_s8120# CHECK-LABEL: name: test_phi_s8121legalized: false122# CHECK: legalized: true123regBankSelected: false124selected: false125tracksRegLiveness: true126registers: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: _ }135body: |136 bb.0:137 liveins: $r0, $r1, $r2138 139 %0(s32) = COPY $r0140 %1(s1) = G_TRUNC %0(s32)141 142 %2(s32) = COPY $r1143 %3(s8) = G_TRUNC %2(s32)144 ; CHECK: [[R1:%[0-9]+]]:_(s32) = COPY $r1145 146 %4(s32) = COPY $r2147 %5(s8) = G_TRUNC %4(s32)148 ; CHECK: [[R2:%[0-9]+]]:_(s32) = COPY $r2149 150 G_BRCOND %1(s1), %bb.1151 G_BR %bb.2152 153 bb.1:154 G_BR %bb.2155 156 bb.2:157 %6(s8) = G_PHI %3(s8), %bb.0, %5(s8), %bb.1158 ; G_PHI with s8 should widen, and all the truncs and exts should be combined159 ; away into a bunch of redundant copies160 ; CHECK: [[V:%[0-9]+]]:_(s32) = G_PHI [[R1]](s32), %bb.0, [[R2]](s32), %bb.1161 162 %7(s32) = G_ANYEXT %6(s8)163 $r0 = COPY %7(s32)164 ; CHECK: $r0 = COPY [[V]](s32)165 BX_RET 14, $noreg, implicit $r0166...167