1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=ppc32-- -o - | FileCheck %s
4 define i64 @__fixunstfdi(ppc_fp128 %a) nounwind readnone {
5 ; CHECK-LABEL: __fixunstfdi:
6 ; CHECK: # %bb.0: # %entry
8 ; CHECK-NEXT: stwu 1, -464(1)
10 ; CHECK-NEXT: stw 0, 468(1)
11 ; CHECK-NEXT: lis 3, .LCPI0_0@ha
12 ; CHECK-NEXT: stw 29, 412(1) # 4-byte Folded Spill
13 ; CHECK-NEXT: stw 30, 416(1) # 4-byte Folded Spill
14 ; CHECK-NEXT: stw 12, 408(1)
15 ; CHECK-NEXT: stfd 2, 376(1)
16 ; CHECK-NEXT: lwz 4, 380(1)
17 ; CHECK-NEXT: stfd 27, 424(1) # 8-byte Folded Spill
18 ; CHECK-NEXT: stw 4, 396(1)
19 ; CHECK-NEXT: lwz 4, 376(1)
20 ; CHECK-NEXT: lfs 27, .LCPI0_0@l(3)
21 ; CHECK-NEXT: stfd 1, 384(1)
22 ; CHECK-NEXT: stw 4, 392(1)
23 ; CHECK-NEXT: fcmpu 0, 2, 27
24 ; CHECK-NEXT: lwz 4, 388(1)
25 ; CHECK-NEXT: fcmpu 1, 1, 27
26 ; CHECK-NEXT: lwz 3, 384(1)
27 ; CHECK-NEXT: crand 20, 6, 0
28 ; CHECK-NEXT: cror 20, 4, 20
29 ; CHECK-NEXT: stfd 28, 432(1) # 8-byte Folded Spill
30 ; CHECK-NEXT: stfd 29, 440(1) # 8-byte Folded Spill
31 ; CHECK-NEXT: stfd 30, 448(1) # 8-byte Folded Spill
32 ; CHECK-NEXT: stfd 31, 456(1) # 8-byte Folded Spill
33 ; CHECK-NEXT: stw 4, 404(1)
34 ; CHECK-NEXT: stw 3, 400(1)
35 ; CHECK-NEXT: bc 4, 20, .LBB0_2
36 ; CHECK-NEXT: # %bb.1: # %bb5
39 ; CHECK-NEXT: b .LBB0_19
40 ; CHECK-NEXT: .LBB0_2: # %bb1
41 ; CHECK-NEXT: lfd 0, 400(1)
42 ; CHECK-NEXT: lis 3, 15856
43 ; CHECK-NEXT: stw 3, 336(1)
44 ; CHECK-NEXT: li 29, 0
45 ; CHECK-NEXT: stfd 0, 304(1)
46 ; CHECK-NEXT: lwz 3, 308(1)
47 ; CHECK-NEXT: lfd 1, 392(1)
48 ; CHECK-NEXT: stw 3, 324(1)
49 ; CHECK-NEXT: lwz 3, 304(1)
50 ; CHECK-NEXT: stfd 1, 296(1)
51 ; CHECK-NEXT: stw 3, 320(1)
52 ; CHECK-NEXT: lwz 3, 300(1)
53 ; CHECK-NEXT: stw 29, 340(1)
54 ; CHECK-NEXT: stw 3, 316(1)
55 ; CHECK-NEXT: lwz 3, 296(1)
56 ; CHECK-NEXT: stw 29, 332(1)
57 ; CHECK-NEXT: stw 3, 312(1)
58 ; CHECK-NEXT: stw 29, 328(1)
59 ; CHECK-NEXT: lfd 31, 320(1)
60 ; CHECK-NEXT: lfd 30, 312(1)
61 ; CHECK-NEXT: lfd 3, 336(1)
62 ; CHECK-NEXT: fmr 1, 31
63 ; CHECK-NEXT: lfd 4, 328(1)
64 ; CHECK-NEXT: fmr 2, 30
65 ; CHECK-NEXT: bl __gcc_qmul
66 ; CHECK-NEXT: lis 3, 16864
67 ; CHECK-NEXT: stfd 1, 280(1)
68 ; CHECK-NEXT: fmr 29, 1
69 ; CHECK-NEXT: stw 3, 368(1)
70 ; CHECK-NEXT: fmr 28, 2
71 ; CHECK-NEXT: lwz 3, 284(1)
72 ; CHECK-NEXT: stfd 2, 288(1)
73 ; CHECK-NEXT: stw 3, 356(1)
74 ; CHECK-NEXT: lwz 3, 280(1)
75 ; CHECK-NEXT: stw 29, 372(1)
76 ; CHECK-NEXT: stw 3, 352(1)
77 ; CHECK-NEXT: lwz 3, 292(1)
78 ; CHECK-NEXT: stw 29, 364(1)
79 ; CHECK-NEXT: stw 3, 348(1)
80 ; CHECK-NEXT: lwz 3, 288(1)
81 ; CHECK-NEXT: stw 29, 360(1)
82 ; CHECK-NEXT: stw 3, 344(1)
83 ; CHECK-NEXT: lfd 3, 368(1)
84 ; CHECK-NEXT: lfd 4, 360(1)
85 ; CHECK-NEXT: lfd 1, 352(1)
86 ; CHECK-NEXT: lfd 2, 344(1)
87 ; CHECK-NEXT: bl __gcc_qsub
89 ; CHECK-NEXT: mtfsb1 31
90 ; CHECK-NEXT: mtfsb0 30
91 ; CHECK-NEXT: fadd 1, 2, 1
92 ; CHECK-NEXT: mtfsf 1, 0
93 ; CHECK-NEXT: fctiwz 0, 1
94 ; CHECK-NEXT: stfd 0, 160(1)
96 ; CHECK-NEXT: mtfsb1 31
97 ; CHECK-NEXT: lis 3, .LCPI0_1@ha
98 ; CHECK-NEXT: mtfsb0 30
99 ; CHECK-NEXT: fadd 1, 28, 29
100 ; CHECK-NEXT: mtfsf 1, 0
101 ; CHECK-NEXT: lfs 0, .LCPI0_1@l(3)
102 ; CHECK-NEXT: fcmpu 0, 28, 27
103 ; CHECK-NEXT: fctiwz 1, 1
104 ; CHECK-NEXT: fcmpu 1, 29, 0
105 ; CHECK-NEXT: crandc 20, 6, 0
106 ; CHECK-NEXT: cror 20, 5, 20
107 ; CHECK-NEXT: stfd 1, 152(1)
108 ; CHECK-NEXT: bc 12, 20, .LBB0_4
109 ; CHECK-NEXT: # %bb.3: # %bb1
110 ; CHECK-NEXT: lwz 30, 156(1)
111 ; CHECK-NEXT: b .LBB0_5
112 ; CHECK-NEXT: .LBB0_4:
113 ; CHECK-NEXT: lwz 3, 164(1)
114 ; CHECK-NEXT: addis 30, 3, -32768
115 ; CHECK-NEXT: .LBB0_5: # %bb1
116 ; CHECK-NEXT: mr 3, 30
117 ; CHECK-NEXT: li 4, 0
118 ; CHECK-NEXT: bl __floatditf
119 ; CHECK-NEXT: lis 3, 17392
120 ; CHECK-NEXT: stfd 1, 208(1)
121 ; CHECK-NEXT: fmr 29, 1
122 ; CHECK-NEXT: stw 3, 240(1)
123 ; CHECK-NEXT: fmr 28, 2
124 ; CHECK-NEXT: lwz 3, 212(1)
125 ; CHECK-NEXT: cmpwi 2, 30, 0
126 ; CHECK-NEXT: stfd 2, 200(1)
127 ; CHECK-NEXT: stw 3, 228(1)
128 ; CHECK-NEXT: lwz 3, 208(1)
129 ; CHECK-NEXT: stw 29, 244(1)
130 ; CHECK-NEXT: stw 3, 224(1)
131 ; CHECK-NEXT: lwz 3, 204(1)
132 ; CHECK-NEXT: stw 29, 236(1)
133 ; CHECK-NEXT: stw 3, 220(1)
134 ; CHECK-NEXT: lwz 3, 200(1)
135 ; CHECK-NEXT: stw 29, 232(1)
136 ; CHECK-NEXT: stw 3, 216(1)
137 ; CHECK-NEXT: lfd 3, 240(1)
138 ; CHECK-NEXT: lfd 4, 232(1)
139 ; CHECK-NEXT: lfd 1, 224(1)
140 ; CHECK-NEXT: lfd 2, 216(1)
141 ; CHECK-NEXT: bl __gcc_qadd
142 ; CHECK-NEXT: blt 2, .LBB0_7
143 ; CHECK-NEXT: # %bb.6: # %bb1
144 ; CHECK-NEXT: fmr 2, 28
145 ; CHECK-NEXT: .LBB0_7: # %bb1
146 ; CHECK-NEXT: blt 2, .LBB0_9
147 ; CHECK-NEXT: # %bb.8: # %bb1
148 ; CHECK-NEXT: fmr 1, 29
149 ; CHECK-NEXT: .LBB0_9: # %bb1
150 ; CHECK-NEXT: stfd 1, 184(1)
151 ; CHECK-NEXT: fmr 1, 31
152 ; CHECK-NEXT: lwz 3, 188(1)
153 ; CHECK-NEXT: stfd 2, 192(1)
154 ; CHECK-NEXT: fmr 2, 30
155 ; CHECK-NEXT: stw 3, 260(1)
156 ; CHECK-NEXT: lwz 3, 184(1)
157 ; CHECK-NEXT: stw 3, 256(1)
158 ; CHECK-NEXT: lwz 3, 196(1)
159 ; CHECK-NEXT: lfd 3, 256(1)
160 ; CHECK-NEXT: stw 3, 252(1)
161 ; CHECK-NEXT: lwz 3, 192(1)
162 ; CHECK-NEXT: stw 3, 248(1)
163 ; CHECK-NEXT: lfd 4, 248(1)
164 ; CHECK-NEXT: bl __gcc_qsub
165 ; CHECK-NEXT: stfd 2, 176(1)
166 ; CHECK-NEXT: fcmpu 1, 2, 27
167 ; CHECK-NEXT: lwz 3, 180(1)
168 ; CHECK-NEXT: fcmpu 0, 1, 27
169 ; CHECK-NEXT: stfd 1, 168(1)
170 ; CHECK-NEXT: crandc 20, 2, 4
171 ; CHECK-NEXT: stw 3, 268(1)
172 ; CHECK-NEXT: lwz 3, 176(1)
173 ; CHECK-NEXT: stw 3, 264(1)
174 ; CHECK-NEXT: lwz 3, 172(1)
175 ; CHECK-NEXT: lfd 30, 264(1)
176 ; CHECK-NEXT: stw 3, 276(1)
177 ; CHECK-NEXT: lwz 3, 168(1)
178 ; CHECK-NEXT: stw 3, 272(1)
179 ; CHECK-NEXT: lfd 31, 272(1)
180 ; CHECK-NEXT: bc 12, 20, .LBB0_13
181 ; CHECK-NEXT: # %bb.10: # %bb1
182 ; CHECK-NEXT: cror 20, 1, 3
183 ; CHECK-NEXT: bc 12, 20, .LBB0_13
184 ; CHECK-NEXT: # %bb.11: # %bb2
185 ; CHECK-NEXT: fneg 29, 31
186 ; CHECK-NEXT: stfd 29, 48(1)
187 ; CHECK-NEXT: lis 3, 16864
188 ; CHECK-NEXT: stw 3, 80(1)
189 ; CHECK-NEXT: fneg 28, 30
190 ; CHECK-NEXT: lwz 3, 52(1)
191 ; CHECK-NEXT: li 29, 0
192 ; CHECK-NEXT: stfd 28, 40(1)
193 ; CHECK-NEXT: stw 3, 68(1)
194 ; CHECK-NEXT: lwz 3, 48(1)
195 ; CHECK-NEXT: stw 29, 84(1)
196 ; CHECK-NEXT: stw 3, 64(1)
197 ; CHECK-NEXT: lwz 3, 44(1)
198 ; CHECK-NEXT: stw 29, 76(1)
199 ; CHECK-NEXT: stw 3, 60(1)
200 ; CHECK-NEXT: lwz 3, 40(1)
201 ; CHECK-NEXT: stw 29, 72(1)
202 ; CHECK-NEXT: stw 3, 56(1)
203 ; CHECK-NEXT: lfd 3, 80(1)
204 ; CHECK-NEXT: lfd 4, 72(1)
205 ; CHECK-NEXT: lfd 1, 64(1)
206 ; CHECK-NEXT: lfd 2, 56(1)
207 ; CHECK-NEXT: bl __gcc_qsub
209 ; CHECK-NEXT: mtfsb1 31
210 ; CHECK-NEXT: mtfsb0 30
211 ; CHECK-NEXT: fadd 1, 2, 1
212 ; CHECK-NEXT: mtfsf 1, 0
213 ; CHECK-NEXT: fctiwz 0, 1
214 ; CHECK-NEXT: stfd 0, 32(1)
216 ; CHECK-NEXT: mtfsb1 31
217 ; CHECK-NEXT: lis 3, .LCPI0_2@ha
218 ; CHECK-NEXT: lfs 2, .LCPI0_2@l(3)
219 ; CHECK-NEXT: mtfsb0 30
220 ; CHECK-NEXT: lis 3, .LCPI0_3@ha
221 ; CHECK-NEXT: fadd 1, 28, 29
222 ; CHECK-NEXT: mtfsf 1, 0
223 ; CHECK-NEXT: lfs 0, .LCPI0_3@l(3)
224 ; CHECK-NEXT: fcmpu 0, 30, 2
225 ; CHECK-NEXT: fctiwz 1, 1
226 ; CHECK-NEXT: fcmpu 1, 31, 0
227 ; CHECK-NEXT: crandc 20, 6, 1
228 ; CHECK-NEXT: cror 20, 4, 20
229 ; CHECK-NEXT: stfd 1, 24(1)
230 ; CHECK-NEXT: bc 12, 20, .LBB0_17
231 ; CHECK-NEXT: # %bb.12: # %bb2
232 ; CHECK-NEXT: lwz 3, 28(1)
233 ; CHECK-NEXT: b .LBB0_18
234 ; CHECK-NEXT: .LBB0_13: # %bb3
235 ; CHECK-NEXT: stfd 31, 112(1)
236 ; CHECK-NEXT: li 3, 0
237 ; CHECK-NEXT: stw 3, 148(1)
238 ; CHECK-NEXT: lis 4, 16864
239 ; CHECK-NEXT: stw 3, 140(1)
240 ; CHECK-NEXT: stw 3, 136(1)
241 ; CHECK-NEXT: lwz 3, 116(1)
242 ; CHECK-NEXT: stfd 30, 104(1)
243 ; CHECK-NEXT: stw 3, 132(1)
244 ; CHECK-NEXT: lwz 3, 112(1)
245 ; CHECK-NEXT: stw 4, 144(1)
246 ; CHECK-NEXT: stw 3, 128(1)
247 ; CHECK-NEXT: lwz 3, 108(1)
248 ; CHECK-NEXT: lfd 3, 144(1)
249 ; CHECK-NEXT: stw 3, 124(1)
250 ; CHECK-NEXT: lwz 3, 104(1)
251 ; CHECK-NEXT: lfd 4, 136(1)
252 ; CHECK-NEXT: stw 3, 120(1)
253 ; CHECK-NEXT: lfd 1, 128(1)
254 ; CHECK-NEXT: lfd 2, 120(1)
255 ; CHECK-NEXT: bl __gcc_qsub
257 ; CHECK-NEXT: mtfsb1 31
258 ; CHECK-NEXT: mtfsb0 30
259 ; CHECK-NEXT: fadd 1, 2, 1
260 ; CHECK-NEXT: mtfsf 1, 0
261 ; CHECK-NEXT: fctiwz 0, 1
262 ; CHECK-NEXT: stfd 0, 96(1)
264 ; CHECK-NEXT: mtfsb1 31
265 ; CHECK-NEXT: lis 3, .LCPI0_0@ha
266 ; CHECK-NEXT: lfs 1, .LCPI0_0@l(3)
267 ; CHECK-NEXT: mtfsb0 30
268 ; CHECK-NEXT: lis 3, .LCPI0_1@ha
269 ; CHECK-NEXT: fadd 2, 30, 31
270 ; CHECK-NEXT: mtfsf 1, 0
271 ; CHECK-NEXT: lfs 0, .LCPI0_1@l(3)
272 ; CHECK-NEXT: fcmpu 0, 30, 1
273 ; CHECK-NEXT: fctiwz 1, 2
274 ; CHECK-NEXT: fcmpu 1, 31, 0
275 ; CHECK-NEXT: crandc 20, 6, 0
276 ; CHECK-NEXT: cror 20, 5, 20
277 ; CHECK-NEXT: stfd 1, 88(1)
278 ; CHECK-NEXT: bc 12, 20, .LBB0_15
279 ; CHECK-NEXT: # %bb.14: # %bb3
280 ; CHECK-NEXT: lwz 4, 92(1)
281 ; CHECK-NEXT: b .LBB0_16
282 ; CHECK-NEXT: .LBB0_15:
283 ; CHECK-NEXT: lwz 3, 100(1)
284 ; CHECK-NEXT: addis 4, 3, -32768
285 ; CHECK-NEXT: .LBB0_16: # %bb3
286 ; CHECK-NEXT: mr 3, 30
287 ; CHECK-NEXT: b .LBB0_19
288 ; CHECK-NEXT: .LBB0_17:
289 ; CHECK-NEXT: lwz 3, 36(1)
290 ; CHECK-NEXT: addis 3, 3, -32768
291 ; CHECK-NEXT: .LBB0_18: # %bb2
292 ; CHECK-NEXT: subfic 4, 3, 0
293 ; CHECK-NEXT: subfe 3, 29, 30
294 ; CHECK-NEXT: .LBB0_19: # %bb3
295 ; CHECK-NEXT: lfd 31, 456(1) # 8-byte Folded Reload
296 ; CHECK-NEXT: lfd 30, 448(1) # 8-byte Folded Reload
297 ; CHECK-NEXT: lfd 29, 440(1) # 8-byte Folded Reload
298 ; CHECK-NEXT: lfd 28, 432(1) # 8-byte Folded Reload
299 ; CHECK-NEXT: lwz 12, 408(1)
300 ; CHECK-NEXT: lfd 27, 424(1) # 8-byte Folded Reload
301 ; CHECK-NEXT: mtcrf 32, 12 # cr2
302 ; CHECK-NEXT: lwz 30, 416(1) # 4-byte Folded Reload
303 ; CHECK-NEXT: lwz 29, 412(1) # 4-byte Folded Reload
304 ; CHECK-NEXT: lwz 0, 468(1)
305 ; CHECK-NEXT: addi 1, 1, 464
309 %0 = fcmp olt ppc_fp128 %a, 0xM00000000000000000000000000000000 ; <i1> [#uses=1]
310 br i1 %0, label %bb5, label %bb1
312 bb1: ; preds = %entry
313 %1 = fmul ppc_fp128 %a, 0xM3DF00000000000000000000000000000 ; <ppc_fp128> [#uses=1]
314 %2 = fptoui ppc_fp128 %1 to i32 ; <i32> [#uses=1]
315 %3 = zext i32 %2 to i64 ; <i64> [#uses=1]
316 %4 = shl i64 %3, 32 ; <i64> [#uses=3]
317 %5 = uitofp i64 %4 to ppc_fp128 ; <ppc_fp128> [#uses=1]
318 %6 = fsub ppc_fp128 %a, %5 ; <ppc_fp128> [#uses=3]
319 %7 = fcmp olt ppc_fp128 %6, 0xM00000000000000000000000000000000 ; <i1> [#uses=1]
320 br i1 %7, label %bb2, label %bb3
323 %8 = fsub ppc_fp128 0xM80000000000000000000000000000000, %6 ; <ppc_fp128> [#uses=1]
324 %9 = fptoui ppc_fp128 %8 to i32 ; <i32> [#uses=1]
325 %10 = zext i32 %9 to i64 ; <i64> [#uses=1]
326 %11 = sub i64 %4, %10 ; <i64> [#uses=1]
330 %12 = fptoui ppc_fp128 %6 to i32 ; <i32> [#uses=1]
331 %13 = zext i32 %12 to i64 ; <i64> [#uses=1]
332 %14 = or i64 %13, %4 ; <i64> [#uses=1]
335 bb5: ; preds = %entry