1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 2
2 # RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple powerpc64le-unknown-linux-gnu \
3 # RUN: -run-pass=shrink-wrap -o - %s | FileCheck %s
4 # RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple powerpc-ibm-aix-xcoff \
5 # RUN: -run-pass=shrink-wrap -mattr=-altivec -o - %s | FileCheck %s
6 # RUN: llc -verify-machineinstrs -mcpu=pwr9 -mtriple powerpc64-ibm-aix-xcoff \
7 # RUN: -run-pass=shrink-wrap -mattr=-altivec -o - %s | FileCheck %s
10 source_filename = "test.ll"
11 target datalayout = "e-m:e-i64:64-n32:64"
13 define signext i32 @shrinkwrapme(i32 signext %a, i32 signext %lim) {
15 %cmp5 = icmp sgt i32 %lim, 0
16 br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup
18 for.body.preheader: ; preds = %entry
20 %1 = zext i32 %0 to i64
21 %2 = add nuw nsw i64 %1, 1
22 call void @llvm.set.loop.iterations.i64(i64 %2)
25 for.cond.cleanup: ; preds = %for.body, %entry
26 %Ret.0.lcssa = phi i32 [ 0, %entry ], [ %3, %for.body ]
29 for.body: ; preds = %for.body, %for.body.preheader
30 %Ret.06 = phi i32 [ %3, %for.body ], [ 0, %for.body.preheader ]
31 %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)
32 %4 = call i1 @llvm.loop.decrement.i64(i64 1)
33 br i1 %4, label %for.body, label %for.cond.cleanup
36 ; Function Attrs: noduplicate nounwind
37 declare void @llvm.set.loop.iterations.i64(i64) #0
39 ; Function Attrs: noduplicate nounwind
40 declare i1 @llvm.loop.decrement.i64(i64) #0
42 ; Function Attrs: nounwind
43 declare void @llvm.stackprotector(ptr, ptr) #1
45 attributes #0 = { noduplicate nounwind }
46 attributes #1 = { nounwind }
51 tracksRegLiveness: true
53 ; CHECK-LABEL: name: shrinkwrapme
55 ; CHECK-NEXT: successors: %bb.2(0x50000000), %bb.1(0x30000000)
56 ; CHECK-NEXT: liveins: $x3, $x4
58 ; CHECK-NEXT: renamable $cr0 = CMPWI renamable $r4, 1
59 ; CHECK-NEXT: BCC 4, killed renamable $cr0, %bb.2
62 ; CHECK-NEXT: successors: %bb.3(0x80000000)
64 ; CHECK-NEXT: renamable $r4 = LI 0
67 ; CHECK-NEXT: bb.2.for.body.preheader:
68 ; CHECK-NEXT: successors: %bb.4(0x80000000)
69 ; CHECK-NEXT: liveins: $x3, $x4
71 ; CHECK-NEXT: renamable $r4 = ADDI renamable $r4, -1, implicit killed $x4, implicit-def $x4
72 ; CHECK-NEXT: renamable $x4 = RLDICL killed renamable $x4, 0, 32
73 ; CHECK-NEXT: renamable $x4 = nuw nsw ADDI8 killed renamable $x4, 1
74 ; CHECK-NEXT: MTCTR8loop killed renamable $x4, implicit-def dead $ctr8
75 ; CHECK-NEXT: renamable $r4 = LI 0
78 ; CHECK-NEXT: bb.3.for.cond.cleanup:
79 ; CHECK-NEXT: liveins: $r4
81 ; CHECK-NEXT: renamable $x3 = EXTSW_32_64 killed renamable $r4
82 ; CHECK-NEXT: BLR8 implicit $lr8, implicit $rm, implicit $x3
84 ; CHECK-NEXT: bb.4.for.body:
85 ; CHECK-NEXT: successors: %bb.4(0x7c000000), %bb.5(0x04000000)
86 ; CHECK-NEXT: liveins: $r4, $x3
88 ; CHECK-NEXT: INLINEASM &"add $0, $1, $2", 0 /* attdialect */, 131082 /* regdef:GPRC */, def renamable $r4, 131081 /* reguse:GPRC */, renamable $r3, 131081 /* reguse:GPRC */, killed renamable $r4, 12 /* clobber */, implicit-def dead early-clobber $r14, 12 /* clobber */, implicit-def dead early-clobber $r15, 12 /* clobber */, implicit-def dead early-clobber $r16, 12 /* clobber */, implicit-def dead early-clobber $r17, 12 /* clobber */, implicit-def dead early-clobber $r18, 12 /* clobber */, implicit-def dead early-clobber $r19, 12 /* clobber */, implicit-def dead early-clobber $r20, 12 /* clobber */, implicit-def dead early-clobber $r21, 12 /* clobber */, implicit-def dead early-clobber $r22, 12 /* clobber */, implicit-def dead early-clobber $r23, 12 /* clobber */, implicit-def dead early-clobber $r24, 12 /* clobber */, implicit-def dead early-clobber $r25, 12 /* clobber */, implicit-def dead early-clobber $r26, 12 /* clobber */, implicit-def dead early-clobber $r27, 12 /* clobber */, implicit-def dead early-clobber $r28, 12 /* clobber */, implicit-def dead early-clobber $r29, 12 /* clobber */, implicit-def dead early-clobber $r30, 12 /* clobber */, implicit-def dead early-clobber $r31
89 ; CHECK-NEXT: BDNZ8 %bb.4, implicit-def dead $ctr8, implicit $ctr8
93 ; CHECK-NEXT: successors: %bb.3(0x80000000)
94 ; CHECK-NEXT: liveins: $r4
98 successors: %bb.2(0x50000000), %bb.1(0x30000000)
101 renamable $cr0 = CMPWI renamable $r4, 1
102 BCC 4, killed renamable $cr0, %bb.2
105 successors: %bb.3(0x80000000)
110 bb.2.for.body.preheader:
111 successors: %bb.4(0x80000000)
114 renamable $r4 = ADDI renamable $r4, -1, implicit killed $x4, implicit-def $x4
115 renamable $x4 = RLDICL killed renamable $x4, 0, 32
116 renamable $x4 = nuw nsw ADDI8 killed renamable $x4, 1
117 MTCTR8loop killed renamable $x4, implicit-def dead $ctr8
121 bb.3.for.cond.cleanup:
124 renamable $x3 = EXTSW_32_64 killed renamable $r4
125 BLR8 implicit $lr8, implicit $rm, implicit $x3
128 successors: %bb.4(0x7c000000), %bb.3(0x04000000)
131 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
132 BDNZ8 %bb.4, implicit-def dead $ctr8, implicit $ctr8