437 lines · plain
1# RUN: llc -start-after ppc-mi-peepholes -ppc-late-peephole %s -o - | FileCheck %s2--- |3 ; ModuleID = 'a.ll'4 source_filename = "a.c"5 target datalayout = "e-m:e-i64:64-n32:64"6 target triple = "powerpc64le-unknown-linux-gnu"7 8 ; Function Attrs: norecurse nounwind readnone9 define signext i32 @unsafeAddR0R3(i32 signext %a, i32 signext %b) local_unnamed_addr #0 {10 entry:11 %add = add nsw i32 %b, %a12 ret i32 %add13 }14 15 ; Function Attrs: norecurse nounwind readnone16 define signext i32 @unsafeAddR3R0(i32 signext %a, i32 signext %b) local_unnamed_addr #0 {17 entry:18 %add = add nsw i32 %b, %a19 ret i32 %add20 }21 22 ; Function Attrs: norecurse nounwind readnone23 define signext i32 @safeAddR0R3(i32 signext %a, i32 signext %b) local_unnamed_addr #0 {24 entry:25 %add = add nsw i32 %b, %a26 ret i32 %add27 }28 29 ; Function Attrs: norecurse nounwind readnone30 define signext i32 @safeAddR3R0(i32 signext %a, i32 signext %b) local_unnamed_addr #0 {31 entry:32 %add = add nsw i32 %b, %a33 ret i32 %add34 }35 36 ; Function Attrs: norecurse nounwind readonly37 define i64 @unsafeLDXR3R0(ptr nocapture readonly %ptr, i64 %off) local_unnamed_addr #1 {38 entry:39 %0 = bitcast ptr %ptr to ptr40 %add.ptr = getelementptr inbounds i8, ptr %0, i64 %off41 %1 = bitcast ptr %add.ptr to ptr42 %2 = load i64, ptr %1, align 8, !tbaa !343 ret i64 %244 }45 46 ; Function Attrs: norecurse nounwind readonly47 define i64 @safeLDXZeroR3(ptr nocapture readonly %ptr, i64 %off) local_unnamed_addr #1 {48 entry:49 %0 = bitcast ptr %ptr to ptr50 %add.ptr = getelementptr inbounds i8, ptr %0, i64 %off51 %1 = bitcast ptr %add.ptr to ptr52 %2 = load i64, ptr %1, align 8, !tbaa !353 ret i64 %254 }55 56 ; Function Attrs: norecurse nounwind readonly57 define i64 @safeLDXR3R0(ptr nocapture readonly %ptr, i64 %off) local_unnamed_addr #1 {58 entry:59 %0 = bitcast ptr %ptr to ptr60 %add.ptr = getelementptr inbounds i8, ptr %0, i64 %off61 %1 = bitcast ptr %add.ptr to ptr62 %2 = load i64, ptr %1, align 8, !tbaa !363 ret i64 %264 }65 66 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" }67 attributes #1 = { norecurse nounwind readonly "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" }68 69 !llvm.module.flags = !{!0, !1}70 !llvm.ident = !{!2}71 72 !0 = !{i32 1, !"wchar_size", i32 4}73 !1 = !{i32 7, !"PIC Level", i32 2}74 !2 = !{!"clang version 6.0.0 (trunk 318832)"}75 !3 = !{!4, !4, i64 0}76 !4 = !{!"long long", !5, i64 0}77 !5 = !{!"omnipotent char", !6, i64 0}78 !6 = !{!"Simple C/C++ TBAA"}79 80...81---82name: unsafeAddR0R383alignment: 1684exposesReturnsTwice: false85legalized: false86regBankSelected: false87selected: false88tracksRegLiveness: true89registers: 90 - { id: 0, class: g8rc, preferred-register: '' }91 - { id: 1, class: g8rc, preferred-register: '' }92 - { id: 2, class: gprc, preferred-register: '' }93 - { id: 3, class: gprc, preferred-register: '' }94 - { id: 4, class: gprc, preferred-register: '' }95 - { id: 5, class: g8rc, preferred-register: '' }96liveins: 97 - { reg: '$x3', virtual-reg: '%0' }98 - { reg: '$x4', virtual-reg: '%1' }99frameInfo: 100 isFrameAddressTaken: false101 isReturnAddressTaken: false102 hasStackMap: false103 hasPatchPoint: false104 stackSize: 0105 offsetAdjustment: 0106 maxAlignment: 0107 adjustsStack: false108 hasCalls: false109 stackProtector: ''110 maxCallFrameSize: 4294967295111 hasOpaqueSPAdjustment: false112 hasVAStart: false113 hasMustTailInVarArgFunc: false114 savePoint: []115 restorePoint: []116fixedStack: 117stack: 118constants: 119body: |120 bb.0.entry:121 liveins: $x0, $x4122 123 %1:g8rc = COPY $x4124 %0:g8rc = COPY $x0125 %2:gprc = LI 44126 %3:gprc = COPY %1.sub_32127 %4:gprc = ADD4 killed $r0, killed %2128 ; CHECK: li 3, 44129 ; CHECK: add 3, 0, 3130 %5:g8rc = EXTSW_32_64 killed %4131 $x3 = COPY %5132 BLR8 implicit $lr8, implicit $rm, implicit $x3133 134...135---136name: unsafeAddR3R0137alignment: 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, preferred-register: '' }147 - { id: 3, class: gprc, preferred-register: '' }148 - { id: 4, class: gprc, preferred-register: '' }149 - { id: 5, class: g8rc, preferred-register: '' }150liveins: 151 - { reg: '$x3', virtual-reg: '%0' }152 - { reg: '$x4', virtual-reg: '%1' }153frameInfo: 154 isFrameAddressTaken: false155 isReturnAddressTaken: false156 hasStackMap: false157 hasPatchPoint: false158 stackSize: 0159 offsetAdjustment: 0160 maxAlignment: 0161 adjustsStack: false162 hasCalls: false163 stackProtector: ''164 maxCallFrameSize: 4294967295165 hasOpaqueSPAdjustment: false166 hasVAStart: false167 hasMustTailInVarArgFunc: false168 savePoint: []169 restorePoint: []170fixedStack: 171stack: 172constants: 173body: |174 bb.0.entry:175 liveins: $x0, $x4176 177 %1:g8rc = COPY $x4178 %0:g8rc = COPY $x0179 %2:gprc = COPY %0.sub_32180 %3:gprc = LI 44181 %4:gprc = ADD4 killed %3, killed $r0182 ; CHECK: li 3, 44183 ; CHECK: add 3, 3, 0184 %5:g8rc = EXTSW_32_64 killed %4185 $x3 = COPY %5186 BLR8 implicit $lr8, implicit $rm, implicit $x3187 188...189---190name: safeAddR0R3191alignment: 16192exposesReturnsTwice: false193legalized: false194regBankSelected: false195selected: false196tracksRegLiveness: true197registers: 198 - { id: 0, class: g8rc, preferred-register: '' }199 - { id: 1, class: g8rc, preferred-register: '' }200 - { id: 2, class: gprc, preferred-register: '' }201 - { id: 3, class: gprc, preferred-register: '' }202 - { id: 4, class: gprc, preferred-register: '' }203 - { id: 5, class: g8rc, preferred-register: '' }204liveins: 205 - { reg: '$x3', virtual-reg: '%0' }206 - { reg: '$x4', virtual-reg: '%1' }207frameInfo: 208 isFrameAddressTaken: false209 isReturnAddressTaken: false210 hasStackMap: false211 hasPatchPoint: false212 stackSize: 0213 offsetAdjustment: 0214 maxAlignment: 0215 adjustsStack: false216 hasCalls: false217 stackProtector: ''218 maxCallFrameSize: 4294967295219 hasOpaqueSPAdjustment: false220 hasVAStart: false221 hasMustTailInVarArgFunc: false222 savePoint: []223 restorePoint: []224fixedStack: 225stack: 226constants: 227body: |228 bb.0.entry:229 liveins: $x3, $x4230 231 %1:g8rc = COPY $x4232 %0:g8rc = COPY $x3233 %2:gprc = COPY %0.sub_32234 $r0 = LI 44235 %4:gprc = ADD4 killed $r0, killed %2236 ; CHECK: addi 3, 3, 44237 %5:g8rc = EXTSW_32_64 killed %4238 $x3 = COPY %5239 BLR8 implicit $lr8, implicit $rm, implicit $x3240 241...242---243name: safeAddR3R0244alignment: 16245exposesReturnsTwice: false246legalized: false247regBankSelected: false248selected: false249tracksRegLiveness: true250registers: 251 - { id: 0, class: g8rc, preferred-register: '' }252 - { id: 1, class: g8rc, preferred-register: '' }253 - { id: 2, class: gprc, preferred-register: '' }254 - { id: 3, class: gprc, preferred-register: '' }255 - { id: 4, class: gprc, preferred-register: '' }256 - { id: 5, class: g8rc, preferred-register: '' }257liveins: 258 - { reg: '$x3', virtual-reg: '%0' }259 - { reg: '$x4', virtual-reg: '%1' }260frameInfo: 261 isFrameAddressTaken: false262 isReturnAddressTaken: false263 hasStackMap: false264 hasPatchPoint: false265 stackSize: 0266 offsetAdjustment: 0267 maxAlignment: 0268 adjustsStack: false269 hasCalls: false270 stackProtector: ''271 maxCallFrameSize: 4294967295272 hasOpaqueSPAdjustment: false273 hasVAStart: false274 hasMustTailInVarArgFunc: false275 savePoint: []276 restorePoint: []277fixedStack: 278stack: 279constants: 280body: |281 bb.0.entry:282 liveins: $x3, $x4283 284 %1:g8rc = COPY $x4285 %0:g8rc = COPY $x3286 %2:gprc = COPY %0.sub_32287 $r0 = LI 44288 %4:gprc = ADD4 killed %2, killed $r0289 ; CHECK: addi 3, 3, 44290 %5:g8rc = EXTSW_32_64 killed %4291 $x3 = COPY %5292 BLR8 implicit $lr8, implicit $rm, implicit $x3293 294...295---296name: unsafeLDXR3R0297alignment: 16298exposesReturnsTwice: false299legalized: false300regBankSelected: false301selected: false302tracksRegLiveness: true303registers: 304 - { id: 0, class: g8rc_and_g8rc_nox0, preferred-register: '' }305 - { id: 1, class: g8rc, preferred-register: '' }306 - { id: 2, class: g8rc, preferred-register: '' }307liveins: 308 - { reg: '$x0', virtual-reg: '%0' }309 - { reg: '$x4', virtual-reg: '%1' }310frameInfo: 311 isFrameAddressTaken: false312 isReturnAddressTaken: false313 hasStackMap: false314 hasPatchPoint: false315 stackSize: 0316 offsetAdjustment: 0317 maxAlignment: 0318 adjustsStack: false319 hasCalls: false320 stackProtector: ''321 maxCallFrameSize: 4294967295322 hasOpaqueSPAdjustment: false323 hasVAStart: false324 hasMustTailInVarArgFunc: false325 savePoint: []326 restorePoint: []327fixedStack: 328stack: 329constants: 330body: |331 bb.0.entry:332 liveins: $x0, $x4333 334 %1:g8rc = COPY $x4335 %0:g8rc_and_g8rc_nox0 = LI8 44336 %2:g8rc = LDX %0, $x0 :: (load (s64) from %ir.1, !tbaa !3)337 ; CHECK: li 3, 44338 ; CHECK: ldx 3, 3, 0339 $x3 = COPY %2340 BLR8 implicit $lr8, implicit $rm, implicit $x3341 342...343---344name: safeLDXZeroR3345alignment: 16346exposesReturnsTwice: false347legalized: false348regBankSelected: false349selected: false350tracksRegLiveness: true351registers: 352 - { id: 0, class: g8rc_and_g8rc_nox0, preferred-register: '' }353 - { id: 1, class: g8rc, preferred-register: '' }354 - { id: 2, class: g8rc, preferred-register: '' }355liveins: 356 - { reg: '$x3', virtual-reg: '%0' }357 - { reg: '$x4', virtual-reg: '%1' }358frameInfo: 359 isFrameAddressTaken: false360 isReturnAddressTaken: false361 hasStackMap: false362 hasPatchPoint: false363 stackSize: 0364 offsetAdjustment: 0365 maxAlignment: 0366 adjustsStack: false367 hasCalls: false368 stackProtector: ''369 maxCallFrameSize: 4294967295370 hasOpaqueSPAdjustment: false371 hasVAStart: false372 hasMustTailInVarArgFunc: false373 savePoint: []374 restorePoint: []375fixedStack: 376stack: 377constants: 378body: |379 bb.0.entry:380 liveins: $x3, $x4381 382 %1:g8rc = LI8 44383 %0:g8rc_and_g8rc_nox0 = LI8 44384 %2:g8rc = LDX $zero8, %1 :: (load (s64) from %ir.1, !tbaa !3)385 ; CHECK: ld 3, 44(0)386 $x3 = COPY %2387 BLR8 implicit $lr8, implicit $rm, implicit $x3388 389...390---391name: safeLDXR3R0392alignment: 16393exposesReturnsTwice: false394legalized: false395regBankSelected: false396selected: false397tracksRegLiveness: true398registers: 399 - { id: 0, class: g8rc_and_g8rc_nox0, preferred-register: '' }400 - { id: 1, class: g8rc, preferred-register: '' }401 - { id: 2, class: g8rc, preferred-register: '' }402liveins: 403 - { reg: '$x3', virtual-reg: '%0' }404 - { reg: '$x4', virtual-reg: '%1' }405frameInfo: 406 isFrameAddressTaken: false407 isReturnAddressTaken: false408 hasStackMap: false409 hasPatchPoint: false410 stackSize: 0411 offsetAdjustment: 0412 maxAlignment: 0413 adjustsStack: false414 hasCalls: false415 stackProtector: ''416 maxCallFrameSize: 4294967295417 hasOpaqueSPAdjustment: false418 hasVAStart: false419 hasMustTailInVarArgFunc: false420 savePoint: []421 restorePoint: []422fixedStack: 423stack: 424constants: 425body: |426 bb.0.entry:427 liveins: $x3, $x4428 429 $x0 = LI8 44430 %0:g8rc_and_g8rc_nox0 = COPY $x3431 %2:g8rc = LDX %0, $x0 :: (load (s64) from %ir.1, !tbaa !3)432 ; CHECK: ld 3, 44(3)433 $x3 = COPY %2434 BLR8 implicit $lr8, implicit $rm, implicit $x3435 436...437