1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-unknown -mcpu=pwr9 | FileCheck %s --check-prefixes=POWERPC64
3 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-ibm-aix-xcoff -mcpu=pwr9 -mattr=-altivec | FileCheck %s --check-prefixes=POWERPC32-AIX
4 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-ibm-aix-xcoff -mcpu=pwr9 -mattr=-altivec | FileCheck %s --check-prefixes=POWERPC64-AIX
6 define signext i32 @shrinkwrapme(i32 signext %a, i32 signext %lim) {
7 ; POWERPC64-LABEL: shrinkwrapme:
8 ; POWERPC64: # %bb.0: # %entry
9 ; POWERPC64-NEXT: cmpwi 4, 0
10 ; POWERPC64-NEXT: ble 0, .LBB0_4
11 ; POWERPC64-NEXT: # %bb.1: # %for.body.preheader
12 ; POWERPC64-NEXT: addi 4, 4, -1
13 ; POWERPC64-NEXT: std 14, -144(1) # 8-byte Folded Spill
14 ; POWERPC64-NEXT: std 15, -136(1) # 8-byte Folded Spill
15 ; POWERPC64-NEXT: std 16, -128(1) # 8-byte Folded Spill
16 ; POWERPC64-NEXT: std 17, -120(1) # 8-byte Folded Spill
17 ; POWERPC64-NEXT: std 18, -112(1) # 8-byte Folded Spill
18 ; POWERPC64-NEXT: std 19, -104(1) # 8-byte Folded Spill
19 ; POWERPC64-NEXT: std 20, -96(1) # 8-byte Folded Spill
20 ; POWERPC64-NEXT: std 21, -88(1) # 8-byte Folded Spill
21 ; POWERPC64-NEXT: std 22, -80(1) # 8-byte Folded Spill
22 ; POWERPC64-NEXT: std 23, -72(1) # 8-byte Folded Spill
23 ; POWERPC64-NEXT: std 24, -64(1) # 8-byte Folded Spill
24 ; POWERPC64-NEXT: std 25, -56(1) # 8-byte Folded Spill
25 ; POWERPC64-NEXT: std 26, -48(1) # 8-byte Folded Spill
26 ; POWERPC64-NEXT: std 27, -40(1) # 8-byte Folded Spill
27 ; POWERPC64-NEXT: std 28, -32(1) # 8-byte Folded Spill
28 ; POWERPC64-NEXT: clrldi 4, 4, 32
29 ; POWERPC64-NEXT: addi 4, 4, 1
30 ; POWERPC64-NEXT: std 29, -24(1) # 8-byte Folded Spill
31 ; POWERPC64-NEXT: std 30, -16(1) # 8-byte Folded Spill
32 ; POWERPC64-NEXT: std 31, -8(1) # 8-byte Folded Spill
33 ; POWERPC64-NEXT: mtctr 4
34 ; POWERPC64-NEXT: li 4, 0
35 ; POWERPC64-NEXT: .p2align 4
36 ; POWERPC64-NEXT: .LBB0_2: # %for.body
38 ; POWERPC64-NEXT: #APP
39 ; POWERPC64-NEXT: add 4, 3, 4
40 ; POWERPC64-NEXT: #NO_APP
41 ; POWERPC64-NEXT: bdnz .LBB0_2
42 ; POWERPC64-NEXT: # %bb.3:
43 ; POWERPC64-NEXT: ld 31, -8(1) # 8-byte Folded Reload
44 ; POWERPC64-NEXT: ld 30, -16(1) # 8-byte Folded Reload
45 ; POWERPC64-NEXT: ld 29, -24(1) # 8-byte Folded Reload
46 ; POWERPC64-NEXT: ld 28, -32(1) # 8-byte Folded Reload
47 ; POWERPC64-NEXT: extsw 3, 4
48 ; POWERPC64-NEXT: ld 27, -40(1) # 8-byte Folded Reload
49 ; POWERPC64-NEXT: ld 26, -48(1) # 8-byte Folded Reload
50 ; POWERPC64-NEXT: ld 25, -56(1) # 8-byte Folded Reload
51 ; POWERPC64-NEXT: ld 24, -64(1) # 8-byte Folded Reload
52 ; POWERPC64-NEXT: ld 23, -72(1) # 8-byte Folded Reload
53 ; POWERPC64-NEXT: ld 22, -80(1) # 8-byte Folded Reload
54 ; POWERPC64-NEXT: ld 21, -88(1) # 8-byte Folded Reload
55 ; POWERPC64-NEXT: ld 20, -96(1) # 8-byte Folded Reload
56 ; POWERPC64-NEXT: ld 19, -104(1) # 8-byte Folded Reload
57 ; POWERPC64-NEXT: ld 18, -112(1) # 8-byte Folded Reload
58 ; POWERPC64-NEXT: ld 17, -120(1) # 8-byte Folded Reload
59 ; POWERPC64-NEXT: ld 16, -128(1) # 8-byte Folded Reload
60 ; POWERPC64-NEXT: ld 15, -136(1) # 8-byte Folded Reload
61 ; POWERPC64-NEXT: ld 14, -144(1) # 8-byte Folded Reload
63 ; POWERPC64-NEXT: .LBB0_4:
64 ; POWERPC64-NEXT: li 4, 0
65 ; POWERPC64-NEXT: extsw 3, 4
68 ; POWERPC32-AIX-LABEL: shrinkwrapme:
69 ; POWERPC32-AIX: # %bb.0: # %entry
70 ; POWERPC32-AIX-NEXT: cmpwi 4, 0
71 ; POWERPC32-AIX-NEXT: ble 0, L..BB0_4
72 ; POWERPC32-AIX-NEXT: # %bb.1: # %for.body.preheader
73 ; POWERPC32-AIX-NEXT: stw 14, -72(1) # 4-byte Folded Spill
74 ; POWERPC32-AIX-NEXT: stw 15, -68(1) # 4-byte Folded Spill
75 ; POWERPC32-AIX-NEXT: stw 16, -64(1) # 4-byte Folded Spill
76 ; POWERPC32-AIX-NEXT: stw 17, -60(1) # 4-byte Folded Spill
77 ; POWERPC32-AIX-NEXT: stw 18, -56(1) # 4-byte Folded Spill
78 ; POWERPC32-AIX-NEXT: stw 19, -52(1) # 4-byte Folded Spill
79 ; POWERPC32-AIX-NEXT: stw 20, -48(1) # 4-byte Folded Spill
80 ; POWERPC32-AIX-NEXT: stw 21, -44(1) # 4-byte Folded Spill
81 ; POWERPC32-AIX-NEXT: stw 22, -40(1) # 4-byte Folded Spill
82 ; POWERPC32-AIX-NEXT: stw 23, -36(1) # 4-byte Folded Spill
83 ; POWERPC32-AIX-NEXT: stw 24, -32(1) # 4-byte Folded Spill
84 ; POWERPC32-AIX-NEXT: stw 25, -28(1) # 4-byte Folded Spill
85 ; POWERPC32-AIX-NEXT: stw 26, -24(1) # 4-byte Folded Spill
86 ; POWERPC32-AIX-NEXT: stw 27, -20(1) # 4-byte Folded Spill
87 ; POWERPC32-AIX-NEXT: stw 28, -16(1) # 4-byte Folded Spill
88 ; POWERPC32-AIX-NEXT: stw 29, -12(1) # 4-byte Folded Spill
89 ; POWERPC32-AIX-NEXT: stw 30, -8(1) # 4-byte Folded Spill
90 ; POWERPC32-AIX-NEXT: stw 31, -4(1) # 4-byte Folded Spill
91 ; POWERPC32-AIX-NEXT: mtctr 4
92 ; POWERPC32-AIX-NEXT: li 4, 0
93 ; POWERPC32-AIX-NEXT: .align 4
94 ; POWERPC32-AIX-NEXT: L..BB0_2: # %for.body
95 ; POWERPC32-AIX-NEXT: #
96 ; POWERPC32-AIX-NEXT: #APP
97 ; POWERPC32-AIX-NEXT: add 4, 3, 4
98 ; POWERPC32-AIX-NEXT: #NO_APP
99 ; POWERPC32-AIX-NEXT: bdnz L..BB0_2
100 ; POWERPC32-AIX-NEXT: # %bb.3:
101 ; POWERPC32-AIX-NEXT: lwz 31, -4(1) # 4-byte Folded Reload
102 ; POWERPC32-AIX-NEXT: lwz 30, -8(1) # 4-byte Folded Reload
103 ; POWERPC32-AIX-NEXT: lwz 29, -12(1) # 4-byte Folded Reload
104 ; POWERPC32-AIX-NEXT: lwz 28, -16(1) # 4-byte Folded Reload
105 ; POWERPC32-AIX-NEXT: mr 3, 4
106 ; POWERPC32-AIX-NEXT: lwz 27, -20(1) # 4-byte Folded Reload
107 ; POWERPC32-AIX-NEXT: lwz 26, -24(1) # 4-byte Folded Reload
108 ; POWERPC32-AIX-NEXT: lwz 25, -28(1) # 4-byte Folded Reload
109 ; POWERPC32-AIX-NEXT: lwz 24, -32(1) # 4-byte Folded Reload
110 ; POWERPC32-AIX-NEXT: lwz 23, -36(1) # 4-byte Folded Reload
111 ; POWERPC32-AIX-NEXT: lwz 22, -40(1) # 4-byte Folded Reload
112 ; POWERPC32-AIX-NEXT: lwz 21, -44(1) # 4-byte Folded Reload
113 ; POWERPC32-AIX-NEXT: lwz 20, -48(1) # 4-byte Folded Reload
114 ; POWERPC32-AIX-NEXT: lwz 19, -52(1) # 4-byte Folded Reload
115 ; POWERPC32-AIX-NEXT: lwz 18, -56(1) # 4-byte Folded Reload
116 ; POWERPC32-AIX-NEXT: lwz 17, -60(1) # 4-byte Folded Reload
117 ; POWERPC32-AIX-NEXT: lwz 16, -64(1) # 4-byte Folded Reload
118 ; POWERPC32-AIX-NEXT: lwz 15, -68(1) # 4-byte Folded Reload
119 ; POWERPC32-AIX-NEXT: lwz 14, -72(1) # 4-byte Folded Reload
120 ; POWERPC32-AIX-NEXT: blr
121 ; POWERPC32-AIX-NEXT: L..BB0_4:
122 ; POWERPC32-AIX-NEXT: li 3, 0
123 ; POWERPC32-AIX-NEXT: blr
125 ; POWERPC64-AIX-LABEL: shrinkwrapme:
126 ; POWERPC64-AIX: # %bb.0: # %entry
127 ; POWERPC64-AIX-NEXT: cmpwi 4, 1
128 ; POWERPC64-AIX-NEXT: blt 0, L..BB0_4
129 ; POWERPC64-AIX-NEXT: # %bb.1: # %for.body.preheader
130 ; POWERPC64-AIX-NEXT: addi 4, 4, -1
131 ; POWERPC64-AIX-NEXT: std 14, -144(1) # 8-byte Folded Spill
132 ; POWERPC64-AIX-NEXT: std 15, -136(1) # 8-byte Folded Spill
133 ; POWERPC64-AIX-NEXT: std 16, -128(1) # 8-byte Folded Spill
134 ; POWERPC64-AIX-NEXT: std 17, -120(1) # 8-byte Folded Spill
135 ; POWERPC64-AIX-NEXT: std 18, -112(1) # 8-byte Folded Spill
136 ; POWERPC64-AIX-NEXT: std 19, -104(1) # 8-byte Folded Spill
137 ; POWERPC64-AIX-NEXT: std 20, -96(1) # 8-byte Folded Spill
138 ; POWERPC64-AIX-NEXT: std 21, -88(1) # 8-byte Folded Spill
139 ; POWERPC64-AIX-NEXT: std 22, -80(1) # 8-byte Folded Spill
140 ; POWERPC64-AIX-NEXT: std 23, -72(1) # 8-byte Folded Spill
141 ; POWERPC64-AIX-NEXT: std 24, -64(1) # 8-byte Folded Spill
142 ; POWERPC64-AIX-NEXT: std 25, -56(1) # 8-byte Folded Spill
143 ; POWERPC64-AIX-NEXT: std 26, -48(1) # 8-byte Folded Spill
144 ; POWERPC64-AIX-NEXT: std 27, -40(1) # 8-byte Folded Spill
145 ; POWERPC64-AIX-NEXT: std 28, -32(1) # 8-byte Folded Spill
146 ; POWERPC64-AIX-NEXT: clrldi 4, 4, 32
147 ; POWERPC64-AIX-NEXT: addi 4, 4, 1
148 ; POWERPC64-AIX-NEXT: std 29, -24(1) # 8-byte Folded Spill
149 ; POWERPC64-AIX-NEXT: std 30, -16(1) # 8-byte Folded Spill
150 ; POWERPC64-AIX-NEXT: std 31, -8(1) # 8-byte Folded Spill
151 ; POWERPC64-AIX-NEXT: mtctr 4
152 ; POWERPC64-AIX-NEXT: li 4, 0
153 ; POWERPC64-AIX-NEXT: .align 4
154 ; POWERPC64-AIX-NEXT: L..BB0_2: # %for.body
155 ; POWERPC64-AIX-NEXT: #
156 ; POWERPC64-AIX-NEXT: #APP
157 ; POWERPC64-AIX-NEXT: add 4, 3, 4
158 ; POWERPC64-AIX-NEXT: #NO_APP
159 ; POWERPC64-AIX-NEXT: bdnz L..BB0_2
160 ; POWERPC64-AIX-NEXT: # %bb.3:
161 ; POWERPC64-AIX-NEXT: ld 31, -8(1) # 8-byte Folded Reload
162 ; POWERPC64-AIX-NEXT: ld 30, -16(1) # 8-byte Folded Reload
163 ; POWERPC64-AIX-NEXT: ld 29, -24(1) # 8-byte Folded Reload
164 ; POWERPC64-AIX-NEXT: ld 28, -32(1) # 8-byte Folded Reload
165 ; POWERPC64-AIX-NEXT: extsw 3, 4
166 ; POWERPC64-AIX-NEXT: ld 27, -40(1) # 8-byte Folded Reload
167 ; POWERPC64-AIX-NEXT: ld 26, -48(1) # 8-byte Folded Reload
168 ; POWERPC64-AIX-NEXT: ld 25, -56(1) # 8-byte Folded Reload
169 ; POWERPC64-AIX-NEXT: ld 24, -64(1) # 8-byte Folded Reload
170 ; POWERPC64-AIX-NEXT: ld 23, -72(1) # 8-byte Folded Reload
171 ; POWERPC64-AIX-NEXT: ld 22, -80(1) # 8-byte Folded Reload
172 ; POWERPC64-AIX-NEXT: ld 21, -88(1) # 8-byte Folded Reload
173 ; POWERPC64-AIX-NEXT: ld 20, -96(1) # 8-byte Folded Reload
174 ; POWERPC64-AIX-NEXT: ld 19, -104(1) # 8-byte Folded Reload
175 ; POWERPC64-AIX-NEXT: ld 18, -112(1) # 8-byte Folded Reload
176 ; POWERPC64-AIX-NEXT: ld 17, -120(1) # 8-byte Folded Reload
177 ; POWERPC64-AIX-NEXT: ld 16, -128(1) # 8-byte Folded Reload
178 ; POWERPC64-AIX-NEXT: ld 15, -136(1) # 8-byte Folded Reload
179 ; POWERPC64-AIX-NEXT: ld 14, -144(1) # 8-byte Folded Reload
180 ; POWERPC64-AIX-NEXT: blr
181 ; POWERPC64-AIX-NEXT: L..BB0_4:
182 ; POWERPC64-AIX-NEXT: li 4, 0
183 ; POWERPC64-AIX-NEXT: extsw 3, 4
184 ; POWERPC64-AIX-NEXT: blr
186 %cmp5 = icmp sgt i32 %lim, 0
187 br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup
189 for.body.preheader: ; preds = %entry
192 for.cond.cleanup.loopexit: ; preds = %for.body
193 br label %for.cond.cleanup
195 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
196 %Ret.0.lcssa = phi i32 [ 0, %entry ], [ %0, %for.cond.cleanup.loopexit ]
199 for.body: ; preds = %for.body.preheader, %for.body
200 %i.07 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
201 %Ret.06 = phi i32 [ %0, %for.body ], [ 0, %for.body.preheader ]
202 %0 = 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)
203 %inc = add nuw nsw i32 %i.07, 1
204 %exitcond = icmp eq i32 %inc, %lim
205 br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body