221 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_zext_s16_to_s32() { ret void }5 define void @test_sext_s8_to_s32() { ret void }6 define void @test_sext_inreg_s8_to_s32() { ret void }7 define void @test_anyext_s1_to_s32() { ret void }8 9 define void @test_zext_s8_to_s16() { ret void }10 define void @test_sext_s1_to_s16() { ret void }11 12 define void @test_anyext_s1_to_s8() { ret void }13 14 define void @test_ext_combine() { ret void }15...16---17name: test_zext_s16_to_s3218# CHECK-LABEL: name: test_zext_s16_to_s3219legalized: false20# CHECK: legalized: true21regBankSelected: false22selected: false23tracksRegLiveness: true24registers:25 - { id: 0, class: _ }26 - { id: 1, class: _ }27 - { id: 2, class: _ }28body: |29 bb.0:30 liveins: $r031 32 %0(p0) = COPY $r033 %1(s16) = G_LOAD %0 :: (load (s16))34 %2(s32) = G_ZEXT %135 ; G_ZEXT with s16 is legal, so we should find it unchanged in the output36 ; CHECK: {{%[0-9]+}}:_(s32) = G_ZEXT {{%[0-9]+}}37 $r0 = COPY %2(s32)38 BX_RET 14, $noreg, implicit $r039...40---41name: test_sext_s8_to_s3242# CHECK-LABEL: name: test_sext_s8_to_s3243legalized: false44# CHECK: legalized: true45regBankSelected: false46selected: false47tracksRegLiveness: true48registers:49 - { id: 0, class: _ }50 - { id: 1, class: _ }51 - { id: 2, class: _ }52body: |53 bb.0:54 liveins: $r055 56 %0(p0) = COPY $r057 %1(s8) = G_LOAD %0(p0) :: (load (s8))58 %2(s32) = G_SEXT %159 ; G_SEXT with s8 is legal, so we should find it unchanged in the output60 ; CHECK: {{%[0-9]+}}:_(s32) = G_SEXT {{%[0-9]+}}61 $r0 = COPY %2(s32)62 BX_RET 14, $noreg, implicit $r063...64---65name: test_sext_inreg_s8_to_s3266# CHECK-LABEL: name: test_sext_inreg_s8_to_s3267legalized: false68# CHECK: legalized: true69regBankSelected: false70selected: false71tracksRegLiveness: true72registers:73 - { id: 0, class: _ }74 - { id: 1, class: _ }75 - { id: 2, class: _ }76body: |77 bb.0:78 liveins: $r079 80 %0(p0) = COPY $r081 %1(s32) = G_LOAD %0(p0) :: (load (s32))82 %2(s32) = G_SEXT_INREG %1, 883 ; G_SEXT_INREG should be lowered to a shift pair84 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_CONSTANT i32 2485 ; CHECK: [[T2:%[0-9]+]]:_(s32) = G_SHL {{%[0-9]+}}, [[T1]]86 ; CHECK: {{%[0-9]+}}:_(s32) = G_ASHR [[T2]], [[T1]]87 $r0 = COPY %2(s32)88 BX_RET 14, $noreg, implicit $r089...90---91name: test_anyext_s1_to_s3292# CHECK-LABEL: name: test_anyext_s1_to_s3293legalized: false94# CHECK: legalized: true95regBankSelected: false96selected: false97tracksRegLiveness: true98registers:99 - { id: 0, class: _ }100 - { id: 1, class: _ }101 - { id: 2, class: _ }102body: |103 bb.0:104 liveins: $r0105 106 %0(p0) = COPY $r0107 %1(s1) = G_LOAD %0(p0) :: (load (s1))108 %2(s32) = G_ANYEXT %1109 ; G_ANYEXT with s1 is legal, so we should find it unchanged in the output110 ; CHECK: {{%[0-9]+}}:_(s32) = G_ANYEXT {{%[0-9]+}}111 $r0 = COPY %2(s32)112 BX_RET 14, $noreg, implicit $r0113...114---115name: test_zext_s8_to_s16116# CHECK-LABEL: name: test_zext_s8_to_s16117legalized: false118# CHECK: legalized: true119regBankSelected: false120selected: false121tracksRegLiveness: true122registers:123 - { id: 0, class: _ }124 - { id: 1, class: _ }125 - { id: 2, class: _ }126body: |127 bb.0:128 liveins: $r0129 130 %0(p0) = COPY $r0131 %1(s8) = G_LOAD %0(p0) :: (load (s8))132 %2(s16) = G_ZEXT %1133 ; G_ZEXT from s8 to s16 is legal, so we should find it unchanged in the output134 ; CHECK: {{%[0-9]+}}:_(s16) = G_ZEXT {{%[0-9]+}}(s8)135 G_STORE %2(s16), %0(p0) :: (store (s16))136 BX_RET 14, $noreg137...138---139name: test_sext_s1_to_s16140# CHECK-LABEL: name: test_sext_s1_to_s16141legalized: false142# CHECK: legalized: true143regBankSelected: false144selected: false145tracksRegLiveness: true146body: |147 bb.0:148 liveins: $r0, $r1149 150 %0:_(p0) = COPY $r0151 %1:_(s32) = COPY $r1152 %2:_(s32) = G_CONSTANT i32 0153 %3:_(s1) = G_ICMP intpred(eq), %1, %2154 %4:_(s16) = G_SEXT %3(s1)155 ; G_SEXT from s1 to s16 is legal, so we should find it unchanged in the output156 ; CHECK: {{%[0-9]+}}:_(s16) = G_SEXT {{%[0-9]+}}(s1)157 G_STORE %4(s16), %0(p0) :: (store (s16))158 BX_RET 14, $noreg159...160---161name: test_anyext_s1_to_s8162# CHECK-LABEL: name: test_anyext_s1_to_s8163legalized: false164# CHECK: legalized: true165regBankSelected: false166selected: false167tracksRegLiveness: true168body: |169 bb.0:170 liveins: $r0, $r1171 172 %0:_(p0) = COPY $r0173 %1:_(s32) = COPY $r1174 %2:_(s32) = G_CONSTANT i32 0175 %3:_(s1) = G_ICMP intpred(eq), %1, %2176 %4:_(s8) = G_ANYEXT %3177 ; G_ANYEXT from s1 to s8 is legal, so we should find it unchanged in the output178 ; CHECK: {{%[0-9]+}}:_(s8) = G_ANYEXT {{%[0-9]+}}(s1)179 G_STORE %4(s8), %0(p0) :: (store (s8))180 BX_RET 14, $noreg181...182---183name: test_ext_combine184# CHECK-LABEL: name: test_ext_combine185legalized: false186# CHECK: legalized: true187regBankSelected: false188selected: false189tracksRegLiveness: true190registers:191 - { id: 0, class: _ }192 - { id: 1, class: _ }193 - { id: 2, class: _ }194 - { id: 3, class: _ }195 - { id: 4, class: _ }196 - { id: 5, class: _ }197body: |198 bb.0:199 liveins: $r0200 201 %0(p0) = COPY $r0202 %1(s8) = G_LOAD %0(p0) :: (load (s8))203 ; CHECK: [[V8:%[0-9]+]]:_(s8) = G_LOAD204 205 %2(s16) = G_ZEXT %1206 %3(s16) = G_SEXT %1207 208 %4(s16) = G_OR %2, %3209 ; G_OR is going to widen to 32 bits and the extensions/truncs should combine210 ; with the already existing ones211 ; CHECK: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[V8]](s8)212 ; CHECK: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[V8]](s8)213 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR [[ZEXT]], [[SEXT]]214 ; CHECK: $r0 = COPY [[OR]]215 216 %5(s32) = G_SEXT %4(s16)217 $r0 = COPY %5218 219 BX_RET 14, $noreg, implicit $r0220...221