602 lines · plain
1# RUN: llc -O0 -mtriple arm-linux-gnueabi -mattr=+hwdiv-arm -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,HWDIV2# RUN: llc -O0 -mtriple arm-linux-gnueabi -mattr=-hwdiv-arm -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,SOFT,SOFT-AEABI,ARM-AEABI3# RUN: llc -O0 -mtriple arm-linux-gnu -mattr=+hwdiv-arm -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,HWDIV4# RUN: llc -O0 -mtriple arm-linux-gnu -mattr=-hwdiv-arm -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,SOFT,SOFT-DEFAULT,ARM-DEFAULT5# RUN: llc -O0 -mtriple thumb-linux-gnueabi -mattr=+v6t2,+hwdiv -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,HWDIV6# RUN: llc -O0 -mtriple thumb-linux-gnueabi -mattr=+v6t2,-hwdiv -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,SOFT,SOFT-AEABI,THUMB-AEABI7# RUN: llc -O0 -mtriple thumb-linux-gnu -mattr=+v6t2,+hwdiv -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,HWDIV8# RUN: llc -O0 -mtriple thumb-linux-gnu -mattr=+v6t2,-hwdiv -run-pass=legalizer %s -o - | FileCheck %s -check-prefixes=CHECK,SOFT,SOFT-DEFAULT,THUMB-DEFAULT9--- |10 define void @test_sdiv_i32() { ret void }11 define void @test_udiv_i32() { ret void }12 13 define void @test_sdiv_i16() { ret void }14 define void @test_udiv_i16() { ret void }15 16 define void @test_sdiv_i8() { ret void }17 define void @test_udiv_i8() { ret void }18 19 define void @test_srem_i32() { ret void }20 define void @test_urem_i32() { ret void }21 22 define void @test_srem_i16() { ret void }23 define void @test_urem_i16() { ret void }24 25 define void @test_srem_i8() { ret void }26 define void @test_urem_i8() { ret void }27...28---29name: test_sdiv_i3230# CHECK-LABEL: name: test_sdiv_i3231legalized: false32# CHECK: legalized: true33regBankSelected: false34selected: false35tracksRegLiveness: true36registers:37 - { id: 0, class: _ }38 - { id: 1, class: _ }39 - { id: 2, class: _ }40body: |41 bb.0:42 liveins: $r0, $r143 44 ; CHECK-DAG: [[X:%[0-9]+]]:_(s32) = COPY $r045 ; CHECK-DAG: [[Y:%[0-9]+]]:_(s32) = COPY $r146 %0(s32) = COPY $r047 %1(s32) = COPY $r148 ; HWDIV: [[R:%[0-9]+]]:_(s32) = G_SDIV [[X]], [[Y]]49 ; SOFT-NOT: G_SDIV50 ; SOFT: ADJCALLSTACKDOWN51 ; SOFT-DAG: $r0 = COPY [[X]]52 ; SOFT-DAG: $r1 = COPY [[Y]]53 ; ARM-AEABI: BL &__aeabi_idiv, {{.*}}, implicit $r0, implicit $r1, implicit-def $r054 ; THUMB-AEABI: tBL 14 /* CC::al */, $noreg, &__aeabi_idiv, {{.*}}, implicit $r0, implicit $r1, implicit-def $r055 ; ARM-DEFAULT: BL &__divsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r056 ; THUMB-DEFAULT: tBL 14 /* CC::al */, $noreg, &__divsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r057 ; SOFT: [[R:%[0-9]+]]:_(s32) = COPY $r058 ; SOFT: ADJCALLSTACKUP59 ; SOFT-NOT: G_SDIV60 %2(s32) = G_SDIV %0, %161 ; CHECK: $r0 = COPY [[R]]62 $r0 = COPY %2(s32)63 BX_RET 14 /* CC::al */, $noreg, implicit $r064...65---66name: test_udiv_i3267# CHECK-LABEL: name: test_udiv_i3268legalized: false69# CHECK: legalized: true70regBankSelected: false71selected: false72tracksRegLiveness: true73registers:74 - { id: 0, class: _ }75 - { id: 1, class: _ }76 - { id: 2, class: _ }77body: |78 bb.0:79 liveins: $r0, $r180 81 ; CHECK-DAG: [[X:%[0-9]+]]:_(s32) = COPY $r082 ; CHECK-DAG: [[Y:%[0-9]+]]:_(s32) = COPY $r183 %0(s32) = COPY $r084 %1(s32) = COPY $r185 ; HWDIV: [[R:%[0-9]+]]:_(s32) = G_UDIV [[X]], [[Y]]86 ; SOFT-NOT: G_UDIV87 ; SOFT: ADJCALLSTACKDOWN88 ; SOFT-DAG: $r0 = COPY [[X]]89 ; SOFT-DAG: $r1 = COPY [[Y]]90 ; ARM-AEABI: BL &__aeabi_uidiv, {{.*}}, implicit $r0, implicit $r1, implicit-def $r091 ; THUMB-AEABI: tBL 14 /* CC::al */, $noreg, &__aeabi_uidiv, {{.*}}, implicit $r0, implicit $r1, implicit-def $r092 ; ARM-DEFAULT: BL &__udivsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r093 ; THUMB-DEFAULT: tBL 14 /* CC::al */, $noreg, &__udivsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r094 ; SOFT: [[R:%[0-9]+]]:_(s32) = COPY $r095 ; SOFT: ADJCALLSTACKUP96 ; SOFT-NOT: G_UDIV97 %2(s32) = G_UDIV %0, %198 ; CHECK: $r0 = COPY [[R]]99 $r0 = COPY %2(s32)100 BX_RET 14 /* CC::al */, $noreg, implicit $r0101...102---103name: test_sdiv_i16104# CHECK-LABEL: name: test_sdiv_i16105legalized: false106# CHECK: legalized: true107regBankSelected: false108selected: false109tracksRegLiveness: true110registers:111 - { id: 0, class: _ }112 - { id: 1, class: _ }113 - { id: 2, class: _ }114 - { id: 3, class: _ }115 - { id: 4, class: _ }116 - { id: 5, class: _ }117body: |118 bb.0:119 liveins: $r0, $r1120 121 ; CHECK-DAG: [[R0:%[0-9]+]]:_(s32) = COPY $r0122 ; CHECK-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r1123 ; The G_TRUNC will combine with the extensions introduced by the legalizer,124 ; leading to the following complicated sequences.125 ; CHECK-DAG: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 16126 ; CHECK-DAG: [[SHIFTEDX:%[0-9]+]]:_(s32) = G_SHL [[R0]], [[BITS]]127 ; CHECK-DAG: [[X32:%[0-9]+]]:_(s32) = G_ASHR [[SHIFTEDX]], [[BITS]]128 ; CHECK-DAG: [[SHIFTEDY:%[0-9]+]]:_(s32) = G_SHL [[R1]], [[BITS]]129 ; CHECK-DAG: [[Y32:%[0-9]+]]:_(s32) = G_ASHR [[SHIFTEDY]], [[BITS]]130 %0(s32) = COPY $r0131 %1(s16) = G_TRUNC %0(s32)132 %2(s32) = COPY $r1133 %3(s16) = G_TRUNC %2(s32)134 ; HWDIV: [[R32:%[0-9]+]]:_(s32) = G_SDIV [[X32]], [[Y32]]135 ; SOFT-NOT: G_SDIV136 ; SOFT: ADJCALLSTACKDOWN137 ; SOFT-DAG: $r0 = COPY [[X32]]138 ; SOFT-DAG: $r1 = COPY [[Y32]]139 ; ARM-AEABI: BL &__aeabi_idiv, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0140 ; THUMB-AEABI: tBL 14 /* CC::al */, $noreg, &__aeabi_idiv, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0141 ; ARM-DEFAULT: BL &__divsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0142 ; THUMB-DEFAULT: tBL 14 /* CC::al */, $noreg, &__divsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0143 ; SOFT: [[R32:%[0-9]+]]:_(s32) = COPY $r0144 ; SOFT: ADJCALLSTACKUP145 ; SOFT-NOT: G_SDIV146 ; CHECK: [[R:%[0-9]+]]:_(s32) = G_ASHR147 ; SOFT-NOT: G_SDIV148 %4(s16) = G_SDIV %1, %3149 ; CHECK: $r0 = COPY [[R]]150 %5(s32) = G_SEXT %4(s16)151 $r0 = COPY %5(s32)152 BX_RET 14 /* CC::al */, $noreg, implicit $r0153...154---155name: test_udiv_i16156# CHECK-LABEL: name: test_udiv_i16157legalized: false158# CHECK: legalized: true159regBankSelected: false160selected: false161tracksRegLiveness: true162registers:163 - { id: 0, class: _ }164 - { id: 1, class: _ }165 - { id: 2, class: _ }166 - { id: 3, class: _ }167 - { id: 4, class: _ }168 - { id: 5, class: _ }169body: |170 bb.0:171 liveins: $r0, $r1172 173 ; CHECK-DAG: [[R0:%[0-9]+]]:_(s32) = COPY $r0174 ; CHECK-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r1175 ; The G_TRUNC will combine with the extensions introduced by the legalizer,176 ; leading to the following complicated sequences.177 ; CHECK: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535178 ; CHECK: [[X32:%[0-9]+]]:_(s32) = G_AND [[R0]], [[BITS]]179 ; CHECK: [[Y32:%[0-9]+]]:_(s32) = G_AND [[R1]], [[BITS]]180 %0(s32) = COPY $r0181 %1(s16) = G_TRUNC %0(s32)182 %2(s32) = COPY $r1183 %3(s16) = G_TRUNC %2(s32)184 ; HWDIV: [[R32:%[0-9]+]]:_(s32) = G_UDIV [[X32]], [[Y32]]185 ; SOFT-NOT: G_UDIV186 ; SOFT: ADJCALLSTACKDOWN187 ; SOFT-DAG: $r0 = COPY [[X32]]188 ; SOFT-DAG: $r1 = COPY [[Y32]]189 ; ARM-AEABI: BL &__aeabi_uidiv, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0190 ; THUMB-AEABI: tBL 14 /* CC::al */, $noreg, &__aeabi_uidiv, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0191 ; ARM-DEFAULT: BL &__udivsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0192 ; THUMB-DEFAULT: tBL 14 /* CC::al */, $noreg, &__udivsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0193 ; SOFT: [[R32:%[0-9]+]]:_(s32) = COPY $r0194 ; SOFT: ADJCALLSTACKUP195 ; SOFT-NOT: G_UDIV196 ; CHECK: [[R:%[0-9]+]]:_(s32) = G_AND197 ; SOFT-NOT: G_UDIV198 %4(s16) = G_UDIV %1, %3199 ; CHECK: $r0 = COPY [[R]]200 %5(s32) = G_ZEXT %4(s16)201 $r0 = COPY %5(s32)202 BX_RET 14 /* CC::al */, $noreg, implicit $r0203...204---205name: test_sdiv_i8206# CHECK-LABEL: name: test_sdiv_i8207legalized: false208# CHECK: legalized: true209regBankSelected: false210selected: false211tracksRegLiveness: true212registers:213 - { id: 0, class: _ }214 - { id: 1, class: _ }215 - { id: 2, class: _ }216 - { id: 3, class: _ }217 - { id: 4, class: _ }218 - { id: 5, class: _ }219body: |220 bb.0:221 liveins: $r0, $r1222 223 ; CHECK-DAG: [[R0:%[0-9]+]]:_(s32) = COPY $r0224 ; CHECK-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r1225 ; The G_TRUNC will combine with the extensions introduced by the legalizer,226 ; leading to the following complicated sequences.227 ; CHECK-DAG: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 24228 ; CHECK-DAG: [[SHIFTEDX:%[0-9]+]]:_(s32) = G_SHL [[R0]], [[BITS]]229 ; CHECK-DAG: [[X32:%[0-9]+]]:_(s32) = G_ASHR [[SHIFTEDX]], [[BITS]]230 ; CHECK-DAG: [[SHIFTEDY:%[0-9]+]]:_(s32) = G_SHL [[R1]], [[BITS]]231 ; CHECK-DAG: [[Y32:%[0-9]+]]:_(s32) = G_ASHR [[SHIFTEDY]], [[BITS]]232 %0(s32) = COPY $r0233 %1(s8) = G_TRUNC %0(s32)234 %2(s32) = COPY $r1235 %3(s8) = G_TRUNC %2(s32)236 ; HWDIV: [[R32:%[0-9]+]]:_(s32) = G_SDIV [[X32]], [[Y32]]237 ; SOFT-NOT: G_SDIV238 ; SOFT: ADJCALLSTACKDOWN239 ; SOFT-DAG: $r0 = COPY [[X32]]240 ; SOFT-DAG: $r1 = COPY [[Y32]]241 ; ARM-AEABI: BL &__aeabi_idiv, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0242 ; THUMB-AEABI: tBL 14 /* CC::al */, $noreg, &__aeabi_idiv, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0243 ; ARM-DEFAULT: BL &__divsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0244 ; THUMB-DEFAULT: tBL 14 /* CC::al */, $noreg, &__divsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0245 ; SOFT: [[R32:%[0-9]+]]:_(s32) = COPY $r0246 ; SOFT: ADJCALLSTACKUP247 ; SOFT-NOT: G_SDIV248 ; CHECK: [[R:%[0-9]+]]:_(s32) = G_ASHR249 ; SOFT-NOT: G_SDIV250 %4(s8) = G_SDIV %1, %3251 ; CHECK: $r0 = COPY [[R]]252 %5(s32) = G_SEXT %4(s8)253 $r0 = COPY %5(s32)254 BX_RET 14 /* CC::al */, $noreg, implicit $r0255...256---257name: test_udiv_i8258# CHECK-LABEL: name: test_udiv_i8259legalized: false260# CHECK: legalized: true261regBankSelected: false262selected: false263tracksRegLiveness: true264registers:265 - { id: 0, class: _ }266 - { id: 1, class: _ }267 - { id: 2, class: _ }268 - { id: 3, class: _ }269 - { id: 4, class: _ }270 - { id: 5, class: _ }271body: |272 bb.0:273 liveins: $r0, $r1274 275 ; CHECK-DAG: [[X:%[0-9]+]]:_(s32) = COPY $r0276 ; CHECK-DAG: [[Y:%[0-9]+]]:_(s32) = COPY $r1277 ; The G_TRUNC will combine with the extensions introduced by the legalizer,278 ; leading to the following complicated sequences.279 ; CHECK: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 255280 ; CHECK: [[X32:%[0-9]+]]:_(s32) = G_AND [[R0]], [[BITS]]281 ; CHECK: [[Y32:%[0-9]+]]:_(s32) = G_AND [[R1]], [[BITS]]282 %0(s32) = COPY $r0283 %1(s8) = G_TRUNC %0(s32)284 %2(s32) = COPY $r1285 %3(s8) = G_TRUNC %2(s32)286 ; HWDIV: [[R32:%[0-9]+]]:_(s32) = G_UDIV [[X32]], [[Y32]]287 ; SOFT-NOT: G_UDIV288 ; SOFT: ADJCALLSTACKDOWN289 ; SOFT-DAG: $r0 = COPY [[X32]]290 ; SOFT-DAG: $r1 = COPY [[Y32]]291 ; ARM-AEABI: BL &__aeabi_uidiv, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0292 ; THUMB-AEABI: tBL 14 /* CC::al */, $noreg, &__aeabi_uidiv, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0293 ; ARM-DEFAULT: BL &__udivsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0294 ; THUMB-DEFAULT: tBL 14 /* CC::al */, $noreg, &__udivsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0295 ; SOFT: [[R32:%[0-9]+]]:_(s32) = COPY $r0296 ; SOFT: ADJCALLSTACKUP297 ; SOFT-NOT: G_UDIV298 ; CHECK: [[R:%[0-9]+]]:_(s32) = G_AND299 ; SOFT-NOT: G_UDIV300 %4(s8) = G_UDIV %1, %3301 ; CHECK: $r0 = COPY [[R]]302 %5(s32) = G_ZEXT %4(s8)303 $r0 = COPY %5(s32)304 BX_RET 14 /* CC::al */, $noreg, implicit $r0305...306---307name: test_srem_i32308# CHECK-LABEL: name: test_srem_i32309legalized: false310# CHECK: legalized: true311regBankSelected: false312selected: false313tracksRegLiveness: true314registers:315 - { id: 0, class: _ }316 - { id: 1, class: _ }317 - { id: 2, class: _ }318body: |319 bb.0:320 liveins: $r0, $r1321 322 ; CHECK-DAG: [[X:%[0-9]+]]:_(s32) = COPY $r0323 ; CHECK-DAG: [[Y:%[0-9]+]]:_(s32) = COPY $r1324 %0(s32) = COPY $r0325 %1(s32) = COPY $r1326 ; HWDIV: [[Q:%[0-9]+]]:_(s32) = G_SDIV [[X]], [[Y]]327 ; HWDIV: [[P:%[0-9]+]]:_(s32) = G_MUL [[Q]], [[Y]]328 ; HWDIV: [[R:%[0-9]+]]:_(s32) = G_SUB [[X]], [[P]]329 ; SOFT-NOT: G_SREM330 ; SOFT: ADJCALLSTACKDOWN331 ; SOFT-DAG: $r0 = COPY [[X]]332 ; SOFT-DAG: $r1 = COPY [[Y]]333 ; ARM-AEABI: BL &__aeabi_idivmod, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0, implicit-def $r1334 ; THUMB-AEABI: tBL 14 /* CC::al */, $noreg, &__aeabi_idivmod, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0, implicit-def $r1335 ; SOFT-AEABI: [[R:%[0-9]+]]:_(s32) = COPY $r1336 ; ARM-DEFAULT: BL &__modsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0337 ; THUMB-DEFAULT: tBL 14 /* CC::al */, $noreg, &__modsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0338 ; SOFT-DEFAULT: [[R:%[0-9]+]]:_(s32) = COPY $r0339 ; SOFT: ADJCALLSTACKUP340 ; SOFT-NOT: G_SREM341 %2(s32) = G_SREM %0, %1342 ; CHECK: $r0 = COPY [[R]]343 $r0 = COPY %2(s32)344 BX_RET 14 /* CC::al */, $noreg, implicit $r0345...346---347name: test_urem_i32348# CHECK-LABEL: name: test_urem_i32349legalized: false350# CHECK: legalized: true351regBankSelected: false352selected: false353tracksRegLiveness: true354registers:355 - { id: 0, class: _ }356 - { id: 1, class: _ }357 - { id: 2, class: _ }358body: |359 bb.0:360 liveins: $r0, $r1361 362 ; CHECK-DAG: [[X:%[0-9]+]]:_(s32) = COPY $r0363 ; CHECK-DAG: [[Y:%[0-9]+]]:_(s32) = COPY $r1364 %0(s32) = COPY $r0365 %1(s32) = COPY $r1366 ; HWDIV: [[Q:%[0-9]+]]:_(s32) = G_UDIV [[X]], [[Y]]367 ; HWDIV: [[P:%[0-9]+]]:_(s32) = G_MUL [[Q]], [[Y]]368 ; HWDIV: [[R:%[0-9]+]]:_(s32) = G_SUB [[X]], [[P]]369 ; SOFT-NOT: G_UREM370 ; SOFT: ADJCALLSTACKDOWN371 ; SOFT-DAG: $r0 = COPY [[X]]372 ; SOFT-DAG: $r1 = COPY [[Y]]373 ; ARM-AEABI: BL &__aeabi_uidivmod, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0, implicit-def $r1374 ; THUMB-AEABI: tBL 14 /* CC::al */, $noreg, &__aeabi_uidivmod, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0, implicit-def $r1375 ; SOFT-AEABI: [[R:%[0-9]+]]:_(s32) = COPY $r1376 ; ARM-DEFAULT: BL &__umodsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0377 ; THUMB-DEFAULT: tBL 14 /* CC::al */, $noreg, &__umodsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0378 ; SOFT-DEFAULT: [[R:%[0-9]+]]:_(s32) = COPY $r0379 ; SOFT: ADJCALLSTACKUP380 ; SOFT-NOT: G_UREM381 %2(s32) = G_UREM %0, %1382 ; CHECK: $r0 = COPY [[R]]383 $r0 = COPY %2(s32)384 BX_RET 14 /* CC::al */, $noreg, implicit $r0385...386---387name: test_srem_i16388# CHECK-LABEL: name: test_srem_i16389legalized: false390# CHECK: legalized: true391regBankSelected: false392selected: false393tracksRegLiveness: true394registers:395 - { id: 0, class: _ }396 - { id: 1, class: _ }397 - { id: 2, class: _ }398 - { id: 3, class: _ }399 - { id: 4, class: _ }400 - { id: 5, class: _ }401body: |402 bb.0:403 liveins: $r0, $r1404 405 ; CHECK-DAG: [[R0:%[0-9]+]]:_(s32) = COPY $r0406 ; CHECK-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r1407 ; The G_TRUNC will combine with the extensions introduced by the legalizer,408 ; leading to the following complicated sequences.409 ; CHECK-DAG: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 16410 ; CHECK-DAG: [[SHIFTEDX:%[0-9]+]]:_(s32) = G_SHL [[R0]], [[BITS]]411 ; CHECK-DAG: [[X32:%[0-9]+]]:_(s32) = G_ASHR [[SHIFTEDX]], [[BITS]]412 ; CHECK-DAG: [[SHIFTEDY:%[0-9]+]]:_(s32) = G_SHL [[R1]], [[BITS]]413 ; CHECK-DAG: [[Y32:%[0-9]+]]:_(s32) = G_ASHR [[SHIFTEDY]], [[BITS]]414 %0(s32) = COPY $r0415 %1(s16) = G_TRUNC %0(s32)416 %2(s32) = COPY $r1417 %3(s16) = G_TRUNC %2(s32)418 ; HWDIV: [[Q32:%[0-9]+]]:_(s32) = G_SDIV [[X32]], [[Y32]]419 ; HWDIV: [[P32:%[0-9]+]]:_(s32) = G_MUL [[Q32]], [[Y32]]420 ; HWDIV: [[R32:%[0-9]+]]:_(s32) = G_SUB [[X32]], [[P32]]421 ; SOFT-NOT: G_SREM422 ; SOFT: ADJCALLSTACKDOWN423 ; SOFT-DAG: $r0 = COPY [[X32]]424 ; SOFT-DAG: $r1 = COPY [[Y32]]425 ; ARM-AEABI: BL &__aeabi_idivmod, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0426 ; THUMB-AEABI: tBL 14 /* CC::al */, $noreg, &__aeabi_idivmod, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0427 ; SOFT-AEABI: [[R32:%[0-9]+]]:_(s32) = COPY $r1428 ; ARM-DEFAULT: BL &__modsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0429 ; THUMB-DEFAULT: tBL 14 /* CC::al */, $noreg, &__modsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0430 ; SOFT-DEFAULT: [[R32:%[0-9]+]]:_(s32) = COPY $r0431 ; SOFT: ADJCALLSTACKUP432 ; SOFT-NOT: G_SREM433 ; CHECK: [[R:%[0-9]+]]:_(s32) = G_ASHR434 ; SOFT-NOT: G_SREM435 %4(s16) = G_SREM %1, %3436 ; CHECK: $r0 = COPY [[R]]437 %5(s32) = G_SEXT %4(s16)438 $r0 = COPY %5(s32)439 BX_RET 14 /* CC::al */, $noreg, implicit $r0440...441---442name: test_urem_i16443# CHECK-LABEL: name: test_urem_i16444legalized: false445# CHECK: legalized: true446regBankSelected: false447selected: false448tracksRegLiveness: true449registers:450 - { id: 0, class: _ }451 - { id: 1, class: _ }452 - { id: 2, class: _ }453 - { id: 3, class: _ }454 - { id: 4, class: _ }455 - { id: 5, class: _ }456body: |457 bb.0:458 liveins: $r0, $r1459 460 ; CHECK-DAG: [[R0:%[0-9]+]]:_(s32) = COPY $r0461 ; CHECK-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r1462 ; The G_TRUNC will combine with the extensions introduced by the legalizer,463 ; leading to the following complicated sequences.464 ; CHECK: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535465 ; CHECK: [[X32:%[0-9]+]]:_(s32) = G_AND [[R0]], [[BITS]]466 ; CHECK: [[Y32:%[0-9]+]]:_(s32) = G_AND [[R1]], [[BITS]]467 %0(s32) = COPY $r0468 %1(s16) = G_TRUNC %0(s32)469 %2(s32) = COPY $r1470 %3(s16) = G_TRUNC %2(s32)471 ; HWDIV: [[Q32:%[0-9]+]]:_(s32) = G_UDIV [[X32]], [[Y32]]472 ; HWDIV: [[P32:%[0-9]+]]:_(s32) = G_MUL [[Q32]], [[Y32]]473 ; HWDIV: [[R32:%[0-9]+]]:_(s32) = G_SUB [[X32]], [[P32]]474 ; SOFT-NOT: G_UREM475 ; SOFT: ADJCALLSTACKDOWN476 ; SOFT-DAG: $r0 = COPY [[X32]]477 ; SOFT-DAG: $r1 = COPY [[Y32]]478 ; ARM-AEABI: BL &__aeabi_uidivmod, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0479 ; THUMB-AEABI: tBL 14 /* CC::al */, $noreg, &__aeabi_uidivmod, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0480 ; SOFT-AEABI: [[R32:%[0-9]+]]:_(s32) = COPY $r1481 ; ARM-DEFAULT: BL &__umodsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0482 ; THUMB-DEFAULT: tBL 14 /* CC::al */, $noreg, &__umodsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0483 ; SOFT-DEFAULT: [[R32:%[0-9]+]]:_(s32) = COPY $r0484 ; SOFT: ADJCALLSTACKUP485 ; SOFT-NOT: G_UREM486 ; CHECK: [[R:%[0-9]+]]:_(s32) = G_AND487 ; SOFT-NOT: G_UREM488 %4(s16) = G_UREM %1, %3489 ; CHECK: $r0 = COPY [[R]]490 %5(s32) = G_ZEXT %4(s16)491 $r0 = COPY %5(s32)492 BX_RET 14 /* CC::al */, $noreg, implicit $r0493...494---495name: test_srem_i8496# CHECK-LABEL: name: test_srem_i8497legalized: false498# CHECK: legalized: true499regBankSelected: false500selected: false501tracksRegLiveness: true502registers:503 - { id: 0, class: _ }504 - { id: 1, class: _ }505 - { id: 2, class: _ }506 - { id: 3, class: _ }507 - { id: 4, class: _ }508 - { id: 5, class: _ }509body: |510 bb.0:511 liveins: $r0, $r1512 513 ; CHECK-DAG: [[R0:%[0-9]+]]:_(s32) = COPY $r0514 ; CHECK-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r1515 ; The G_TRUNC will combine with the extensions introduced by the legalizer,516 ; leading to the following complicated sequences.517 ; CHECK-DAG: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 24518 ; CHECK-DAG: [[SHIFTEDX:%[0-9]+]]:_(s32) = G_SHL [[R0]], [[BITS]]519 ; CHECK-DAG: [[X32:%[0-9]+]]:_(s32) = G_ASHR [[SHIFTEDX]], [[BITS]]520 ; CHECK-DAG: [[SHIFTEDY:%[0-9]+]]:_(s32) = G_SHL [[R1]], [[BITS]]521 ; CHECK-DAG: [[Y32:%[0-9]+]]:_(s32) = G_ASHR [[SHIFTEDY]], [[BITS]]522 %0(s32) = COPY $r0523 %1(s8) = G_TRUNC %0(s32)524 %2(s32) = COPY $r1525 %3(s8) = G_TRUNC %2(s32)526 ; HWDIV: [[Q32:%[0-9]+]]:_(s32) = G_SDIV [[X32]], [[Y32]]527 ; HWDIV: [[P32:%[0-9]+]]:_(s32) = G_MUL [[Q32]], [[Y32]]528 ; HWDIV: [[R32:%[0-9]+]]:_(s32) = G_SUB [[X32]], [[P32]]529 ; SOFT-NOT: G_SREM530 ; SOFT: ADJCALLSTACKDOWN531 ; SOFT-DAG: $r0 = COPY [[X32]]532 ; SOFT-DAG: $r1 = COPY [[Y32]]533 ; ARM-AEABI: BL &__aeabi_idivmod, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0534 ; THUMB-AEABI: tBL 14 /* CC::al */, $noreg, &__aeabi_idivmod, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0535 ; SOFT-AEABI: [[R32:%[0-9]+]]:_(s32) = COPY $r1536 ; ARM-DEFAULT: BL &__modsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0537 ; THUMB-DEFAULT: tBL 14 /* CC::al */, $noreg, &__modsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0538 ; SOFT-DEFAULT: [[R32:%[0-9]+]]:_(s32) = COPY $r0539 ; SOFT: ADJCALLSTACKUP540 ; SOFT-NOT: G_SREM541 ; CHECK: [[R:%[0-9]+]]:_(s32) = G_ASHR542 ; SOFT-NOT: G_SREM543 %4(s8) = G_SREM %1, %3544 ; CHECK: $r0 = COPY [[R]]545 %5(s32) = G_SEXT %4(s8)546 $r0 = COPY %5(s32)547 BX_RET 14 /* CC::al */, $noreg, implicit $r0548...549---550name: test_urem_i8551# CHECK-LABEL: name: test_urem_i8552legalized: false553# CHECK: legalized: true554regBankSelected: false555selected: false556tracksRegLiveness: true557registers:558 - { id: 0, class: _ }559 - { id: 1, class: _ }560 - { id: 2, class: _ }561 - { id: 3, class: _ }562 - { id: 4, class: _ }563 - { id: 5, class: _ }564body: |565 bb.0:566 liveins: $r0, $r1567 568 ; CHECK-DAG: [[R0:%[0-9]+]]:_(s32) = COPY $r0569 ; CHECK-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r1570 ; The G_TRUNC will combine with the extensions introduced by the legalizer,571 ; leading to the following complicated sequences.572 ; CHECK: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 255573 ; CHECK: [[X32:%[0-9]+]]:_(s32) = G_AND [[R0]], [[BITS]]574 ; CHECK: [[Y32:%[0-9]+]]:_(s32) = G_AND [[R1]], [[BITS]]575 %0(s32) = COPY $r0576 %1(s8) = G_TRUNC %0(s32)577 %2(s32) = COPY $r1578 %3(s8) = G_TRUNC %2(s32)579 ; HWDIV: [[Q32:%[0-9]+]]:_(s32) = G_UDIV [[X32]], [[Y32]]580 ; HWDIV: [[P32:%[0-9]+]]:_(s32) = G_MUL [[Q32]], [[Y32]]581 ; HWDIV: [[R32:%[0-9]+]]:_(s32) = G_SUB [[X32]], [[P32]]582 ; SOFT-NOT: G_UREM583 ; SOFT: ADJCALLSTACKDOWN584 ; SOFT-DAG: $r0 = COPY [[X32]]585 ; SOFT-DAG: $r1 = COPY [[Y32]]586 ; ARM-AEABI: BL &__aeabi_uidivmod, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0587 ; THUMB-AEABI: tBL 14 /* CC::al */, $noreg, &__aeabi_uidivmod, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0588 ; SOFT-AEABI: [[R32:%[0-9]+]]:_(s32) = COPY $r1589 ; ARM-DEFAULT: BL &__umodsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0590 ; THUMB-DEFAULT: tBL 14 /* CC::al */, $noreg, &__umodsi3, {{.*}}, implicit $r0, implicit $r1, implicit-def $r0591 ; SOFT-DEFAULT: [[R32:%[0-9]+]]:_(s32) = COPY $r0592 ; SOFT: ADJCALLSTACKUP593 ; SOFT-NOT: G_UREM594 ; CHECK: [[R:%[0-9]+]]:_(s32) = G_AND595 ; SOFT-NOT: G_UREM596 %4(s8) = G_UREM %1, %3597 ; CHECK: $r0 = COPY [[R]]598 %5(s32) = G_ZEXT %4(s8)599 $r0 = COPY %5(s32)600 BX_RET 14 /* CC::al */, $noreg, implicit $r0601...602