1# RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple powerpc64le-unknown-linux-gnu \ 2# RUN: -run-pass=shrink-wrap -o - %s | FileCheck %s 3# RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple powerpc-ibm-aix-xcoff \ 4# RUN: -run-pass=shrink-wrap -mattr=-altivec -o - %s | FileCheck %s 5# RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple powerpc64-ibm-aix-xcoff \ 6# RUN: -run-pass=shrink-wrap -mattr=-altivec -o - %s | FileCheck %s 7--- | 8 ; ModuleID = 'test.ll' 9 source_filename = "test.ll" 10 target datalayout = "e-m:e-i64:64-n32:64" 11 12 define signext i32 @shrinkwrapme(i32 signext %a, i32 signext %lim) { 13 entry: 14 %cmp5 = icmp sgt i32 %lim, 0 15 br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup 16 17 for.body.preheader: ; preds = %entry 18 %0 = add i32 %lim, -1 19 %1 = zext i32 %0 to i64 20 %2 = add nuw nsw i64 %1, 1 21 call void @llvm.set.loop.iterations.i64(i64 %2) 22 br label %for.body 23 24 for.cond.cleanup: ; preds = %for.body, %entry 25 %Ret.0.lcssa = phi i32 [ 0, %entry ], [ %3, %for.body ] 26 ret i32 %Ret.0.lcssa 27 28 for.body: ; preds = %for.body, %for.body.preheader 29 %Ret.06 = phi i32 [ %3, %for.body ], [ 0, %for.body.preheader ] 30 %3 = tail call i32 asm "add $0, $1, $2", "=r,r,r,~{r14},~{r15},~{r16},~{r17},~{r18},~{r19},~{r20},~{r21},~{r22},~{r23},~{r24},~{r25},~{r26},~{r27},~{r28},~{r29},~{r30},~{r31}"(i32 %a, i32 %Ret.06) 31 %4 = call i1 @llvm.loop.decrement.i64(i64 1) 32 br i1 %4, label %for.body, label %for.cond.cleanup 33 } 34 35 ; Function Attrs: noduplicate nounwind 36 declare void @llvm.set.loop.iterations.i64(i64) #0 37 38 ; Function Attrs: noduplicate nounwind 39 declare i1 @llvm.loop.decrement.i64(i64) #0 40 41 ; Function Attrs: nounwind 42 declare void @llvm.stackprotector(i8*, i8**) #1 43 44 attributes #0 = { noduplicate nounwind } 45 attributes #1 = { nounwind } 46 47... 48--- 49name: shrinkwrapme 50alignment: 16 51exposesReturnsTwice: false 52legalized: false 53regBankSelected: false 54selected: false 55failedISel: false 56tracksRegLiveness: true 57hasWinCFI: false 58registers: [] 59liveins: 60 - { reg: '$x3', virtual-reg: '' } 61 - { reg: '$x4', virtual-reg: '' } 62frameInfo: 63 isFrameAddressTaken: false 64 isReturnAddressTaken: false 65 hasStackMap: false 66 hasPatchPoint: false 67 stackSize: 0 68 offsetAdjustment: 0 69 maxAlignment: 0 70 adjustsStack: false 71 hasCalls: false 72 stackProtector: '' 73 maxCallFrameSize: 4294967295 74 cvBytesOfCalleeSavedRegisters: 0 75 hasOpaqueSPAdjustment: false 76 hasVAStart: false 77 hasMustTailInVarArgFunc: false 78 localFrameSize: 0 79 savePoint: '' 80 restorePoint: '' 81fixedStack: [] 82stack: [] 83callSites: [] 84constants: [] 85machineFunctionInfo: {} 86body: | 87 bb.0.entry: 88 successors: %bb.2(0x50000000), %bb.1(0x30000000) 89 liveins: $x3, $x4 90 91 renamable $cr0 = CMPWI renamable $r4, 1 92 BCC 4, killed renamable $cr0, %bb.2 93 94 bb.1: 95 successors: %bb.3(0x80000000) 96 97 renamable $r4 = LI 0 98 B %bb.3 99 100 bb.2.for.body.preheader: 101 successors: %bb.4(0x80000000) 102 liveins: $x3, $x4 103 104 renamable $r4 = ADDI renamable $r4, -1, implicit killed $x4, implicit-def $x4 105 renamable $x4 = RLDICL killed renamable $x4, 0, 32 106 renamable $x4 = nuw nsw ADDI8 killed renamable $x4, 1 107 MTCTR8loop killed renamable $x4, implicit-def dead $ctr8 108 renamable $r4 = LI 0 109 B %bb.4 110 111 bb.3.for.cond.cleanup: 112 liveins: $r4 113 114 renamable $x3 = EXTSW_32_64 killed renamable $r4 115 BLR8 implicit $lr8, implicit $rm, implicit $x3 116 117 bb.4.for.body: 118 successors: %bb.4(0x7c000000), %bb.3(0x04000000) 119 liveins: $r4, $x3 120 121 INLINEASM &"add $0, $1, $2", 0, 131082, def renamable $r4, 131081, renamable $r3, 131081, killed renamable $r4, 12, implicit-def dead early-clobber $r14, 12, implicit-def dead early-clobber $r15, 12, implicit-def dead early-clobber $r16, 12, implicit-def dead early-clobber $r17, 12, implicit-def dead early-clobber $r18, 12, implicit-def dead early-clobber $r19, 12, implicit-def dead early-clobber $r20, 12, implicit-def dead early-clobber $r21, 12, implicit-def dead early-clobber $r22, 12, implicit-def dead early-clobber $r23, 12, implicit-def dead early-clobber $r24, 12, implicit-def dead early-clobber $r25, 12, implicit-def dead early-clobber $r26, 12, implicit-def dead early-clobber $r27, 12, implicit-def dead early-clobber $r28, 12, implicit-def dead early-clobber $r29, 12, implicit-def dead early-clobber $r30, 12, implicit-def dead early-clobber $r31 122 BDNZ8 %bb.4, implicit-def dead $ctr8, implicit $ctr8 123 B %bb.3 124 125 ; CHECK: savePoint: '' 126 ; CHECK-NEXT: restorePoint: '' 127 128 ; CHECK: bb.4.for.body: 129 ; CHECK-NEXT: successors: %bb.4(0x7c000000), %bb.3(0x04000000) 130 ; CHECK-NEXT: liveins: $r4, $x3 131 ; CHECK: INLINEASM 132 ; CHECK-NEXT: BDNZ8 %bb.4 133 ; CHECK-NEXT: B %bb.3 134... 135