417 lines · plain
1# RUN: llc -run-pass ppc-mi-peepholes -ppc-convert-rr-to-ri %s -o - | FileCheck %s2# RUN: llc -start-after ppc-mi-peepholes -ppc-late-peephole %s -o - | FileCheck %s --check-prefix=CHECK-LATE3--- |4 ; ModuleID = 'rlwinm_rldicl_to_andi.ll'5 source_filename = "rlwinm_rldicl_to_andi.c"6 target datalayout = "e-m:e-i64:64-n32:64"7 target triple = "powerpc64le-unknown-linux-gnu"8 9 ; Function Attrs: norecurse nounwind readnone10 define signext i32 @testRLWINMSingleUseDef(i32 signext %a, i32 signext %b) local_unnamed_addr #0 {11 entry:12 %shl.mask = and i32 %a, 104857513 %tobool = icmp eq i32 %shl.mask, 014 %cond = select i1 %tobool, i32 %a, i32 %b15 ret i32 %cond16 }17 18 ; Function Attrs: norecurse nounwind readnone19 define signext i32 @testRLWINMNoGPRUseZero(i32 signext %a, i32 signext %b) local_unnamed_addr #0 {20 entry:21 %shl.mask = and i32 %a, 104857522 %tobool = icmp eq i32 %shl.mask, 023 %cond = select i1 %tobool, i32 %a, i32 %b24 ret i32 %cond25 }26 27 ; Function Attrs: norecurse nounwind readnone28 define signext i32 @testRLWINMNoGPRUseNonZero(i32 signext %a, i32 signext %b) local_unnamed_addr #0 {29 entry:30 %shl.mask = and i32 %a, 104857531 %tobool = icmp eq i32 %shl.mask, 032 %cond = select i1 %tobool, i32 %a, i32 %b33 ret i32 %cond34 }35 36 ; Function Attrs: norecurse nounwind readnone37 define i64 @testRLDICLSingleUseDef(i64 %a, i64 %b) local_unnamed_addr #0 {38 entry:39 %shl.mask = and i64 %a, 450359962737049540 %tobool = icmp eq i64 %shl.mask, 041 %cond = select i1 %tobool, i64 %a, i64 %b42 ret i64 %cond43 }44 45 ; Function Attrs: norecurse nounwind readnone46 define i64 @testRLDICLNoGPRUseZero(i64 %a, i64 %b) local_unnamed_addr #0 {47 entry:48 %shl.mask = and i64 %a, 450359962737049549 %tobool = icmp eq i64 %shl.mask, 050 %cond = select i1 %tobool, i64 %a, i64 %b51 ret i64 %cond52 }53 54 ; Function Attrs: norecurse nounwind readnone55 define i64 @testRLDICLNoGPRUseNonZero(i64 %a, i64 %b) local_unnamed_addr #0 {56 entry:57 %shl.mask = and i64 %a, 450359962737049558 %tobool = icmp eq i64 %shl.mask, 059 %cond = select i1 %tobool, i64 %a, i64 %b60 ret i64 %cond61 }62 63 attributes #0 = { norecurse nounwind readnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="ppc64le" "target-features"="+altivec,+bpermd,+crypto,+direct-move,+extdiv,+htm,+power8-vector,+vsx,-power9-vector" "use-soft-float"="false" }64 65 !llvm.module.flags = !{!0, !1}66 !llvm.ident = !{!2}67 68 !0 = !{i32 1, !"wchar_size", i32 4}69 !1 = !{i32 7, !"PIC Level", i32 2}70 !2 = !{!"clang version 7.0.0 (trunk 322378)"}71 72...73---74name: testRLWINMSingleUseDef75# CHECK: testRLWINMSingleUseDef76# CHECK-LATE: testRLWINMSingleUseDef77alignment: 1678exposesReturnsTwice: false79legalized: false80regBankSelected: false81selected: false82tracksRegLiveness: true83registers: 84 - { id: 0, class: g8rc, preferred-register: '' }85 - { id: 1, class: g8rc, preferred-register: '' }86 - { id: 2, class: gprc_and_gprc_nor0, preferred-register: '' }87 - { id: 3, class: gprc, preferred-register: '' }88 - { id: 4, class: gprc_and_gprc_nor0, preferred-register: '' }89 - { id: 5, class: crrc, preferred-register: '' }90 - { id: 6, class: gprc, preferred-register: '' }91 - { id: 7, class: g8rc, preferred-register: '' }92liveins: 93 - { reg: '$x3', virtual-reg: '%0' }94 - { reg: '$x4', virtual-reg: '%1' }95frameInfo: 96 isFrameAddressTaken: false97 isReturnAddressTaken: false98 hasStackMap: false99 hasPatchPoint: false100 stackSize: 0101 offsetAdjustment: 0102 maxAlignment: 0103 adjustsStack: false104 hasCalls: false105 stackProtector: ''106 maxCallFrameSize: 4294967295107 hasOpaqueSPAdjustment: false108 hasVAStart: false109 hasMustTailInVarArgFunc: false110 savePoint: []111 restorePoint: []112fixedStack: 113stack: 114constants: 115body: |116 bb.0.entry:117 liveins: $x3, $x4118 119 %1:g8rc = COPY $x4120 %0:g8rc = COPY $x3121 %2:gprc_and_gprc_nor0 = COPY %1.sub_32122 %3:gprc = LI -11123 %4:gprc_and_gprc_nor0 = RLWINM_rec %3, 2, 20, 31, implicit-def $cr0124 ; CHECK: LI 4055125 ; CHECK: ANDI_rec killed %3, 4055126 ; CHECK-LATE-NOT: andi.127 ; CHECK-LATE: rlwinm.128 %5:crrc = COPY killed $cr0129 %6:gprc = ISEL %4, %2, %5.sub_eq130 %7:g8rc = EXTSW_32_64 killed %6131 $x3 = COPY %7132 BLR8 implicit $lr8, implicit $rm, implicit $x3133 134...135---136name: testRLWINMNoGPRUseZero137alignment: 16138exposesReturnsTwice: false139legalized: false140regBankSelected: false141selected: false142tracksRegLiveness: true143registers: 144 - { id: 0, class: g8rc, preferred-register: '' }145 - { id: 1, class: g8rc, preferred-register: '' }146 - { id: 2, class: gprc_and_gprc_nor0, preferred-register: '' }147 - { id: 3, class: gprc_and_gprc_nor0, preferred-register: '' }148 - { id: 4, class: gprc, preferred-register: '' }149 - { id: 5, class: crrc, preferred-register: '' }150 - { id: 6, class: gprc, preferred-register: '' }151 - { id: 7, class: g8rc, preferred-register: '' }152liveins: 153 - { reg: '$x3', virtual-reg: '%0' }154 - { reg: '$x4', virtual-reg: '%1' }155frameInfo: 156 isFrameAddressTaken: false157 isReturnAddressTaken: false158 hasStackMap: false159 hasPatchPoint: false160 stackSize: 0161 offsetAdjustment: 0162 maxAlignment: 0163 adjustsStack: false164 hasCalls: false165 stackProtector: ''166 maxCallFrameSize: 4294967295167 hasOpaqueSPAdjustment: false168 hasVAStart: false169 hasMustTailInVarArgFunc: false170 savePoint: []171 restorePoint: []172fixedStack: 173stack: 174constants: 175body: |176 bb.0.entry:177 liveins: $x3, $x4178 179 %1:g8rc = COPY $x4180 %0:g8rc = COPY $x3181 %2:gprc_and_gprc_nor0 = COPY %1.sub_32182 %3:gprc_and_gprc_nor0 = LI 1183 %4:gprc = RLWINM_rec %3, 21, 20, 31, implicit-def $cr0184 ; CHECK: LI 1185 ; CHECK: ANDI_rec %3, 0186 ; CHECK-LATE: li [[IMM:[0-9]+]], 1187 ; CHECK-LATE: andi. {{[0-9]+}}, [[IMM]], 0188 %5:crrc = COPY killed $cr0189 %6:gprc = ISEL %3, %2, %5.sub_eq190 %7:g8rc = EXTSW_32_64 killed %6191 $x3 = COPY %7192 BLR8 implicit $lr8, implicit $rm, implicit $x3193 194...195---196name: testRLWINMNoGPRUseNonZero197alignment: 16198exposesReturnsTwice: false199legalized: false200regBankSelected: false201selected: false202tracksRegLiveness: true203registers: 204 - { id: 0, class: g8rc, preferred-register: '' }205 - { id: 1, class: g8rc, preferred-register: '' }206 - { id: 2, class: gprc_and_gprc_nor0, preferred-register: '' }207 - { id: 3, class: gprc_and_gprc_nor0, preferred-register: '' }208 - { id: 4, class: gprc, preferred-register: '' }209 - { id: 5, class: crrc, preferred-register: '' }210 - { id: 6, class: gprc, preferred-register: '' }211 - { id: 7, class: g8rc, preferred-register: '' }212liveins: 213 - { reg: '$x3', virtual-reg: '%0' }214 - { reg: '$x4', virtual-reg: '%1' }215frameInfo: 216 isFrameAddressTaken: false217 isReturnAddressTaken: false218 hasStackMap: false219 hasPatchPoint: false220 stackSize: 0221 offsetAdjustment: 0222 maxAlignment: 0223 adjustsStack: false224 hasCalls: false225 stackProtector: ''226 maxCallFrameSize: 4294967295227 hasOpaqueSPAdjustment: false228 hasVAStart: false229 hasMustTailInVarArgFunc: false230 savePoint: []231 restorePoint: []232fixedStack: 233stack: 234constants: 235body: |236 bb.0.entry:237 liveins: $x3, $x4238 239 %1:g8rc = COPY $x4240 %0:g8rc = COPY $x3241 %2:gprc_and_gprc_nor0 = COPY %1.sub_32242 %3:gprc_and_gprc_nor0 = LI -11243 %4:gprc = RLWINM_rec %3, 2, 20, 31, implicit-def $cr0244 ; CHECK: LI -11245 ; CHECK: ANDI_rec %3, 65525246 ; CHECK-LATE-NOT: andi.247 ; CHECK-LATE: rlwinm.248 %5:crrc = COPY killed $cr0249 %6:gprc = ISEL %3, %2, %5.sub_eq250 %7:g8rc = EXTSW_32_64 killed %6251 $x3 = COPY %7252 BLR8 implicit $lr8, implicit $rm, implicit $x3253 254...255---256name: testRLDICLSingleUseDef257alignment: 16258exposesReturnsTwice: false259legalized: false260regBankSelected: false261selected: false262tracksRegLiveness: true263registers: 264 - { id: 0, class: g8rc, preferred-register: '' }265 - { id: 1, class: g8rc_and_g8rc_nox0, preferred-register: '' }266 - { id: 2, class: g8rc_and_g8rc_nox0, preferred-register: '' }267 - { id: 3, class: crrc, preferred-register: '' }268 - { id: 4, class: g8rc, preferred-register: '' }269liveins: 270 - { reg: '$x3', virtual-reg: '%0' }271 - { reg: '$x4', virtual-reg: '%1' }272frameInfo: 273 isFrameAddressTaken: false274 isReturnAddressTaken: false275 hasStackMap: false276 hasPatchPoint: false277 stackSize: 0278 offsetAdjustment: 0279 maxAlignment: 0280 adjustsStack: false281 hasCalls: false282 stackProtector: ''283 maxCallFrameSize: 4294967295284 hasOpaqueSPAdjustment: false285 hasVAStart: false286 hasMustTailInVarArgFunc: false287 savePoint: []288 restorePoint: []289fixedStack: 290stack: 291constants: 292body: |293 bb.0.entry:294 liveins: $x3, $x4295 296 %1:g8rc_and_g8rc_nox0 = COPY $x4297 %0:g8rc = LI8 -11298 %2:g8rc_and_g8rc_nox0 = RLDICL_rec %0, 2, 49, implicit-def $cr0299 ; CHECK: LI8 32727300 ; CHECK: ANDI8_rec killed %0, 32727301 ; CHECK-LATE-NOT: andi.302 ; CHECK-LATE: rldicl.303 %3:crrc = COPY killed $cr0304 %4:g8rc = ISEL8 %2, %1, %3.sub_eq305 $x3 = COPY %4306 BLR8 implicit $lr8, implicit $rm, implicit $x3307 308...309---310name: testRLDICLNoGPRUseZero311alignment: 16312exposesReturnsTwice: false313legalized: false314regBankSelected: false315selected: false316tracksRegLiveness: true317registers: 318 - { id: 0, class: g8rc_and_g8rc_nox0, preferred-register: '' }319 - { id: 1, class: g8rc_and_g8rc_nox0, preferred-register: '' }320 - { id: 2, class: g8rc, preferred-register: '' }321 - { id: 3, class: crrc, preferred-register: '' }322 - { id: 4, class: g8rc, preferred-register: '' }323liveins: 324 - { reg: '$x3', virtual-reg: '%0' }325 - { reg: '$x4', virtual-reg: '%1' }326frameInfo: 327 isFrameAddressTaken: false328 isReturnAddressTaken: false329 hasStackMap: false330 hasPatchPoint: false331 stackSize: 0332 offsetAdjustment: 0333 maxAlignment: 0334 adjustsStack: false335 hasCalls: false336 stackProtector: ''337 maxCallFrameSize: 4294967295338 hasOpaqueSPAdjustment: false339 hasVAStart: false340 hasMustTailInVarArgFunc: false341 savePoint: []342 restorePoint: []343fixedStack: 344stack: 345constants: 346body: |347 bb.0.entry:348 liveins: $x3, $x4349 350 %1:g8rc_and_g8rc_nox0 = COPY $x4351 %0:g8rc_and_g8rc_nox0 = LI8 1352 %2:g8rc = RLDICL_rec %0, 32, 33, implicit-def $cr0353 ; CHECK: LI8 1354 ; CHECK: ANDI8_rec %0, 0355 ; CHECK-LATE: li [[IMM:[0-9]+]], 1356 ; CHECK-LATE: andi. {{[0-9]+}}, [[IMM]], 0357 %3:crrc = COPY killed $cr0358 %4:g8rc = ISEL8 %0, %1, %3.sub_eq359 $x3 = COPY %4360 BLR8 implicit $lr8, implicit $rm, implicit $x3361 362...363---364name: testRLDICLNoGPRUseNonZero365alignment: 16366exposesReturnsTwice: false367legalized: false368regBankSelected: false369selected: false370tracksRegLiveness: true371registers: 372 - { id: 0, class: g8rc_and_g8rc_nox0, preferred-register: '' }373 - { id: 1, class: g8rc_and_g8rc_nox0, preferred-register: '' }374 - { id: 2, class: g8rc, preferred-register: '' }375 - { id: 3, class: crrc, preferred-register: '' }376 - { id: 4, class: g8rc, preferred-register: '' }377liveins: 378 - { reg: '$x3', virtual-reg: '%0' }379 - { reg: '$x4', virtual-reg: '%1' }380frameInfo: 381 isFrameAddressTaken: false382 isReturnAddressTaken: false383 hasStackMap: false384 hasPatchPoint: false385 stackSize: 0386 offsetAdjustment: 0387 maxAlignment: 0388 adjustsStack: false389 hasCalls: false390 stackProtector: ''391 maxCallFrameSize: 4294967295392 hasOpaqueSPAdjustment: false393 hasVAStart: false394 hasMustTailInVarArgFunc: false395 savePoint: []396 restorePoint: []397fixedStack: 398stack: 399constants: 400body: |401 bb.0.entry:402 liveins: $x3, $x4403 404 %1:g8rc_and_g8rc_nox0 = COPY $x4405 %0:g8rc_and_g8rc_nox0 = LI8 -11406 %2:g8rc = RLDICL_rec %0, 2, 49, implicit-def $cr0407 ; CHECK: LI8 -11408 ; CHECK: ANDI8_rec %0, 65525409 ; CHECK-LATE-NOT: andi.410 ; CHECK-LATE: rldicl.411 %3:crrc = COPY killed $cr0412 %4:g8rc = ISEL8 %0, %1, %3.sub_eq413 $x3 = COPY %4414 BLR8 implicit $lr8, implicit $rm, implicit $x3415 416...417