1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=-vsx | FileCheck --check-prefix=CHECK-P7 %s
3 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 | FileCheck --check-prefix=CHECK-P8 %s
4 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 | FileCheck --check-prefix=CHECK-P9 %s
6 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
8 declare double @llvm.sqrt.f64(double)
9 declare float @llvm.sqrt.f32(float)
10 declare fp128 @llvm.sqrt.f128(fp128)
11 declare <4 x float> @llvm.sqrt.v4f32(<4 x float>)
12 declare <2 x double> @llvm.sqrt.v2f64(<2 x double>)
14 define double @foo_fmf(double %a, double %b) nounwind {
15 ; CHECK-P7-LABEL: foo_fmf:
17 ; CHECK-P7-NEXT: frsqrte 0, 2
18 ; CHECK-P7-NEXT: addis 3, 2, .LCPI0_0@toc@ha
19 ; CHECK-P7-NEXT: addis 4, 2, .LCPI0_1@toc@ha
20 ; CHECK-P7-NEXT: lfs 4, .LCPI0_0@toc@l(3)
21 ; CHECK-P7-NEXT: lfs 5, .LCPI0_1@toc@l(4)
22 ; CHECK-P7-NEXT: fmul 3, 2, 0
23 ; CHECK-P7-NEXT: fmadd 3, 3, 0, 4
24 ; CHECK-P7-NEXT: fmul 0, 0, 5
25 ; CHECK-P7-NEXT: fmul 0, 0, 3
26 ; CHECK-P7-NEXT: fmul 2, 2, 0
27 ; CHECK-P7-NEXT: fmadd 2, 2, 0, 4
28 ; CHECK-P7-NEXT: fmul 0, 0, 5
29 ; CHECK-P7-NEXT: fmul 0, 0, 2
30 ; CHECK-P7-NEXT: fmul 1, 1, 0
33 ; CHECK-P8-LABEL: foo_fmf:
35 ; CHECK-P8-NEXT: vspltisw 2, -3
36 ; CHECK-P8-NEXT: xsrsqrtedp 0, 2
37 ; CHECK-P8-NEXT: addis 3, 2, .LCPI0_0@toc@ha
38 ; CHECK-P8-NEXT: lfs 5, .LCPI0_0@toc@l(3)
39 ; CHECK-P8-NEXT: xvcvsxwdp 3, 34
40 ; CHECK-P8-NEXT: xsmuldp 4, 2, 0
41 ; CHECK-P8-NEXT: fmr 6, 3
42 ; CHECK-P8-NEXT: xsmaddadp 6, 4, 0
43 ; CHECK-P8-NEXT: xsmuldp 0, 0, 5
44 ; CHECK-P8-NEXT: xsmuldp 0, 0, 6
45 ; CHECK-P8-NEXT: xsmuldp 2, 2, 0
46 ; CHECK-P8-NEXT: xsmaddadp 3, 2, 0
47 ; CHECK-P8-NEXT: xsmuldp 0, 0, 5
48 ; CHECK-P8-NEXT: xsmuldp 0, 0, 3
49 ; CHECK-P8-NEXT: xsmuldp 1, 1, 0
52 ; CHECK-P9-LABEL: foo_fmf:
54 ; CHECK-P9-NEXT: xsrsqrtedp 0, 2
55 ; CHECK-P9-NEXT: vspltisw 2, -3
56 ; CHECK-P9-NEXT: addis 3, 2, .LCPI0_0@toc@ha
57 ; CHECK-P9-NEXT: xsmuldp 3, 2, 0
58 ; CHECK-P9-NEXT: xvcvsxwdp 4, 34
59 ; CHECK-P9-NEXT: fmr 5, 4
60 ; CHECK-P9-NEXT: xsmaddadp 5, 3, 0
61 ; CHECK-P9-NEXT: lfs 3, .LCPI0_0@toc@l(3)
62 ; CHECK-P9-NEXT: xsmuldp 0, 0, 3
63 ; CHECK-P9-NEXT: xsmuldp 0, 0, 5
64 ; CHECK-P9-NEXT: xsmuldp 2, 2, 0
65 ; CHECK-P9-NEXT: xsmaddadp 4, 2, 0
66 ; CHECK-P9-NEXT: xsmuldp 0, 0, 3
67 ; CHECK-P9-NEXT: xsmuldp 0, 0, 4
68 ; CHECK-P9-NEXT: xsmuldp 1, 1, 0
70 %x = call arcp contract reassoc double @llvm.sqrt.f64(double %b)
71 %r = fdiv arcp contract reassoc double %a, %x
75 define double @foo_safe(double %a, double %b) nounwind {
76 ; CHECK-P7-LABEL: foo_safe:
78 ; CHECK-P7-NEXT: fsqrt 0, 2
79 ; CHECK-P7-NEXT: fdiv 1, 1, 0
82 ; CHECK-P8-LABEL: foo_safe:
84 ; CHECK-P8-NEXT: xssqrtdp 0, 2
85 ; CHECK-P8-NEXT: xsdivdp 1, 1, 0
88 ; CHECK-P9-LABEL: foo_safe:
90 ; CHECK-P9-NEXT: xssqrtdp 0, 2
91 ; CHECK-P9-NEXT: xsdivdp 1, 1, 0
93 %x = call double @llvm.sqrt.f64(double %b)
94 %r = fdiv double %a, %x
98 define double @no_estimate_refinement_f64(double %a, double %b) #0 {
99 ; CHECK-P7-LABEL: no_estimate_refinement_f64:
101 ; CHECK-P7-NEXT: frsqrte 0, 2
102 ; CHECK-P7-NEXT: fmul 1, 1, 0
105 ; CHECK-P8-LABEL: no_estimate_refinement_f64:
107 ; CHECK-P8-NEXT: xsrsqrtedp 0, 2
108 ; CHECK-P8-NEXT: xsmuldp 1, 1, 0
111 ; CHECK-P9-LABEL: no_estimate_refinement_f64:
113 ; CHECK-P9-NEXT: xsrsqrtedp 0, 2
114 ; CHECK-P9-NEXT: xsmuldp 1, 1, 0
116 %x = call arcp reassoc double @llvm.sqrt.f64(double %b)
117 %r = fdiv arcp reassoc double %a, %x
121 define double @foof_fmf(double %a, float %b) nounwind {
122 ; CHECK-P7-LABEL: foof_fmf:
124 ; CHECK-P7-NEXT: frsqrtes 0, 2
125 ; CHECK-P7-NEXT: addis 3, 2, .LCPI3_0@toc@ha
126 ; CHECK-P7-NEXT: addis 4, 2, .LCPI3_1@toc@ha
127 ; CHECK-P7-NEXT: lfs 3, .LCPI3_0@toc@l(3)
128 ; CHECK-P7-NEXT: lfs 4, .LCPI3_1@toc@l(4)
129 ; CHECK-P7-NEXT: fmuls 2, 2, 0
130 ; CHECK-P7-NEXT: fmadds 2, 2, 0, 3
131 ; CHECK-P7-NEXT: fmuls 0, 0, 4
132 ; CHECK-P7-NEXT: fmuls 0, 0, 2
133 ; CHECK-P7-NEXT: fmul 1, 1, 0
136 ; CHECK-P8-LABEL: foof_fmf:
138 ; CHECK-P8-NEXT: xsrsqrtesp 0, 2
139 ; CHECK-P8-NEXT: vspltisw 2, -3
140 ; CHECK-P8-NEXT: addis 3, 2, .LCPI3_0@toc@ha
141 ; CHECK-P8-NEXT: lfs 4, .LCPI3_0@toc@l(3)
142 ; CHECK-P8-NEXT: xvcvsxwdp 3, 34
143 ; CHECK-P8-NEXT: xsmulsp 2, 2, 0
144 ; CHECK-P8-NEXT: xsmaddasp 3, 2, 0
145 ; CHECK-P8-NEXT: xsmulsp 0, 0, 4
146 ; CHECK-P8-NEXT: xsmulsp 0, 0, 3
147 ; CHECK-P8-NEXT: xsmuldp 1, 1, 0
150 ; CHECK-P9-LABEL: foof_fmf:
152 ; CHECK-P9-NEXT: xsrsqrtesp 0, 2
153 ; CHECK-P9-NEXT: vspltisw 2, -3
154 ; CHECK-P9-NEXT: addis 3, 2, .LCPI3_0@toc@ha
155 ; CHECK-P9-NEXT: xsmulsp 2, 2, 0
156 ; CHECK-P9-NEXT: xvcvsxwdp 3, 34
157 ; CHECK-P9-NEXT: xsmaddasp 3, 2, 0
158 ; CHECK-P9-NEXT: lfs 2, .LCPI3_0@toc@l(3)
159 ; CHECK-P9-NEXT: xsmulsp 0, 0, 2
160 ; CHECK-P9-NEXT: xsmulsp 0, 0, 3
161 ; CHECK-P9-NEXT: xsmuldp 1, 1, 0
163 %x = call contract reassoc arcp float @llvm.sqrt.f32(float %b)
164 %y = fpext float %x to double
165 %r = fdiv contract reassoc arcp double %a, %y
169 define double @foof_safe(double %a, float %b) nounwind {
170 ; CHECK-P7-LABEL: foof_safe:
172 ; CHECK-P7-NEXT: fsqrts 0, 2
173 ; CHECK-P7-NEXT: fdiv 1, 1, 0
176 ; CHECK-P8-LABEL: foof_safe:
178 ; CHECK-P8-NEXT: xssqrtsp 0, 2
179 ; CHECK-P8-NEXT: xsdivdp 1, 1, 0
182 ; CHECK-P9-LABEL: foof_safe:
184 ; CHECK-P9-NEXT: xssqrtsp 0, 2
185 ; CHECK-P9-NEXT: xsdivdp 1, 1, 0
187 %x = call float @llvm.sqrt.f32(float %b)
188 %y = fpext float %x to double
189 %r = fdiv double %a, %y
193 define float @food_fmf(float %a, double %b) nounwind {
194 ; CHECK-P7-LABEL: food_fmf:
196 ; CHECK-P7-NEXT: frsqrte 0, 2
197 ; CHECK-P7-NEXT: addis 3, 2, .LCPI5_0@toc@ha
198 ; CHECK-P7-NEXT: addis 4, 2, .LCPI5_1@toc@ha
199 ; CHECK-P7-NEXT: lfs 4, .LCPI5_0@toc@l(3)
200 ; CHECK-P7-NEXT: lfs 5, .LCPI5_1@toc@l(4)
201 ; CHECK-P7-NEXT: fmul 3, 2, 0
202 ; CHECK-P7-NEXT: fmadd 3, 3, 0, 4
203 ; CHECK-P7-NEXT: fmul 0, 0, 5
204 ; CHECK-P7-NEXT: fmul 0, 0, 3
205 ; CHECK-P7-NEXT: fmul 2, 2, 0
206 ; CHECK-P7-NEXT: fmadd 2, 2, 0, 4
207 ; CHECK-P7-NEXT: fmul 0, 0, 5
208 ; CHECK-P7-NEXT: fmul 0, 0, 2
209 ; CHECK-P7-NEXT: frsp 0, 0
210 ; CHECK-P7-NEXT: fmuls 1, 1, 0
213 ; CHECK-P8-LABEL: food_fmf:
215 ; CHECK-P8-NEXT: vspltisw 2, -3
216 ; CHECK-P8-NEXT: xsrsqrtedp 0, 2
217 ; CHECK-P8-NEXT: addis 3, 2, .LCPI5_0@toc@ha
218 ; CHECK-P8-NEXT: lfs 5, .LCPI5_0@toc@l(3)
219 ; CHECK-P8-NEXT: xvcvsxwdp 3, 34
220 ; CHECK-P8-NEXT: xsmuldp 4, 2, 0
221 ; CHECK-P8-NEXT: fmr 6, 3
222 ; CHECK-P8-NEXT: xsmaddadp 6, 4, 0
223 ; CHECK-P8-NEXT: xsmuldp 0, 0, 5
224 ; CHECK-P8-NEXT: xsmuldp 0, 0, 6
225 ; CHECK-P8-NEXT: xsmuldp 2, 2, 0
226 ; CHECK-P8-NEXT: xsmaddadp 3, 2, 0
227 ; CHECK-P8-NEXT: xsmuldp 0, 0, 5
228 ; CHECK-P8-NEXT: xsmuldp 0, 0, 3
229 ; CHECK-P8-NEXT: xsrsp 0, 0
230 ; CHECK-P8-NEXT: xsmulsp 1, 1, 0
233 ; CHECK-P9-LABEL: food_fmf:
235 ; CHECK-P9-NEXT: xsrsqrtedp 0, 2
236 ; CHECK-P9-NEXT: vspltisw 2, -3
237 ; CHECK-P9-NEXT: addis 3, 2, .LCPI5_0@toc@ha
238 ; CHECK-P9-NEXT: xsmuldp 3, 2, 0
239 ; CHECK-P9-NEXT: xvcvsxwdp 4, 34
240 ; CHECK-P9-NEXT: fmr 5, 4
241 ; CHECK-P9-NEXT: xsmaddadp 5, 3, 0
242 ; CHECK-P9-NEXT: lfs 3, .LCPI5_0@toc@l(3)
243 ; CHECK-P9-NEXT: xsmuldp 0, 0, 3
244 ; CHECK-P9-NEXT: xsmuldp 0, 0, 5
245 ; CHECK-P9-NEXT: xsmuldp 2, 2, 0
246 ; CHECK-P9-NEXT: xsmaddadp 4, 2, 0
247 ; CHECK-P9-NEXT: xsmuldp 0, 0, 3
248 ; CHECK-P9-NEXT: xsmuldp 0, 0, 4
249 ; CHECK-P9-NEXT: xsrsp 0, 0
250 ; CHECK-P9-NEXT: xsmulsp 1, 1, 0
252 %x = call contract reassoc arcp double @llvm.sqrt.f64(double %b)
253 %y = fptrunc double %x to float
254 %r = fdiv contract reassoc arcp float %a, %y
258 define float @food_safe(float %a, double %b) nounwind {
259 ; CHECK-P7-LABEL: food_safe:
261 ; CHECK-P7-NEXT: fsqrt 0, 2
262 ; CHECK-P7-NEXT: frsp 0, 0
263 ; CHECK-P7-NEXT: fdivs 1, 1, 0
266 ; CHECK-P8-LABEL: food_safe:
268 ; CHECK-P8-NEXT: xssqrtdp 0, 2
269 ; CHECK-P8-NEXT: xsrsp 0, 0
270 ; CHECK-P8-NEXT: xsdivsp 1, 1, 0
273 ; CHECK-P9-LABEL: food_safe:
275 ; CHECK-P9-NEXT: xssqrtdp 0, 2
276 ; CHECK-P9-NEXT: xsrsp 0, 0
277 ; CHECK-P9-NEXT: xsdivsp 1, 1, 0
279 %x = call double @llvm.sqrt.f64(double %b)
280 %y = fptrunc double %x to float
281 %r = fdiv float %a, %y
285 define float @goo_fmf(float %a, float %b) nounwind {
286 ; CHECK-P7-LABEL: goo_fmf:
288 ; CHECK-P7-NEXT: frsqrtes 0, 2
289 ; CHECK-P7-NEXT: addis 3, 2, .LCPI7_0@toc@ha
290 ; CHECK-P7-NEXT: addis 4, 2, .LCPI7_1@toc@ha
291 ; CHECK-P7-NEXT: lfs 3, .LCPI7_0@toc@l(3)
292 ; CHECK-P7-NEXT: lfs 4, .LCPI7_1@toc@l(4)
293 ; CHECK-P7-NEXT: fmuls 2, 2, 0
294 ; CHECK-P7-NEXT: fmadds 2, 2, 0, 3
295 ; CHECK-P7-NEXT: fmuls 0, 0, 4
296 ; CHECK-P7-NEXT: fmuls 0, 0, 2
297 ; CHECK-P7-NEXT: fmuls 1, 1, 0
300 ; CHECK-P8-LABEL: goo_fmf:
302 ; CHECK-P8-NEXT: xsrsqrtesp 0, 2
303 ; CHECK-P8-NEXT: vspltisw 2, -3
304 ; CHECK-P8-NEXT: addis 3, 2, .LCPI7_0@toc@ha
305 ; CHECK-P8-NEXT: lfs 4, .LCPI7_0@toc@l(3)
306 ; CHECK-P8-NEXT: xvcvsxwdp 3, 34
307 ; CHECK-P8-NEXT: xsmulsp 2, 2, 0
308 ; CHECK-P8-NEXT: xsmaddasp 3, 2, 0
309 ; CHECK-P8-NEXT: xsmulsp 0, 0, 4
310 ; CHECK-P8-NEXT: xsmulsp 0, 0, 3
311 ; CHECK-P8-NEXT: xsmulsp 1, 1, 0
314 ; CHECK-P9-LABEL: goo_fmf:
316 ; CHECK-P9-NEXT: xsrsqrtesp 0, 2
317 ; CHECK-P9-NEXT: vspltisw 2, -3
318 ; CHECK-P9-NEXT: addis 3, 2, .LCPI7_0@toc@ha
319 ; CHECK-P9-NEXT: xsmulsp 2, 2, 0
320 ; CHECK-P9-NEXT: xvcvsxwdp 3, 34
321 ; CHECK-P9-NEXT: xsmaddasp 3, 2, 0
322 ; CHECK-P9-NEXT: lfs 2, .LCPI7_0@toc@l(3)
323 ; CHECK-P9-NEXT: xsmulsp 0, 0, 2
324 ; CHECK-P9-NEXT: xsmulsp 0, 0, 3
325 ; CHECK-P9-NEXT: xsmulsp 1, 1, 0
327 %x = call contract reassoc arcp float @llvm.sqrt.f32(float %b)
328 %r = fdiv contract reassoc arcp float %a, %x
332 define float @goo_safe(float %a, float %b) nounwind {
333 ; CHECK-P7-LABEL: goo_safe:
335 ; CHECK-P7-NEXT: fsqrts 0, 2
336 ; CHECK-P7-NEXT: fdivs 1, 1, 0
339 ; CHECK-P8-LABEL: goo_safe:
341 ; CHECK-P8-NEXT: xssqrtsp 0, 2
342 ; CHECK-P8-NEXT: xsdivsp 1, 1, 0
345 ; CHECK-P9-LABEL: goo_safe:
347 ; CHECK-P9-NEXT: xssqrtsp 0, 2
348 ; CHECK-P9-NEXT: xsdivsp 1, 1, 0
350 %x = call float @llvm.sqrt.f32(float %b)
351 %r = fdiv float %a, %x
355 define float @no_estimate_refinement_f32(float %a, float %b) #0 {
356 ; CHECK-P7-LABEL: no_estimate_refinement_f32:
358 ; CHECK-P7-NEXT: frsqrtes 0, 2
359 ; CHECK-P7-NEXT: fmuls 1, 1, 0
362 ; CHECK-P8-LABEL: no_estimate_refinement_f32:
364 ; CHECK-P8-NEXT: xsrsqrtesp 0, 2
365 ; CHECK-P8-NEXT: xsmulsp 1, 1, 0
368 ; CHECK-P9-LABEL: no_estimate_refinement_f32:
370 ; CHECK-P9-NEXT: xsrsqrtesp 0, 2
371 ; CHECK-P9-NEXT: xsmulsp 1, 1, 0
373 %x = call reassoc arcp float @llvm.sqrt.f32(float %b)
374 %r = fdiv reassoc arcp float %a, %x
378 define float @rsqrt_fmul_fmf(float %a, float %b, float %c) {
379 ; CHECK-P7-LABEL: rsqrt_fmul_fmf:
381 ; CHECK-P7-NEXT: frsqrtes 0, 1
382 ; CHECK-P7-NEXT: addis 3, 2, .LCPI10_0@toc@ha
383 ; CHECK-P7-NEXT: addis 4, 2, .LCPI10_1@toc@ha
384 ; CHECK-P7-NEXT: lfs 4, .LCPI10_0@toc@l(3)
385 ; CHECK-P7-NEXT: lfs 5, .LCPI10_1@toc@l(4)
386 ; CHECK-P7-NEXT: fmuls 1, 1, 0
387 ; CHECK-P7-NEXT: fmadds 1, 1, 0, 4
388 ; CHECK-P7-NEXT: fmuls 0, 0, 5
389 ; CHECK-P7-NEXT: fmuls 0, 0, 1
390 ; CHECK-P7-NEXT: fres 1, 2
391 ; CHECK-P7-NEXT: fmuls 4, 0, 1
392 ; CHECK-P7-NEXT: fnmsubs 0, 2, 4, 0
393 ; CHECK-P7-NEXT: fmadds 0, 1, 0, 4
394 ; CHECK-P7-NEXT: fmuls 1, 3, 0
397 ; CHECK-P8-LABEL: rsqrt_fmul_fmf:
399 ; CHECK-P8-NEXT: xsrsqrtesp 0, 1
400 ; CHECK-P8-NEXT: vspltisw 2, -3
401 ; CHECK-P8-NEXT: addis 3, 2, .LCPI10_0@toc@ha
402 ; CHECK-P8-NEXT: lfs 5, .LCPI10_0@toc@l(3)
403 ; CHECK-P8-NEXT: xvcvsxwdp 4, 34
404 ; CHECK-P8-NEXT: xsmulsp 1, 1, 0
405 ; CHECK-P8-NEXT: xsmaddasp 4, 1, 0
406 ; CHECK-P8-NEXT: xsmulsp 0, 0, 5
407 ; CHECK-P8-NEXT: xsresp 1, 2
408 ; CHECK-P8-NEXT: xsmulsp 0, 0, 4
409 ; CHECK-P8-NEXT: xsmulsp 4, 0, 1
410 ; CHECK-P8-NEXT: xsnmsubasp 0, 2, 4
411 ; CHECK-P8-NEXT: xsmaddasp 4, 1, 0
412 ; CHECK-P8-NEXT: xsmulsp 1, 3, 4
415 ; CHECK-P9-LABEL: rsqrt_fmul_fmf:
417 ; CHECK-P9-NEXT: xsrsqrtesp 0, 1
418 ; CHECK-P9-NEXT: vspltisw 2, -3
419 ; CHECK-P9-NEXT: addis 3, 2, .LCPI10_0@toc@ha
420 ; CHECK-P9-NEXT: xsmulsp 1, 1, 0
421 ; CHECK-P9-NEXT: xvcvsxwdp 4, 34
422 ; CHECK-P9-NEXT: xsmaddasp 4, 1, 0
423 ; CHECK-P9-NEXT: lfs 1, .LCPI10_0@toc@l(3)
424 ; CHECK-P9-NEXT: xsmulsp 0, 0, 1
425 ; CHECK-P9-NEXT: xsresp 1, 2
426 ; CHECK-P9-NEXT: xsmulsp 0, 0, 4
427 ; CHECK-P9-NEXT: xsmulsp 4, 0, 1
428 ; CHECK-P9-NEXT: xsnmsubasp 0, 2, 4
429 ; CHECK-P9-NEXT: xsmaddasp 4, 1, 0
430 ; CHECK-P9-NEXT: xsmulsp 1, 3, 4
432 %x = call contract reassoc arcp nsz float @llvm.sqrt.f32(float %a)
433 %y = fmul contract reassoc nsz float %x, %b
434 %z = fdiv contract reassoc arcp nsz ninf float %c, %y
438 define float @rsqrt_fmul_safe(float %a, float %b, float %c) {
439 ; CHECK-P7-LABEL: rsqrt_fmul_safe:
441 ; CHECK-P7-NEXT: fsqrts 0, 1
442 ; CHECK-P7-NEXT: fmuls 0, 0, 2
443 ; CHECK-P7-NEXT: fdivs 1, 3, 0
446 ; CHECK-P8-LABEL: rsqrt_fmul_safe:
448 ; CHECK-P8-NEXT: xssqrtsp 0, 1
449 ; CHECK-P8-NEXT: xsmulsp 0, 0, 2
450 ; CHECK-P8-NEXT: xsdivsp 1, 3, 0
453 ; CHECK-P9-LABEL: rsqrt_fmul_safe:
455 ; CHECK-P9-NEXT: xssqrtsp 0, 1
456 ; CHECK-P9-NEXT: xsmulsp 0, 0, 2
457 ; CHECK-P9-NEXT: xsdivsp 1, 3, 0
459 %x = call float @llvm.sqrt.f32(float %a)
460 %y = fmul float %x, %b
461 %z = fdiv float %c, %y
465 define <4 x float> @hoo_fmf(<4 x float> %a, <4 x float> %b) nounwind {
466 ; CHECK-P7-LABEL: hoo_fmf:
468 ; CHECK-P7-NEXT: vspltisw 4, -1
469 ; CHECK-P7-NEXT: addis 3, 2, .LCPI12_0@toc@ha
470 ; CHECK-P7-NEXT: vrsqrtefp 5, 3
471 ; CHECK-P7-NEXT: addi 3, 3, .LCPI12_0@toc@l
472 ; CHECK-P7-NEXT: lvx 0, 0, 3
473 ; CHECK-P7-NEXT: addis 3, 2, .LCPI12_1@toc@ha
474 ; CHECK-P7-NEXT: addi 3, 3, .LCPI12_1@toc@l
475 ; CHECK-P7-NEXT: lvx 1, 0, 3
476 ; CHECK-P7-NEXT: vslw 4, 4, 4
477 ; CHECK-P7-NEXT: vmaddfp 3, 3, 5, 4
478 ; CHECK-P7-NEXT: vmaddfp 3, 3, 5, 0
479 ; CHECK-P7-NEXT: vmaddfp 5, 5, 1, 4
480 ; CHECK-P7-NEXT: vmaddfp 3, 5, 3, 4
481 ; CHECK-P7-NEXT: vmaddfp 2, 2, 3, 4
484 ; CHECK-P8-LABEL: hoo_fmf:
486 ; CHECK-P8-NEXT: xvrsqrtesp 0, 35
487 ; CHECK-P8-NEXT: addis 3, 2, .LCPI12_0@toc@ha
488 ; CHECK-P8-NEXT: addis 4, 2, .LCPI12_1@toc@ha
489 ; CHECK-P8-NEXT: addi 3, 3, .LCPI12_0@toc@l
490 ; CHECK-P8-NEXT: lxvd2x 2, 0, 3
491 ; CHECK-P8-NEXT: addi 3, 4, .LCPI12_1@toc@l
492 ; CHECK-P8-NEXT: lxvd2x 3, 0, 3
493 ; CHECK-P8-NEXT: xvmulsp 1, 35, 0
494 ; CHECK-P8-NEXT: xvmaddasp 2, 1, 0
495 ; CHECK-P8-NEXT: xvmulsp 0, 0, 3
496 ; CHECK-P8-NEXT: xvmulsp 0, 0, 2
497 ; CHECK-P8-NEXT: xvmulsp 34, 34, 0
500 ; CHECK-P9-LABEL: hoo_fmf:
502 ; CHECK-P9-NEXT: xvrsqrtesp 0, 35
503 ; CHECK-P9-NEXT: addis 3, 2, .LCPI12_0@toc@ha
504 ; CHECK-P9-NEXT: addi 3, 3, .LCPI12_0@toc@l
505 ; CHECK-P9-NEXT: lxv 2, 0(3)
506 ; CHECK-P9-NEXT: addis 3, 2, .LCPI12_1@toc@ha
507 ; CHECK-P9-NEXT: addi 3, 3, .LCPI12_1@toc@l
508 ; CHECK-P9-NEXT: xvmulsp 1, 35, 0
509 ; CHECK-P9-NEXT: xvmaddasp 2, 1, 0
510 ; CHECK-P9-NEXT: lxv 1, 0(3)
511 ; CHECK-P9-NEXT: xvmulsp 0, 0, 1
512 ; CHECK-P9-NEXT: xvmulsp 0, 0, 2
513 ; CHECK-P9-NEXT: xvmulsp 34, 34, 0
515 %x = call contract reassoc arcp <4 x float> @llvm.sqrt.v4f32(<4 x float> %b)
516 %r = fdiv contract reassoc arcp <4 x float> %a, %x
520 define <4 x float> @hoo_safe(<4 x float> %a, <4 x float> %b) nounwind {
521 ; CHECK-P7-LABEL: hoo_safe:
523 ; CHECK-P7-NEXT: addi 3, 1, -32
524 ; CHECK-P7-NEXT: stvx 3, 0, 3
525 ; CHECK-P7-NEXT: addi 3, 1, -48
526 ; CHECK-P7-NEXT: lfs 0, -20(1)
527 ; CHECK-P7-NEXT: lfs 3, -24(1)
528 ; CHECK-P7-NEXT: lfs 1, -32(1)
529 ; CHECK-P7-NEXT: lfs 2, -28(1)
530 ; CHECK-P7-NEXT: stvx 2, 0, 3
531 ; CHECK-P7-NEXT: addi 3, 1, -16
532 ; CHECK-P7-NEXT: fsqrts 0, 0
533 ; CHECK-P7-NEXT: lfs 4, -36(1)
534 ; CHECK-P7-NEXT: fsqrts 3, 3
535 ; CHECK-P7-NEXT: fsqrts 2, 2
536 ; CHECK-P7-NEXT: fsqrts 1, 1
537 ; CHECK-P7-NEXT: fdivs 0, 4, 0
538 ; CHECK-P7-NEXT: stfs 0, -4(1)
539 ; CHECK-P7-NEXT: lfs 0, -40(1)
540 ; CHECK-P7-NEXT: fdivs 0, 0, 3
541 ; CHECK-P7-NEXT: stfs 0, -8(1)
542 ; CHECK-P7-NEXT: lfs 0, -44(1)
543 ; CHECK-P7-NEXT: fdivs 0, 0, 2
544 ; CHECK-P7-NEXT: stfs 0, -12(1)
545 ; CHECK-P7-NEXT: lfs 0, -48(1)
546 ; CHECK-P7-NEXT: fdivs 0, 0, 1
547 ; CHECK-P7-NEXT: stfs 0, -16(1)
548 ; CHECK-P7-NEXT: lvx 2, 0, 3
551 ; CHECK-P8-LABEL: hoo_safe:
553 ; CHECK-P8-NEXT: xvsqrtsp 0, 35
554 ; CHECK-P8-NEXT: xvdivsp 34, 34, 0
557 ; CHECK-P9-LABEL: hoo_safe:
559 ; CHECK-P9-NEXT: xvsqrtsp 0, 35
560 ; CHECK-P9-NEXT: xvdivsp 34, 34, 0
562 %x = call <4 x float> @llvm.sqrt.v4f32(<4 x float> %b)
563 %r = fdiv <4 x float> %a, %x
567 define double @foo2_fmf(double %a, double %b) nounwind {
568 ; CHECK-P7-LABEL: foo2_fmf:
570 ; CHECK-P7-NEXT: fre 0, 2
571 ; CHECK-P7-NEXT: addis 3, 2, .LCPI14_0@toc@ha
572 ; CHECK-P7-NEXT: lfs 3, .LCPI14_0@toc@l(3)
573 ; CHECK-P7-NEXT: fmadd 3, 2, 0, 3
574 ; CHECK-P7-NEXT: fnmsub 0, 0, 3, 0
575 ; CHECK-P7-NEXT: fmul 3, 1, 0
576 ; CHECK-P7-NEXT: fnmsub 1, 2, 3, 1
577 ; CHECK-P7-NEXT: fmadd 1, 0, 1, 3
580 ; CHECK-P8-LABEL: foo2_fmf:
582 ; CHECK-P8-NEXT: vspltisw 2, -1
583 ; CHECK-P8-NEXT: xsredp 3, 2
584 ; CHECK-P8-NEXT: xvcvsxwdp 0, 34
585 ; CHECK-P8-NEXT: xsmaddadp 0, 2, 3
586 ; CHECK-P8-NEXT: xsnmsubadp 3, 3, 0
587 ; CHECK-P8-NEXT: xsmuldp 0, 1, 3
588 ; CHECK-P8-NEXT: xsnmsubadp 1, 2, 0
589 ; CHECK-P8-NEXT: xsmaddadp 0, 3, 1
590 ; CHECK-P8-NEXT: fmr 1, 0
593 ; CHECK-P9-LABEL: foo2_fmf:
595 ; CHECK-P9-NEXT: vspltisw 2, -1
596 ; CHECK-P9-NEXT: xsredp 3, 2
597 ; CHECK-P9-NEXT: xvcvsxwdp 0, 34
598 ; CHECK-P9-NEXT: xsmaddadp 0, 2, 3
599 ; CHECK-P9-NEXT: xsnmsubadp 3, 3, 0
600 ; CHECK-P9-NEXT: xsmuldp 0, 1, 3
601 ; CHECK-P9-NEXT: xsnmsubadp 1, 2, 0
602 ; CHECK-P9-NEXT: xsmaddadp 0, 3, 1
603 ; CHECK-P9-NEXT: fmr 1, 0
605 %r = fdiv contract reassoc arcp nsz ninf double %a, %b
609 define double @foo2_safe(double %a, double %b) nounwind {
610 ; CHECK-P7-LABEL: foo2_safe:
612 ; CHECK-P7-NEXT: fdiv 1, 1, 2
615 ; CHECK-P8-LABEL: foo2_safe:
617 ; CHECK-P8-NEXT: xsdivdp 1, 1, 2
620 ; CHECK-P9-LABEL: foo2_safe:
622 ; CHECK-P9-NEXT: xsdivdp 1, 1, 2
624 %r = fdiv double %a, %b
628 define float @goo2_fmf(float %a, float %b) nounwind {
629 ; CHECK-P7-LABEL: goo2_fmf:
631 ; CHECK-P7-NEXT: fres 0, 2
632 ; CHECK-P7-NEXT: fmuls 3, 1, 0
633 ; CHECK-P7-NEXT: fnmsubs 1, 2, 3, 1
634 ; CHECK-P7-NEXT: fmadds 1, 0, 1, 3
637 ; CHECK-P8-LABEL: goo2_fmf:
639 ; CHECK-P8-NEXT: xsresp 3, 2
640 ; CHECK-P8-NEXT: xsmulsp 0, 1, 3
641 ; CHECK-P8-NEXT: xsnmsubasp 1, 2, 0
642 ; CHECK-P8-NEXT: xsmaddasp 0, 3, 1
643 ; CHECK-P8-NEXT: fmr 1, 0
646 ; CHECK-P9-LABEL: goo2_fmf:
648 ; CHECK-P9-NEXT: xsresp 3, 2
649 ; CHECK-P9-NEXT: xsmulsp 0, 1, 3
650 ; CHECK-P9-NEXT: xsnmsubasp 1, 2, 0
651 ; CHECK-P9-NEXT: xsmaddasp 0, 3, 1
652 ; CHECK-P9-NEXT: fmr 1, 0
654 %r = fdiv contract reassoc arcp nsz ninf float %a, %b
658 define float @goo2_safe(float %a, float %b) nounwind {
659 ; CHECK-P7-LABEL: goo2_safe:
661 ; CHECK-P7-NEXT: fdivs 1, 1, 2
664 ; CHECK-P8-LABEL: goo2_safe:
666 ; CHECK-P8-NEXT: xsdivsp 1, 1, 2
669 ; CHECK-P9-LABEL: goo2_safe:
671 ; CHECK-P9-NEXT: xsdivsp 1, 1, 2
673 %r = fdiv float %a, %b
677 define <4 x float> @hoo2_fmf(<4 x float> %a, <4 x float> %b) nounwind {
678 ; CHECK-P7-LABEL: hoo2_fmf:
680 ; CHECK-P7-NEXT: vspltisw 4, -1
681 ; CHECK-P7-NEXT: vrefp 5, 3
682 ; CHECK-P7-NEXT: vslw 4, 4, 4
683 ; CHECK-P7-NEXT: vmaddfp 4, 2, 5, 4
684 ; CHECK-P7-NEXT: vnmsubfp 2, 3, 4, 2
685 ; CHECK-P7-NEXT: vmaddfp 2, 5, 2, 4
688 ; CHECK-P8-LABEL: hoo2_fmf:
690 ; CHECK-P8-NEXT: xvresp 1, 35
691 ; CHECK-P8-NEXT: xvmulsp 0, 34, 1
692 ; CHECK-P8-NEXT: xvnmsubasp 34, 35, 0
693 ; CHECK-P8-NEXT: xvmaddasp 0, 1, 34
694 ; CHECK-P8-NEXT: xxlor 34, 0, 0
697 ; CHECK-P9-LABEL: hoo2_fmf:
699 ; CHECK-P9-NEXT: xvresp 1, 35
700 ; CHECK-P9-NEXT: xvmulsp 0, 34, 1
701 ; CHECK-P9-NEXT: xvnmsubasp 34, 35, 0
702 ; CHECK-P9-NEXT: xvmaddasp 0, 1, 34
703 ; CHECK-P9-NEXT: xxlor 34, 0, 0
705 %r = fdiv contract reassoc arcp nsz ninf <4 x float> %a, %b
709 define <4 x float> @hoo2_safe(<4 x float> %a, <4 x float> %b) nounwind {
710 ; CHECK-P7-LABEL: hoo2_safe:
712 ; CHECK-P7-NEXT: addi 3, 1, -32
713 ; CHECK-P7-NEXT: addi 4, 1, -48
714 ; CHECK-P7-NEXT: stvx 3, 0, 3
715 ; CHECK-P7-NEXT: stvx 2, 0, 4
716 ; CHECK-P7-NEXT: lfs 0, -20(1)
717 ; CHECK-P7-NEXT: lfs 1, -36(1)
718 ; CHECK-P7-NEXT: addi 3, 1, -16
719 ; CHECK-P7-NEXT: fdivs 0, 1, 0
720 ; CHECK-P7-NEXT: lfs 1, -40(1)
721 ; CHECK-P7-NEXT: stfs 0, -4(1)
722 ; CHECK-P7-NEXT: lfs 0, -24(1)
723 ; CHECK-P7-NEXT: fdivs 0, 1, 0
724 ; CHECK-P7-NEXT: lfs 1, -44(1)
725 ; CHECK-P7-NEXT: stfs 0, -8(1)
726 ; CHECK-P7-NEXT: lfs 0, -28(1)
727 ; CHECK-P7-NEXT: fdivs 0, 1, 0
728 ; CHECK-P7-NEXT: lfs 1, -48(1)
729 ; CHECK-P7-NEXT: stfs 0, -12(1)
730 ; CHECK-P7-NEXT: lfs 0, -32(1)
731 ; CHECK-P7-NEXT: fdivs 0, 1, 0
732 ; CHECK-P7-NEXT: stfs 0, -16(1)
733 ; CHECK-P7-NEXT: lvx 2, 0, 3
736 ; CHECK-P8-LABEL: hoo2_safe:
738 ; CHECK-P8-NEXT: xvdivsp 34, 34, 35
741 ; CHECK-P9-LABEL: hoo2_safe:
743 ; CHECK-P9-NEXT: xvdivsp 34, 34, 35
745 %r = fdiv <4 x float> %a, %b
749 define double @foo3_fmf(double %a) nounwind {
750 ; CHECK-P7-LABEL: foo3_fmf:
752 ; CHECK-P7-NEXT: ftsqrt 0, 1
753 ; CHECK-P7-NEXT: bc 12, 2, .LBB20_2
754 ; CHECK-P7-NEXT: # %bb.1:
755 ; CHECK-P7-NEXT: frsqrte 0, 1
756 ; CHECK-P7-NEXT: addis 3, 2, .LCPI20_0@toc@ha
757 ; CHECK-P7-NEXT: addis 4, 2, .LCPI20_1@toc@ha
758 ; CHECK-P7-NEXT: lfs 3, .LCPI20_0@toc@l(3)
759 ; CHECK-P7-NEXT: lfs 4, .LCPI20_1@toc@l(4)
760 ; CHECK-P7-NEXT: fmul 2, 1, 0
761 ; CHECK-P7-NEXT: fmadd 2, 2, 0, 3
762 ; CHECK-P7-NEXT: fmul 0, 0, 4
763 ; CHECK-P7-NEXT: fmul 0, 0, 2
764 ; CHECK-P7-NEXT: fmul 1, 1, 0
765 ; CHECK-P7-NEXT: fmadd 0, 1, 0, 3
766 ; CHECK-P7-NEXT: fmul 1, 1, 4
767 ; CHECK-P7-NEXT: fmul 1, 1, 0
769 ; CHECK-P7-NEXT: .LBB20_2:
770 ; CHECK-P7-NEXT: fsqrt 1, 1
773 ; CHECK-P8-LABEL: foo3_fmf:
775 ; CHECK-P8-NEXT: xstsqrtdp 0, 1
776 ; CHECK-P8-NEXT: bc 12, 2, .LBB20_2
777 ; CHECK-P8-NEXT: # %bb.1:
778 ; CHECK-P8-NEXT: vspltisw 2, -3
779 ; CHECK-P8-NEXT: xsrsqrtedp 0, 1
780 ; CHECK-P8-NEXT: addis 3, 2, .LCPI20_0@toc@ha
781 ; CHECK-P8-NEXT: lfs 4, .LCPI20_0@toc@l(3)
782 ; CHECK-P8-NEXT: xvcvsxwdp 2, 34
783 ; CHECK-P8-NEXT: xsmuldp 3, 1, 0
784 ; CHECK-P8-NEXT: fmr 5, 2
785 ; CHECK-P8-NEXT: xsmaddadp 5, 3, 0
786 ; CHECK-P8-NEXT: xsmuldp 0, 0, 4
787 ; CHECK-P8-NEXT: xsmuldp 0, 0, 5
788 ; CHECK-P8-NEXT: xsmuldp 1, 1, 0
789 ; CHECK-P8-NEXT: xsmaddadp 2, 1, 0
790 ; CHECK-P8-NEXT: xsmuldp 0, 1, 4
791 ; CHECK-P8-NEXT: xsmuldp 1, 0, 2
793 ; CHECK-P8-NEXT: .LBB20_2:
794 ; CHECK-P8-NEXT: xssqrtdp 1, 1
797 ; CHECK-P9-LABEL: foo3_fmf:
799 ; CHECK-P9-NEXT: xstsqrtdp 0, 1
800 ; CHECK-P9-NEXT: bc 12, 2, .LBB20_2
801 ; CHECK-P9-NEXT: # %bb.1:
802 ; CHECK-P9-NEXT: xsrsqrtedp 0, 1
803 ; CHECK-P9-NEXT: vspltisw 2, -3
804 ; CHECK-P9-NEXT: addis 3, 2, .LCPI20_0@toc@ha
805 ; CHECK-P9-NEXT: xsmuldp 2, 1, 0
806 ; CHECK-P9-NEXT: xvcvsxwdp 3, 34
807 ; CHECK-P9-NEXT: fmr 4, 3
808 ; CHECK-P9-NEXT: xsmaddadp 4, 2, 0
809 ; CHECK-P9-NEXT: lfs 2, .LCPI20_0@toc@l(3)
810 ; CHECK-P9-NEXT: xsmuldp 0, 0, 2
811 ; CHECK-P9-NEXT: xsmuldp 0, 0, 4
812 ; CHECK-P9-NEXT: xsmuldp 1, 1, 0
813 ; CHECK-P9-NEXT: xsmaddadp 3, 1, 0
814 ; CHECK-P9-NEXT: xsmuldp 0, 1, 2
815 ; CHECK-P9-NEXT: xsmuldp 1, 0, 3
817 ; CHECK-P9-NEXT: .LBB20_2:
818 ; CHECK-P9-NEXT: xssqrtdp 1, 1
820 %r = call contract reassoc ninf afn double @llvm.sqrt.f64(double %a)
824 define double @foo3_fmf_crbits_off(double %a) #2 {
825 ; CHECK-P7-LABEL: foo3_fmf_crbits_off:
827 ; CHECK-P7-NEXT: fabs 0, 1
828 ; CHECK-P7-NEXT: addis 3, 2, .LCPI21_2@toc@ha
829 ; CHECK-P7-NEXT: lfd 2, .LCPI21_2@toc@l(3)
830 ; CHECK-P7-NEXT: fcmpu 0, 0, 2
831 ; CHECK-P7-NEXT: blt 0, .LBB21_2
832 ; CHECK-P7-NEXT: # %bb.1:
833 ; CHECK-P7-NEXT: frsqrte 0, 1
834 ; CHECK-P7-NEXT: addis 3, 2, .LCPI21_0@toc@ha
835 ; CHECK-P7-NEXT: addis 4, 2, .LCPI21_1@toc@ha
836 ; CHECK-P7-NEXT: lfs 3, .LCPI21_0@toc@l(3)
837 ; CHECK-P7-NEXT: lfs 4, .LCPI21_1@toc@l(4)
838 ; CHECK-P7-NEXT: fmul 2, 1, 0
839 ; CHECK-P7-NEXT: fmadd 2, 2, 0, 3
840 ; CHECK-P7-NEXT: fmul 0, 0, 4
841 ; CHECK-P7-NEXT: fmul 0, 0, 2
842 ; CHECK-P7-NEXT: fmul 1, 1, 0
843 ; CHECK-P7-NEXT: fmadd 0, 1, 0, 3
844 ; CHECK-P7-NEXT: fmul 1, 1, 4
845 ; CHECK-P7-NEXT: fmul 1, 1, 0
847 ; CHECK-P7-NEXT: .LBB21_2:
848 ; CHECK-P7-NEXT: fsqrt 1, 1
851 ; CHECK-P8-LABEL: foo3_fmf_crbits_off:
853 ; CHECK-P8-NEXT: xsabsdp 0, 1
854 ; CHECK-P8-NEXT: addis 3, 2, .LCPI21_1@toc@ha
855 ; CHECK-P8-NEXT: lfd 2, .LCPI21_1@toc@l(3)
856 ; CHECK-P8-NEXT: xscmpudp 0, 0, 2
857 ; CHECK-P8-NEXT: blt 0, .LBB21_2
858 ; CHECK-P8-NEXT: # %bb.1:
859 ; CHECK-P8-NEXT: vspltisw 2, -3
860 ; CHECK-P8-NEXT: xsrsqrtedp 0, 1
861 ; CHECK-P8-NEXT: addis 3, 2, .LCPI21_0@toc@ha
862 ; CHECK-P8-NEXT: lfs 4, .LCPI21_0@toc@l(3)
863 ; CHECK-P8-NEXT: xvcvsxwdp 2, 34
864 ; CHECK-P8-NEXT: xsmuldp 3, 1, 0
865 ; CHECK-P8-NEXT: fmr 5, 2
866 ; CHECK-P8-NEXT: xsmaddadp 5, 3, 0
867 ; CHECK-P8-NEXT: xsmuldp 0, 0, 4
868 ; CHECK-P8-NEXT: xsmuldp 0, 0, 5
869 ; CHECK-P8-NEXT: xsmuldp 1, 1, 0
870 ; CHECK-P8-NEXT: xsmaddadp 2, 1, 0
871 ; CHECK-P8-NEXT: xsmuldp 0, 1, 4
872 ; CHECK-P8-NEXT: xsmuldp 1, 0, 2
874 ; CHECK-P8-NEXT: .LBB21_2:
875 ; CHECK-P8-NEXT: xssqrtdp 1, 1
878 ; CHECK-P9-LABEL: foo3_fmf_crbits_off:
880 ; CHECK-P9-NEXT: addis 3, 2, .LCPI21_1@toc@ha
881 ; CHECK-P9-NEXT: xsabsdp 0, 1
882 ; CHECK-P9-NEXT: lfd 2, .LCPI21_1@toc@l(3)
883 ; CHECK-P9-NEXT: xscmpudp 0, 0, 2
884 ; CHECK-P9-NEXT: blt 0, .LBB21_2
885 ; CHECK-P9-NEXT: # %bb.1:
886 ; CHECK-P9-NEXT: xsrsqrtedp 0, 1
887 ; CHECK-P9-NEXT: vspltisw 2, -3
888 ; CHECK-P9-NEXT: addis 3, 2, .LCPI21_0@toc@ha
889 ; CHECK-P9-NEXT: xsmuldp 2, 1, 0
890 ; CHECK-P9-NEXT: xvcvsxwdp 3, 34
891 ; CHECK-P9-NEXT: fmr 4, 3
892 ; CHECK-P9-NEXT: xsmaddadp 4, 2, 0
893 ; CHECK-P9-NEXT: lfs 2, .LCPI21_0@toc@l(3)
894 ; CHECK-P9-NEXT: xsmuldp 0, 0, 2
895 ; CHECK-P9-NEXT: xsmuldp 0, 0, 4
896 ; CHECK-P9-NEXT: xsmuldp 1, 1, 0
897 ; CHECK-P9-NEXT: xsmaddadp 3, 1, 0
898 ; CHECK-P9-NEXT: xsmuldp 0, 1, 2
899 ; CHECK-P9-NEXT: xsmuldp 1, 0, 3
901 ; CHECK-P9-NEXT: .LBB21_2:
902 ; CHECK-P9-NEXT: xssqrtdp 1, 1
904 %r = call contract reassoc ninf afn double @llvm.sqrt.f64(double %a)
908 define double @foo3_safe(double %a) nounwind {
909 ; CHECK-P7-LABEL: foo3_safe:
911 ; CHECK-P7-NEXT: fsqrt 1, 1
914 ; CHECK-P8-LABEL: foo3_safe:
916 ; CHECK-P8-NEXT: xssqrtdp 1, 1
919 ; CHECK-P9-LABEL: foo3_safe:
921 ; CHECK-P9-NEXT: xssqrtdp 1, 1
923 %r = call double @llvm.sqrt.f64(double %a)
927 define float @goo3_fmf(float %a) nounwind {
928 ; CHECK-P7-LABEL: goo3_fmf:
930 ; CHECK-P7-NEXT: fabs 0, 1
931 ; CHECK-P7-NEXT: addis 3, 2, .LCPI23_2@toc@ha
932 ; CHECK-P7-NEXT: lfs 2, .LCPI23_2@toc@l(3)
933 ; CHECK-P7-NEXT: fcmpu 0, 0, 2
934 ; CHECK-P7-NEXT: blt 0, .LBB23_2
935 ; CHECK-P7-NEXT: # %bb.1:
936 ; CHECK-P7-NEXT: frsqrtes 0, 1
937 ; CHECK-P7-NEXT: addis 3, 2, .LCPI23_0@toc@ha
938 ; CHECK-P7-NEXT: addis 4, 2, .LCPI23_1@toc@ha
939 ; CHECK-P7-NEXT: lfs 2, .LCPI23_0@toc@l(3)
940 ; CHECK-P7-NEXT: lfs 3, .LCPI23_1@toc@l(4)
941 ; CHECK-P7-NEXT: fmuls 1, 1, 0
942 ; CHECK-P7-NEXT: fmadds 0, 1, 0, 2
943 ; CHECK-P7-NEXT: fmuls 1, 1, 3
944 ; CHECK-P7-NEXT: fmuls 1, 1, 0
946 ; CHECK-P7-NEXT: .LBB23_2:
947 ; CHECK-P7-NEXT: addis 3, 2, .LCPI23_3@toc@ha
948 ; CHECK-P7-NEXT: lfs 1, .LCPI23_3@toc@l(3)
951 ; CHECK-P8-LABEL: goo3_fmf:
953 ; CHECK-P8-NEXT: xsabsdp 0, 1
954 ; CHECK-P8-NEXT: addis 3, 2, .LCPI23_1@toc@ha
955 ; CHECK-P8-NEXT: lfs 2, .LCPI23_1@toc@l(3)
956 ; CHECK-P8-NEXT: fcmpu 0, 0, 2
957 ; CHECK-P8-NEXT: xxlxor 0, 0, 0
958 ; CHECK-P8-NEXT: blt 0, .LBB23_2
959 ; CHECK-P8-NEXT: # %bb.1:
960 ; CHECK-P8-NEXT: xsrsqrtesp 0, 1
961 ; CHECK-P8-NEXT: vspltisw 2, -3
962 ; CHECK-P8-NEXT: addis 3, 2, .LCPI23_0@toc@ha
963 ; CHECK-P8-NEXT: lfs 3, .LCPI23_0@toc@l(3)
964 ; CHECK-P8-NEXT: xvcvsxwdp 2, 34
965 ; CHECK-P8-NEXT: xsmulsp 1, 1, 0
966 ; CHECK-P8-NEXT: xsmaddasp 2, 1, 0
967 ; CHECK-P8-NEXT: xsmulsp 0, 1, 3
968 ; CHECK-P8-NEXT: xsmulsp 0, 0, 2
969 ; CHECK-P8-NEXT: .LBB23_2:
970 ; CHECK-P8-NEXT: fmr 1, 0
973 ; CHECK-P9-LABEL: goo3_fmf:
975 ; CHECK-P9-NEXT: addis 3, 2, .LCPI23_1@toc@ha
976 ; CHECK-P9-NEXT: xsabsdp 0, 1
977 ; CHECK-P9-NEXT: lfs 2, .LCPI23_1@toc@l(3)
978 ; CHECK-P9-NEXT: fcmpu 0, 0, 2
979 ; CHECK-P9-NEXT: xxlxor 0, 0, 0
980 ; CHECK-P9-NEXT: blt 0, .LBB23_2
981 ; CHECK-P9-NEXT: # %bb.1:
982 ; CHECK-P9-NEXT: xsrsqrtesp 0, 1
983 ; CHECK-P9-NEXT: vspltisw 2, -3
984 ; CHECK-P9-NEXT: addis 3, 2, .LCPI23_0@toc@ha
985 ; CHECK-P9-NEXT: xsmulsp 1, 1, 0
986 ; CHECK-P9-NEXT: xvcvsxwdp 2, 34
987 ; CHECK-P9-NEXT: xsmaddasp 2, 1, 0
988 ; CHECK-P9-NEXT: lfs 0, .LCPI23_0@toc@l(3)
989 ; CHECK-P9-NEXT: xsmulsp 0, 1, 0
990 ; CHECK-P9-NEXT: xsmulsp 0, 0, 2
991 ; CHECK-P9-NEXT: .LBB23_2:
992 ; CHECK-P9-NEXT: fmr 1, 0
994 %r = call contract reassoc ninf afn float @llvm.sqrt.f32(float %a)
998 define float @goo3_safe(float %a) nounwind {
999 ; CHECK-P7-LABEL: goo3_safe:
1000 ; CHECK-P7: # %bb.0:
1001 ; CHECK-P7-NEXT: fsqrts 1, 1
1002 ; CHECK-P7-NEXT: blr
1004 ; CHECK-P8-LABEL: goo3_safe:
1005 ; CHECK-P8: # %bb.0:
1006 ; CHECK-P8-NEXT: xssqrtsp 1, 1
1007 ; CHECK-P8-NEXT: blr
1009 ; CHECK-P9-LABEL: goo3_safe:
1010 ; CHECK-P9: # %bb.0:
1011 ; CHECK-P9-NEXT: xssqrtsp 1, 1
1012 ; CHECK-P9-NEXT: blr
1013 %r = call float @llvm.sqrt.f32(float %a)
1017 define <4 x float> @hoo3_fmf(<4 x float> %a) #1 {
1018 ; CHECK-P7-LABEL: hoo3_fmf:
1019 ; CHECK-P7: # %bb.0:
1020 ; CHECK-P7-NEXT: vspltisw 3, -1
1021 ; CHECK-P7-NEXT: addis 3, 2, .LCPI25_0@toc@ha
1022 ; CHECK-P7-NEXT: vrsqrtefp 4, 2
1023 ; CHECK-P7-NEXT: addi 3, 3, .LCPI25_0@toc@l
1024 ; CHECK-P7-NEXT: lvx 0, 0, 3
1025 ; CHECK-P7-NEXT: addis 3, 2, .LCPI25_1@toc@ha
1026 ; CHECK-P7-NEXT: addi 3, 3, .LCPI25_1@toc@l
1027 ; CHECK-P7-NEXT: lvx 1, 0, 3
1028 ; CHECK-P7-NEXT: vslw 3, 3, 3
1029 ; CHECK-P7-NEXT: vmaddfp 5, 2, 4, 3
1030 ; CHECK-P7-NEXT: vmaddfp 4, 5, 4, 0
1031 ; CHECK-P7-NEXT: vmaddfp 5, 5, 1, 3
1032 ; CHECK-P7-NEXT: vxor 0, 0, 0
1033 ; CHECK-P7-NEXT: vmaddfp 3, 5, 4, 3
1034 ; CHECK-P7-NEXT: vcmpeqfp 2, 2, 0
1035 ; CHECK-P7-NEXT: vsel 2, 3, 0, 2
1036 ; CHECK-P7-NEXT: blr
1038 ; CHECK-P8-LABEL: hoo3_fmf:
1039 ; CHECK-P8: # %bb.0:
1040 ; CHECK-P8-NEXT: xvtsqrtsp 0, 34
1041 ; CHECK-P8-NEXT: bc 12, 2, .LBB25_2
1042 ; CHECK-P8-NEXT: # %bb.1:
1043 ; CHECK-P8-NEXT: xvrsqrtesp 0, 34
1044 ; CHECK-P8-NEXT: addis 3, 2, .LCPI25_0@toc@ha
1045 ; CHECK-P8-NEXT: addis 4, 2, .LCPI25_1@toc@ha
1046 ; CHECK-P8-NEXT: addi 3, 3, .LCPI25_0@toc@l
1047 ; CHECK-P8-NEXT: lxvd2x 2, 0, 3
1048 ; CHECK-P8-NEXT: addi 3, 4, .LCPI25_1@toc@l
1049 ; CHECK-P8-NEXT: lxvd2x 3, 0, 3
1050 ; CHECK-P8-NEXT: xvmulsp 1, 34, 0
1051 ; CHECK-P8-NEXT: xvmaddasp 2, 1, 0
1052 ; CHECK-P8-NEXT: xvmulsp 0, 1, 3
1053 ; CHECK-P8-NEXT: xvmulsp 34, 0, 2
1054 ; CHECK-P8-NEXT: blr
1055 ; CHECK-P8-NEXT: .LBB25_2:
1056 ; CHECK-P8-NEXT: xvsqrtsp 34, 34
1057 ; CHECK-P8-NEXT: blr
1059 ; CHECK-P9-LABEL: hoo3_fmf:
1060 ; CHECK-P9: # %bb.0:
1061 ; CHECK-P9-NEXT: xvtsqrtsp 0, 34
1062 ; CHECK-P9-NEXT: bc 12, 2, .LBB25_2
1063 ; CHECK-P9-NEXT: # %bb.1:
1064 ; CHECK-P9-NEXT: xvrsqrtesp 0, 34
1065 ; CHECK-P9-NEXT: addis 3, 2, .LCPI25_0@toc@ha
1066 ; CHECK-P9-NEXT: addi 3, 3, .LCPI25_0@toc@l
1067 ; CHECK-P9-NEXT: lxv 2, 0(3)
1068 ; CHECK-P9-NEXT: addis 3, 2, .LCPI25_1@toc@ha
1069 ; CHECK-P9-NEXT: addi 3, 3, .LCPI25_1@toc@l
1070 ; CHECK-P9-NEXT: xvmulsp 1, 34, 0
1071 ; CHECK-P9-NEXT: xvmaddasp 2, 1, 0
1072 ; CHECK-P9-NEXT: lxv 0, 0(3)
1073 ; CHECK-P9-NEXT: xvmulsp 0, 1, 0
1074 ; CHECK-P9-NEXT: xvmulsp 34, 0, 2
1075 ; CHECK-P9-NEXT: blr
1076 ; CHECK-P9-NEXT: .LBB25_2:
1077 ; CHECK-P9-NEXT: xvsqrtsp 34, 34
1078 ; CHECK-P9-NEXT: blr
1079 %r = call contract reassoc ninf afn <4 x float> @llvm.sqrt.v4f32(<4 x float> %a)
1083 define <4 x float> @hoo3_safe(<4 x float> %a) nounwind {
1084 ; CHECK-P7-LABEL: hoo3_safe:
1085 ; CHECK-P7: # %bb.0:
1086 ; CHECK-P7-NEXT: addi 3, 1, -32
1087 ; CHECK-P7-NEXT: stvx 2, 0, 3
1088 ; CHECK-P7-NEXT: addi 3, 1, -16
1089 ; CHECK-P7-NEXT: lfs 0, -20(1)
1090 ; CHECK-P7-NEXT: fsqrts 0, 0
1091 ; CHECK-P7-NEXT: stfs 0, -4(1)
1092 ; CHECK-P7-NEXT: lfs 0, -24(1)
1093 ; CHECK-P7-NEXT: fsqrts 0, 0
1094 ; CHECK-P7-NEXT: stfs 0, -8(1)
1095 ; CHECK-P7-NEXT: lfs 0, -28(1)
1096 ; CHECK-P7-NEXT: fsqrts 0, 0
1097 ; CHECK-P7-NEXT: stfs 0, -12(1)
1098 ; CHECK-P7-NEXT: lfs 0, -32(1)
1099 ; CHECK-P7-NEXT: fsqrts 0, 0
1100 ; CHECK-P7-NEXT: stfs 0, -16(1)
1101 ; CHECK-P7-NEXT: lvx 2, 0, 3
1102 ; CHECK-P7-NEXT: blr
1104 ; CHECK-P8-LABEL: hoo3_safe:
1105 ; CHECK-P8: # %bb.0:
1106 ; CHECK-P8-NEXT: xvsqrtsp 34, 34
1107 ; CHECK-P8-NEXT: blr
1109 ; CHECK-P9-LABEL: hoo3_safe:
1110 ; CHECK-P9: # %bb.0:
1111 ; CHECK-P9-NEXT: xvsqrtsp 34, 34
1112 ; CHECK-P9-NEXT: blr
1113 %r = call <4 x float> @llvm.sqrt.v4f32(<4 x float> %a)
1117 define <2 x double> @hoo4_fmf(<2 x double> %a) #1 {
1118 ; CHECK-P7-LABEL: hoo4_fmf:
1119 ; CHECK-P7: # %bb.0:
1120 ; CHECK-P7-NEXT: ftsqrt 0, 1
1121 ; CHECK-P7-NEXT: addis 3, 2, .LCPI27_0@toc@ha
1122 ; CHECK-P7-NEXT: addis 4, 2, .LCPI27_1@toc@ha
1123 ; CHECK-P7-NEXT: lfs 3, .LCPI27_0@toc@l(3)
1124 ; CHECK-P7-NEXT: lfs 0, .LCPI27_1@toc@l(4)
1125 ; CHECK-P7-NEXT: bc 12, 2, .LBB27_3
1126 ; CHECK-P7-NEXT: # %bb.1:
1127 ; CHECK-P7-NEXT: frsqrte 4, 1
1128 ; CHECK-P7-NEXT: fmul 5, 1, 4
1129 ; CHECK-P7-NEXT: fmadd 5, 5, 4, 3
1130 ; CHECK-P7-NEXT: fmul 4, 4, 0
1131 ; CHECK-P7-NEXT: fmul 4, 4, 5
1132 ; CHECK-P7-NEXT: fmul 1, 1, 4
1133 ; CHECK-P7-NEXT: fmadd 4, 1, 4, 3
1134 ; CHECK-P7-NEXT: fmul 1, 1, 0
1135 ; CHECK-P7-NEXT: fmul 1, 1, 4
1136 ; CHECK-P7-NEXT: ftsqrt 0, 2
1137 ; CHECK-P7-NEXT: bc 4, 2, .LBB27_4
1138 ; CHECK-P7-NEXT: .LBB27_2:
1139 ; CHECK-P7-NEXT: fsqrt 2, 2
1140 ; CHECK-P7-NEXT: blr
1141 ; CHECK-P7-NEXT: .LBB27_3:
1142 ; CHECK-P7-NEXT: fsqrt 1, 1
1143 ; CHECK-P7-NEXT: ftsqrt 0, 2
1144 ; CHECK-P7-NEXT: bc 12, 2, .LBB27_2
1145 ; CHECK-P7-NEXT: .LBB27_4:
1146 ; CHECK-P7-NEXT: frsqrte 4, 2
1147 ; CHECK-P7-NEXT: fmul 5, 2, 4
1148 ; CHECK-P7-NEXT: fmadd 5, 5, 4, 3
1149 ; CHECK-P7-NEXT: fmul 4, 4, 0
1150 ; CHECK-P7-NEXT: fmul 4, 4, 5
1151 ; CHECK-P7-NEXT: fmul 2, 2, 4
1152 ; CHECK-P7-NEXT: fmadd 3, 2, 4, 3
1153 ; CHECK-P7-NEXT: fmul 0, 2, 0
1154 ; CHECK-P7-NEXT: fmul 2, 0, 3
1155 ; CHECK-P7-NEXT: blr
1157 ; CHECK-P8-LABEL: hoo4_fmf:
1158 ; CHECK-P8: # %bb.0:
1159 ; CHECK-P8-NEXT: xvtsqrtdp 0, 34
1160 ; CHECK-P8-NEXT: bc 12, 2, .LBB27_2
1161 ; CHECK-P8-NEXT: # %bb.1:
1162 ; CHECK-P8-NEXT: xvrsqrtedp 0, 34
1163 ; CHECK-P8-NEXT: addis 3, 2, .LCPI27_0@toc@ha
1164 ; CHECK-P8-NEXT: addi 3, 3, .LCPI27_0@toc@l
1165 ; CHECK-P8-NEXT: lxvd2x 2, 0, 3
1166 ; CHECK-P8-NEXT: addis 3, 2, .LCPI27_1@toc@ha
1167 ; CHECK-P8-NEXT: addi 3, 3, .LCPI27_1@toc@l
1168 ; CHECK-P8-NEXT: lxvd2x 3, 0, 3
1169 ; CHECK-P8-NEXT: xxlor 4, 2, 2
1170 ; CHECK-P8-NEXT: xvmuldp 1, 34, 0
1171 ; CHECK-P8-NEXT: xvmaddadp 4, 1, 0
1172 ; CHECK-P8-NEXT: xvmuldp 0, 0, 3
1173 ; CHECK-P8-NEXT: xvmuldp 0, 0, 4
1174 ; CHECK-P8-NEXT: xvmuldp 1, 34, 0
1175 ; CHECK-P8-NEXT: xvmaddadp 2, 1, 0
1176 ; CHECK-P8-NEXT: xvmuldp 0, 1, 3
1177 ; CHECK-P8-NEXT: xvmuldp 34, 0, 2
1178 ; CHECK-P8-NEXT: blr
1179 ; CHECK-P8-NEXT: .LBB27_2:
1180 ; CHECK-P8-NEXT: xvsqrtdp 34, 34
1181 ; CHECK-P8-NEXT: blr
1183 ; CHECK-P9-LABEL: hoo4_fmf:
1184 ; CHECK-P9: # %bb.0:
1185 ; CHECK-P9-NEXT: xvtsqrtdp 0, 34
1186 ; CHECK-P9-NEXT: bc 12, 2, .LBB27_2
1187 ; CHECK-P9-NEXT: # %bb.1:
1188 ; CHECK-P9-NEXT: xvrsqrtedp 0, 34
1189 ; CHECK-P9-NEXT: addis 3, 2, .LCPI27_0@toc@ha
1190 ; CHECK-P9-NEXT: addi 3, 3, .LCPI27_0@toc@l
1191 ; CHECK-P9-NEXT: lxv 2, 0(3)
1192 ; CHECK-P9-NEXT: addis 3, 2, .LCPI27_1@toc@ha
1193 ; CHECK-P9-NEXT: addi 3, 3, .LCPI27_1@toc@l
1194 ; CHECK-P9-NEXT: xvmuldp 1, 34, 0
1195 ; CHECK-P9-NEXT: xxlor 3, 2, 2
1196 ; CHECK-P9-NEXT: xvmaddadp 3, 1, 0
1197 ; CHECK-P9-NEXT: lxv 1, 0(3)
1198 ; CHECK-P9-NEXT: xvmuldp 0, 0, 1
1199 ; CHECK-P9-NEXT: xvmuldp 0, 0, 3
1200 ; CHECK-P9-NEXT: xvmuldp 3, 34, 0
1201 ; CHECK-P9-NEXT: xvmaddadp 2, 3, 0
1202 ; CHECK-P9-NEXT: xvmuldp 0, 3, 1
1203 ; CHECK-P9-NEXT: xvmuldp 34, 0, 2
1204 ; CHECK-P9-NEXT: blr
1205 ; CHECK-P9-NEXT: .LBB27_2:
1206 ; CHECK-P9-NEXT: xvsqrtdp 34, 34
1207 ; CHECK-P9-NEXT: blr
1208 %r = call contract reassoc ninf afn <2 x double> @llvm.sqrt.v2f64(<2 x double> %a)
1212 define <2 x double> @hoo4_safe(<2 x double> %a) #1 {
1213 ; CHECK-P7-LABEL: hoo4_safe:
1214 ; CHECK-P7: # %bb.0:
1215 ; CHECK-P7-NEXT: fsqrt 1, 1
1216 ; CHECK-P7-NEXT: fsqrt 2, 2
1217 ; CHECK-P7-NEXT: blr
1219 ; CHECK-P8-LABEL: hoo4_safe:
1220 ; CHECK-P8: # %bb.0:
1221 ; CHECK-P8-NEXT: xvsqrtdp 34, 34
1222 ; CHECK-P8-NEXT: blr
1224 ; CHECK-P9-LABEL: hoo4_safe:
1225 ; CHECK-P9: # %bb.0:
1226 ; CHECK-P9-NEXT: xvsqrtdp 34, 34
1227 ; CHECK-P9-NEXT: blr
1228 %r = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %a)
1232 define fp128 @hoo5_fmf(fp128 %a) #1 {
1233 ; CHECK-P7-LABEL: hoo5_fmf:
1234 ; CHECK-P7: # %bb.0:
1235 ; CHECK-P7-NEXT: mflr 0
1236 ; CHECK-P7-NEXT: stdu 1, -112(1)
1237 ; CHECK-P7-NEXT: std 0, 128(1)
1238 ; CHECK-P7-NEXT: bl sqrtf128
1239 ; CHECK-P7-NEXT: nop
1240 ; CHECK-P7-NEXT: addi 1, 1, 112
1241 ; CHECK-P7-NEXT: ld 0, 16(1)
1242 ; CHECK-P7-NEXT: mtlr 0
1243 ; CHECK-P7-NEXT: blr
1245 ; CHECK-P8-LABEL: hoo5_fmf:
1246 ; CHECK-P8: # %bb.0:
1247 ; CHECK-P8-NEXT: mflr 0
1248 ; CHECK-P8-NEXT: stdu 1, -32(1)
1249 ; CHECK-P8-NEXT: std 0, 48(1)
1250 ; CHECK-P8-NEXT: bl sqrtf128
1251 ; CHECK-P8-NEXT: nop
1252 ; CHECK-P8-NEXT: addi 1, 1, 32
1253 ; CHECK-P8-NEXT: ld 0, 16(1)
1254 ; CHECK-P8-NEXT: mtlr 0
1255 ; CHECK-P8-NEXT: blr
1257 ; CHECK-P9-LABEL: hoo5_fmf:
1258 ; CHECK-P9: # %bb.0:
1259 ; CHECK-P9-NEXT: xssqrtqp 2, 2
1260 ; CHECK-P9-NEXT: blr
1261 %r = call contract reassoc ninf afn fp128 @llvm.sqrt.f128(fp128 %a)
1265 define fp128 @hoo5_safe(fp128 %a) #1 {
1266 ; CHECK-P7-LABEL: hoo5_safe:
1267 ; CHECK-P7: # %bb.0:
1268 ; CHECK-P7-NEXT: mflr 0
1269 ; CHECK-P7-NEXT: stdu 1, -112(1)
1270 ; CHECK-P7-NEXT: std 0, 128(1)
1271 ; CHECK-P7-NEXT: bl sqrtf128
1272 ; CHECK-P7-NEXT: nop
1273 ; CHECK-P7-NEXT: addi 1, 1, 112
1274 ; CHECK-P7-NEXT: ld 0, 16(1)
1275 ; CHECK-P7-NEXT: mtlr 0
1276 ; CHECK-P7-NEXT: blr
1278 ; CHECK-P8-LABEL: hoo5_safe:
1279 ; CHECK-P8: # %bb.0:
1280 ; CHECK-P8-NEXT: mflr 0
1281 ; CHECK-P8-NEXT: stdu 1, -32(1)
1282 ; CHECK-P8-NEXT: std 0, 48(1)
1283 ; CHECK-P8-NEXT: bl sqrtf128
1284 ; CHECK-P8-NEXT: nop
1285 ; CHECK-P8-NEXT: addi 1, 1, 32
1286 ; CHECK-P8-NEXT: ld 0, 16(1)
1287 ; CHECK-P8-NEXT: mtlr 0
1288 ; CHECK-P8-NEXT: blr
1290 ; CHECK-P9-LABEL: hoo5_safe:
1291 ; CHECK-P9: # %bb.0:
1292 ; CHECK-P9-NEXT: xssqrtqp 2, 2
1293 ; CHECK-P9-NEXT: blr
1294 %r = call fp128 @llvm.sqrt.f128(fp128 %a)
1298 attributes #0 = { nounwind "reciprocal-estimates"="sqrtf:0,sqrtd:0" }
1299 attributes #1 = { nounwind "denormal-fp-math"="preserve-sign,preserve-sign" }
1300 attributes #2 = { nounwind readnone "target-features"="-crbits" }