1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux \
3 ; RUN: -mcpu=pwr8 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr | FileCheck \
4 ; RUN: --check-prefix=P8 %s
5 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-linux \
6 ; RUN: -mcpu=pwr9 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr | FileCheck \
7 ; RUN: --check-prefix=P9 %s
9 ; FIXME: Constrained fpext would fail if VSX feature disabled. Add no-vsx
11 declare float @llvm.experimental.constrained.ceil.f32(float, metadata)
12 declare double @llvm.experimental.constrained.ceil.f64(double, metadata)
13 declare <4 x float> @llvm.experimental.constrained.ceil.v4f32(<4 x float>, metadata)
14 declare <2 x double> @llvm.experimental.constrained.ceil.v2f64(<2 x double>, metadata)
16 declare float @llvm.experimental.constrained.floor.f32(float, metadata)
17 declare double @llvm.experimental.constrained.floor.f64(double, metadata)
18 declare <4 x float> @llvm.experimental.constrained.floor.v4f32(<4 x float>, metadata)
19 declare <2 x double> @llvm.experimental.constrained.floor.v2f64(<2 x double>, metadata)
21 declare double @llvm.experimental.constrained.nearbyint.f64(double, metadata, metadata)
22 declare <4 x float> @llvm.experimental.constrained.nearbyint.v4f32(<4 x float>, metadata, metadata)
23 declare <2 x double> @llvm.experimental.constrained.nearbyint.v2f64(<2 x double>, metadata, metadata)
25 declare <4 x double> @llvm.experimental.constrained.fpext.v4f64.v4f32(<4 x float>, metadata)
26 declare <2 x double> @llvm.experimental.constrained.fpext.v2f64.v2f32(<2 x float>, metadata)
28 declare float @llvm.experimental.constrained.fptrunc.f32.f64(double, metadata, metadata)
29 declare <4 x float> @llvm.experimental.constrained.fptrunc.v4f32.v4f64(<4 x double>, metadata, metadata)
30 declare <2 x float> @llvm.experimental.constrained.fptrunc.v2f32.v2f64(<2 x double>, metadata, metadata)
32 declare float @llvm.experimental.constrained.round.f32(float, metadata)
33 declare double @llvm.experimental.constrained.round.f64(double, metadata)
34 declare <4 x float> @llvm.experimental.constrained.round.v4f32(<4 x float>, metadata)
35 declare <2 x double> @llvm.experimental.constrained.round.v2f64(<2 x double>, metadata)
37 declare float @llvm.experimental.constrained.trunc.f32(float, metadata)
38 declare double @llvm.experimental.constrained.trunc.f64(double, metadata)
39 declare <4 x float> @llvm.experimental.constrained.trunc.v4f32(<4 x float>, metadata)
40 declare <2 x double> @llvm.experimental.constrained.trunc.v2f64(<2 x double>, metadata)
42 define float @ceil_f32(float %f1) {
45 ; P8-NEXT: xsrdpip f1, f1
50 ; P9-NEXT: xsrdpip f1, f1
52 %res = call float @llvm.experimental.constrained.ceil.f32(
54 metadata !"fpexcept.strict")
58 define double @ceil_f64(double %f1) {
61 ; P8-NEXT: xsrdpip f1, f1
66 ; P9-NEXT: xsrdpip f1, f1
68 %res = call double @llvm.experimental.constrained.ceil.f64(
70 metadata !"fpexcept.strict")
74 define <4 x float> @ceil_v4f32(<4 x float> %vf1) {
75 ; P8-LABEL: ceil_v4f32:
77 ; P8-NEXT: xvrspip v2, v2
80 ; P9-LABEL: ceil_v4f32:
82 ; P9-NEXT: xvrspip v2, v2
84 %res = call <4 x float> @llvm.experimental.constrained.ceil.v4f32(
86 metadata !"fpexcept.strict")
90 define <2 x double> @ceil_v2f64(<2 x double> %vf1) {
91 ; P8-LABEL: ceil_v2f64:
93 ; P8-NEXT: xvrdpip v2, v2
96 ; P9-LABEL: ceil_v2f64:
98 ; P9-NEXT: xvrdpip v2, v2
100 %res = call <2 x double> @llvm.experimental.constrained.ceil.v2f64(
102 metadata !"fpexcept.strict")
103 ret <2 x double> %res
106 define float @floor_f32(float %f1) {
107 ; P8-LABEL: floor_f32:
109 ; P8-NEXT: xsrdpim f1, f1
112 ; P9-LABEL: floor_f32:
114 ; P9-NEXT: xsrdpim f1, f1
116 %res = call float @llvm.experimental.constrained.floor.f32(
118 metadata !"fpexcept.strict")
122 define double @floor_f64(double %f1) {
123 ; P8-LABEL: floor_f64:
125 ; P8-NEXT: xsrdpim f1, f1
128 ; P9-LABEL: floor_f64:
130 ; P9-NEXT: xsrdpim f1, f1
132 %res = call double @llvm.experimental.constrained.floor.f64(
134 metadata !"fpexcept.strict")
138 define <4 x float> @floor_v4f32(<4 x float> %vf1) {
139 ; P8-LABEL: floor_v4f32:
141 ; P8-NEXT: xvrspim v2, v2
144 ; P9-LABEL: floor_v4f32:
146 ; P9-NEXT: xvrspim v2, v2
148 %res = call <4 x float> @llvm.experimental.constrained.floor.v4f32(
150 metadata !"fpexcept.strict")
151 ret <4 x float> %res;
154 define <2 x double> @floor_v2f64(<2 x double> %vf1) {
155 ; P8-LABEL: floor_v2f64:
157 ; P8-NEXT: xvrdpim v2, v2
160 ; P9-LABEL: floor_v2f64:
162 ; P9-NEXT: xvrdpim v2, v2
164 %res = call <2 x double> @llvm.experimental.constrained.floor.v2f64(
166 metadata !"fpexcept.strict")
167 ret <2 x double> %res;
170 define double @nearbyint_f64(double %f1, double %f2) {
171 ; P8-LABEL: nearbyint_f64:
174 ; P8-NEXT: stdu r1, -112(r1)
175 ; P8-NEXT: std r0, 128(r1)
176 ; P8-NEXT: .cfi_def_cfa_offset 112
177 ; P8-NEXT: .cfi_offset lr, 16
178 ; P8-NEXT: bl nearbyint
180 ; P8-NEXT: addi r1, r1, 112
181 ; P8-NEXT: ld r0, 16(r1)
185 ; P9-LABEL: nearbyint_f64:
188 ; P9-NEXT: stdu r1, -32(r1)
189 ; P9-NEXT: std r0, 48(r1)
190 ; P9-NEXT: .cfi_def_cfa_offset 32
191 ; P9-NEXT: .cfi_offset lr, 16
192 ; P9-NEXT: bl nearbyint
194 ; P9-NEXT: addi r1, r1, 32
195 ; P9-NEXT: ld r0, 16(r1)
198 %res = call double @llvm.experimental.constrained.nearbyint.f64(
200 metadata !"round.dynamic",
201 metadata !"fpexcept.strict")
205 define <4 x float> @nearbyint_v4f32(<4 x float> %vf1, <4 x float> %vf2) {
206 ; P8-LABEL: nearbyint_v4f32:
209 ; P8-NEXT: stdu r1, -176(r1)
210 ; P8-NEXT: std r0, 192(r1)
211 ; P8-NEXT: .cfi_def_cfa_offset 176
212 ; P8-NEXT: .cfi_offset lr, 16
213 ; P8-NEXT: .cfi_offset v29, -48
214 ; P8-NEXT: .cfi_offset v30, -32
215 ; P8-NEXT: .cfi_offset v31, -16
216 ; P8-NEXT: xxsldwi vs0, v2, v2, 3
217 ; P8-NEXT: li r3, 128
218 ; P8-NEXT: stxvd2x v29, r1, r3 # 16-byte Folded Spill
219 ; P8-NEXT: li r3, 144
220 ; P8-NEXT: stxvd2x v30, r1, r3 # 16-byte Folded Spill
221 ; P8-NEXT: li r3, 160
222 ; P8-NEXT: xscvspdpn f1, vs0
223 ; P8-NEXT: stxvd2x v31, r1, r3 # 16-byte Folded Spill
224 ; P8-NEXT: vmr v31, v2
225 ; P8-NEXT: bl nearbyintf
227 ; P8-NEXT: xxsldwi vs0, v31, v31, 1
228 ; P8-NEXT: xxlor v30, f1, f1
229 ; P8-NEXT: xscvspdpn f1, vs0
230 ; P8-NEXT: bl nearbyintf
232 ; P8-NEXT: # kill: def $f1 killed $f1 def $vsl1
233 ; P8-NEXT: xxmrghd vs0, vs1, v30
234 ; P8-NEXT: xscvspdpn f1, v31
235 ; P8-NEXT: xvcvdpsp v29, vs0
236 ; P8-NEXT: bl nearbyintf
238 ; P8-NEXT: xxswapd vs0, v31
239 ; P8-NEXT: xxlor v30, f1, f1
240 ; P8-NEXT: xscvspdpn f1, vs0
241 ; P8-NEXT: bl nearbyintf
243 ; P8-NEXT: # kill: def $f1 killed $f1 def $vsl1
244 ; P8-NEXT: xxmrghd vs0, v30, vs1
245 ; P8-NEXT: li r3, 160
246 ; P8-NEXT: lxvd2x v31, r1, r3 # 16-byte Folded Reload
247 ; P8-NEXT: li r3, 144
248 ; P8-NEXT: lxvd2x v30, r1, r3 # 16-byte Folded Reload
249 ; P8-NEXT: li r3, 128
250 ; P8-NEXT: xvcvdpsp v2, vs0
251 ; P8-NEXT: vmrgew v2, v2, v29
252 ; P8-NEXT: lxvd2x v29, r1, r3 # 16-byte Folded Reload
253 ; P8-NEXT: addi r1, r1, 176
254 ; P8-NEXT: ld r0, 16(r1)
258 ; P9-LABEL: nearbyint_v4f32:
261 ; P9-NEXT: stdu r1, -80(r1)
262 ; P9-NEXT: std r0, 96(r1)
263 ; P9-NEXT: .cfi_def_cfa_offset 80
264 ; P9-NEXT: .cfi_offset lr, 16
265 ; P9-NEXT: .cfi_offset v29, -48
266 ; P9-NEXT: .cfi_offset v30, -32
267 ; P9-NEXT: .cfi_offset v31, -16
268 ; P9-NEXT: xxsldwi vs0, v2, v2, 3
269 ; P9-NEXT: stxv v29, 32(r1) # 16-byte Folded Spill
270 ; P9-NEXT: xscvspdpn f1, vs0
271 ; P9-NEXT: stxv v30, 48(r1) # 16-byte Folded Spill
272 ; P9-NEXT: stxv v31, 64(r1) # 16-byte Folded Spill
273 ; P9-NEXT: vmr v31, v2
274 ; P9-NEXT: bl nearbyintf
276 ; P9-NEXT: xxsldwi vs0, v31, v31, 1
277 ; P9-NEXT: xscpsgndp v30, f1, f1
278 ; P9-NEXT: xscvspdpn f1, vs0
279 ; P9-NEXT: bl nearbyintf
281 ; P9-NEXT: # kill: def $f1 killed $f1 def $vsl1
282 ; P9-NEXT: xxmrghd vs0, vs1, v30
283 ; P9-NEXT: xscvspdpn f1, v31
284 ; P9-NEXT: xvcvdpsp v29, vs0
285 ; P9-NEXT: bl nearbyintf
287 ; P9-NEXT: xxswapd vs0, v31
288 ; P9-NEXT: xscpsgndp v30, f1, f1
289 ; P9-NEXT: xscvspdpn f1, vs0
290 ; P9-NEXT: bl nearbyintf
292 ; P9-NEXT: # kill: def $f1 killed $f1 def $vsl1
293 ; P9-NEXT: xxmrghd vs0, v30, vs1
294 ; P9-NEXT: lxv v31, 64(r1) # 16-byte Folded Reload
295 ; P9-NEXT: lxv v30, 48(r1) # 16-byte Folded Reload
296 ; P9-NEXT: xvcvdpsp v2, vs0
297 ; P9-NEXT: vmrgew v2, v2, v29
298 ; P9-NEXT: lxv v29, 32(r1) # 16-byte Folded Reload
299 ; P9-NEXT: addi r1, r1, 80
300 ; P9-NEXT: ld r0, 16(r1)
303 %res = call <4 x float> @llvm.experimental.constrained.nearbyint.v4f32(
305 metadata !"round.dynamic",
306 metadata !"fpexcept.strict")
310 define <2 x double> @nearbyint_v2f64(<2 x double> %vf1, <2 x double> %vf2) {
311 ; P8-LABEL: nearbyint_v2f64:
314 ; P8-NEXT: stdu r1, -160(r1)
315 ; P8-NEXT: std r0, 176(r1)
316 ; P8-NEXT: .cfi_def_cfa_offset 160
317 ; P8-NEXT: .cfi_offset lr, 16
318 ; P8-NEXT: .cfi_offset v30, -32
319 ; P8-NEXT: .cfi_offset v31, -16
320 ; P8-NEXT: li r3, 128
321 ; P8-NEXT: stxvd2x v30, r1, r3 # 16-byte Folded Spill
322 ; P8-NEXT: li r3, 144
323 ; P8-NEXT: stxvd2x v31, r1, r3 # 16-byte Folded Spill
324 ; P8-NEXT: vmr v31, v2
325 ; P8-NEXT: xxlor f1, v31, v31
326 ; P8-NEXT: bl nearbyint
328 ; P8-NEXT: xxlor v30, f1, f1
329 ; P8-NEXT: xxswapd vs1, v31
330 ; P8-NEXT: # kill: def $f1 killed $f1 killed $vsl1
331 ; P8-NEXT: bl nearbyint
333 ; P8-NEXT: li r3, 144
334 ; P8-NEXT: # kill: def $f1 killed $f1 def $vsl1
335 ; P8-NEXT: xxmrghd v2, v30, vs1
336 ; P8-NEXT: lxvd2x v31, r1, r3 # 16-byte Folded Reload
337 ; P8-NEXT: li r3, 128
338 ; P8-NEXT: lxvd2x v30, r1, r3 # 16-byte Folded Reload
339 ; P8-NEXT: addi r1, r1, 160
340 ; P8-NEXT: ld r0, 16(r1)
344 ; P9-LABEL: nearbyint_v2f64:
347 ; P9-NEXT: stdu r1, -64(r1)
348 ; P9-NEXT: std r0, 80(r1)
349 ; P9-NEXT: .cfi_def_cfa_offset 64
350 ; P9-NEXT: .cfi_offset lr, 16
351 ; P9-NEXT: .cfi_offset v30, -32
352 ; P9-NEXT: .cfi_offset v31, -16
353 ; P9-NEXT: stxv v31, 48(r1) # 16-byte Folded Spill
354 ; P9-NEXT: vmr v31, v2
355 ; P9-NEXT: xscpsgndp f1, v31, v31
356 ; P9-NEXT: stxv v30, 32(r1) # 16-byte Folded Spill
357 ; P9-NEXT: bl nearbyint
359 ; P9-NEXT: xscpsgndp v30, f1, f1
360 ; P9-NEXT: xxswapd vs1, v31
361 ; P9-NEXT: # kill: def $f1 killed $f1 killed $vsl1
362 ; P9-NEXT: bl nearbyint
364 ; P9-NEXT: # kill: def $f1 killed $f1 def $vsl1
365 ; P9-NEXT: xxmrghd v2, v30, vs1
366 ; P9-NEXT: lxv v31, 48(r1) # 16-byte Folded Reload
367 ; P9-NEXT: lxv v30, 32(r1) # 16-byte Folded Reload
368 ; P9-NEXT: addi r1, r1, 64
369 ; P9-NEXT: ld r0, 16(r1)
372 %res = call <2 x double> @llvm.experimental.constrained.nearbyint.v2f64(
374 metadata !"round.dynamic",
375 metadata !"fpexcept.strict")
376 ret <2 x double> %res
379 define <4 x double> @fpext_v4f64_v4f32(<4 x float> %vf1) {
380 ; P8-LABEL: fpext_v4f64_v4f32:
382 ; P8-NEXT: xxsldwi vs0, v2, v2, 1
383 ; P8-NEXT: xxsldwi vs1, v2, v2, 3
384 ; P8-NEXT: xxswapd vs3, v2
385 ; P8-NEXT: xscvspdpn f2, v2
386 ; P8-NEXT: xscvspdpn f0, vs0
387 ; P8-NEXT: xscvspdpn f1, vs1
388 ; P8-NEXT: xscvspdpn f3, vs3
389 ; P8-NEXT: xxmrghd v2, vs2, vs0
390 ; P8-NEXT: xxmrghd v3, vs3, vs1
393 ; P9-LABEL: fpext_v4f64_v4f32:
395 ; P9-NEXT: xxsldwi vs0, v2, v2, 3
396 ; P9-NEXT: xxswapd vs1, v2
397 ; P9-NEXT: xscvspdpn f0, vs0
398 ; P9-NEXT: xscvspdpn f1, vs1
399 ; P9-NEXT: xxsldwi vs2, v2, v2, 1
400 ; P9-NEXT: xscvspdpn f2, vs2
401 ; P9-NEXT: xxmrghd vs0, vs1, vs0
402 ; P9-NEXT: xscvspdpn f1, v2
403 ; P9-NEXT: xxmrghd v3, vs1, vs2
404 ; P9-NEXT: xxlor v2, vs0, vs0
406 %res = call <4 x double> @llvm.experimental.constrained.fpext.v4f64.v4f32(
408 metadata !"fpexcept.strict")
409 ret <4 x double> %res
412 define <2 x double> @fpext_v2f64_v2f32(<2 x float> %vf1) {
413 ; P8-LABEL: fpext_v2f64_v2f32:
415 ; P8-NEXT: xxsldwi vs0, v2, v2, 1
416 ; P8-NEXT: xscvspdpn f1, v2
417 ; P8-NEXT: xscvspdpn f0, vs0
418 ; P8-NEXT: xxmrghd v2, vs1, vs0
421 ; P9-LABEL: fpext_v2f64_v2f32:
423 ; P9-NEXT: xxsldwi vs0, v2, v2, 3
424 ; P9-NEXT: xxswapd vs1, v2
425 ; P9-NEXT: xscvspdpn f0, vs0
426 ; P9-NEXT: xscvspdpn f1, vs1
427 ; P9-NEXT: xxmrghd v2, vs1, vs0
429 %res = call <2 x double> @llvm.experimental.constrained.fpext.v2f64.v2f32(
431 metadata !"fpexcept.strict")
432 ret <2 x double> %res
435 define float @fptrunc_f32_f64(double %f1) {
436 ; P8-LABEL: fptrunc_f32_f64:
438 ; P8-NEXT: xsrsp f1, f1
441 ; P9-LABEL: fptrunc_f32_f64:
443 ; P9-NEXT: xsrsp f1, f1
445 %res = call float @llvm.experimental.constrained.fptrunc.f32.f64(
447 metadata !"round.dynamic",
448 metadata !"fpexcept.strict")
452 define <4 x float> @fptrunc_v4f32_v4f64(<4 x double> %vf1) {
453 ; P8-LABEL: fptrunc_v4f32_v4f64:
455 ; P8-NEXT: xxmrgld vs0, v2, v3
456 ; P8-NEXT: xxmrghd vs1, v2, v3
457 ; P8-NEXT: xvcvdpsp v2, vs0
458 ; P8-NEXT: xvcvdpsp v3, vs1
459 ; P8-NEXT: vmrgew v2, v3, v2
462 ; P9-LABEL: fptrunc_v4f32_v4f64:
464 ; P9-NEXT: xxmrgld vs0, v3, v2
465 ; P9-NEXT: xvcvdpsp v4, vs0
466 ; P9-NEXT: xxmrghd vs0, v3, v2
467 ; P9-NEXT: xvcvdpsp v2, vs0
468 ; P9-NEXT: vmrgew v2, v2, v4
470 %res = call <4 x float> @llvm.experimental.constrained.fptrunc.v4f32.v4f64(
472 metadata !"round.dynamic",
473 metadata !"fpexcept.strict")
477 define <2 x float> @fptrunc_v2f32_v2f64(<2 x double> %vf1) {
478 ; P8-LABEL: fptrunc_v2f32_v2f64:
480 ; P8-NEXT: xxswapd vs0, v2
481 ; P8-NEXT: xsrsp f1, v2
482 ; P8-NEXT: xsrsp f0, f0
483 ; P8-NEXT: xscvdpspn v2, f1
484 ; P8-NEXT: xscvdpspn v3, f0
485 ; P8-NEXT: vmrgow v2, v2, v3
488 ; P9-LABEL: fptrunc_v2f32_v2f64:
490 ; P9-NEXT: xxswapd vs1, v2
491 ; P9-NEXT: xsrsp f0, v2
492 ; P9-NEXT: xsrsp f1, f1
493 ; P9-NEXT: xscvdpspn vs0, f0
494 ; P9-NEXT: xscvdpspn vs1, f1
495 ; P9-NEXT: xxmrghw v2, vs0, vs1
497 %res = call <2 x float> @llvm.experimental.constrained.fptrunc.v2f32.v2f64(
499 metadata !"round.dynamic",
500 metadata !"fpexcept.strict")
504 define float @round_f32(float %f1) {
505 ; P8-LABEL: round_f32:
507 ; P8-NEXT: xsrdpi f1, f1
510 ; P9-LABEL: round_f32:
512 ; P9-NEXT: xsrdpi f1, f1
514 %res = call float @llvm.experimental.constrained.round.f32(
516 metadata !"fpexcept.strict")
520 define double @round_f64(double %f1) {
521 ; P8-LABEL: round_f64:
523 ; P8-NEXT: xsrdpi f1, f1
526 ; P9-LABEL: round_f64:
528 ; P9-NEXT: xsrdpi f1, f1
530 %res = call double @llvm.experimental.constrained.round.f64(
532 metadata !"fpexcept.strict")
536 define <4 x float> @round_v4f32(<4 x float> %vf1) {
537 ; P8-LABEL: round_v4f32:
539 ; P8-NEXT: xvrspi v2, v2
542 ; P9-LABEL: round_v4f32:
544 ; P9-NEXT: xvrspi v2, v2
546 %res = call <4 x float> @llvm.experimental.constrained.round.v4f32(
548 metadata !"fpexcept.strict")
552 define <2 x double> @round_v2f64(<2 x double> %vf1) {
553 ; P8-LABEL: round_v2f64:
555 ; P8-NEXT: xvrdpi v2, v2
558 ; P9-LABEL: round_v2f64:
560 ; P9-NEXT: xvrdpi v2, v2
562 %res = call <2 x double> @llvm.experimental.constrained.round.v2f64(
564 metadata !"fpexcept.strict")
565 ret <2 x double> %res
568 define float @trunc_f32(float %f1) {
569 ; P8-LABEL: trunc_f32:
571 ; P8-NEXT: xsrdpiz f1, f1
574 ; P9-LABEL: trunc_f32:
576 ; P9-NEXT: xsrdpiz f1, f1
578 %res = call float @llvm.experimental.constrained.trunc.f32(
580 metadata !"fpexcept.strict")
584 define double @trunc_f64(double %f1) {
585 ; P8-LABEL: trunc_f64:
587 ; P8-NEXT: xsrdpiz f1, f1
590 ; P9-LABEL: trunc_f64:
592 ; P9-NEXT: xsrdpiz f1, f1
594 %res = call double @llvm.experimental.constrained.trunc.f64(
596 metadata !"fpexcept.strict")
600 define <4 x float> @trunc_v4f32(<4 x float> %vf1) {
601 ; P8-LABEL: trunc_v4f32:
603 ; P8-NEXT: xvrspiz v2, v2
606 ; P9-LABEL: trunc_v4f32:
608 ; P9-NEXT: xvrspiz v2, v2
610 %res = call <4 x float> @llvm.experimental.constrained.trunc.v4f32(
612 metadata !"fpexcept.strict")
616 define <2 x double> @trunc_v2f64(<2 x double> %vf1) {
617 ; P8-LABEL: trunc_v2f64:
619 ; P8-NEXT: xvrdpiz v2, v2
622 ; P9-LABEL: trunc_v2f64:
624 ; P9-NEXT: xvrdpiz v2, v2
626 %res = call <2 x double> @llvm.experimental.constrained.trunc.v2f64(
628 metadata !"fpexcept.strict")
629 ret <2 x double> %res