1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mcpu=pwr7 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
3 ; RUN: -mtriple=powerpc64-unknown-unknown -verify-machineinstrs < %s | \
4 ; RUN: FileCheck %s --check-prefix=BE
5 ; RUN: llc -mcpu=pwr8 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
6 ; RUN: -mtriple=powerpc64le-unknown-unknown -verify-machineinstrs < %s | \
8 ; RUN: llc -mcpu=pwr8 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr \
9 ; RUN: -mtriple=powerpc64le-unknown-unknown -verify-machineinstrs < %s \
10 ; RUN: --enable-unsafe-fp-math | FileCheck %s --check-prefix=FAST
11 define dso_local i64 @test_lrint(double %d) local_unnamed_addr {
12 ; BE-LABEL: test_lrint:
13 ; BE: # %bb.0: # %entry
15 ; BE-NEXT: stdu r1, -112(r1)
16 ; BE-NEXT: std r0, 128(r1)
17 ; BE-NEXT: .cfi_def_cfa_offset 112
18 ; BE-NEXT: .cfi_offset lr, 16
21 ; BE-NEXT: addi r1, r1, 112
22 ; BE-NEXT: ld r0, 16(r1)
26 ; CHECK-LABEL: test_lrint:
27 ; CHECK: # %bb.0: # %entry
29 ; CHECK-NEXT: stdu r1, -32(r1)
30 ; CHECK-NEXT: std r0, 48(r1)
31 ; CHECK-NEXT: .cfi_def_cfa_offset 32
32 ; CHECK-NEXT: .cfi_offset lr, 16
33 ; CHECK-NEXT: bl lrint
35 ; CHECK-NEXT: addi r1, r1, 32
36 ; CHECK-NEXT: ld r0, 16(r1)
40 ; FAST-LABEL: test_lrint:
41 ; FAST: # %bb.0: # %entry
42 ; FAST-NEXT: fctid f0, f1
43 ; FAST-NEXT: mffprd r3, f0
46 %0 = tail call i64 @llvm.lrint.i64.f64(double %d)
50 declare i64 @llvm.lrint.i64.f64(double)
52 define dso_local i64 @test_lrintf(float %f) local_unnamed_addr {
53 ; BE-LABEL: test_lrintf:
54 ; BE: # %bb.0: # %entry
56 ; BE-NEXT: stdu r1, -112(r1)
57 ; BE-NEXT: std r0, 128(r1)
58 ; BE-NEXT: .cfi_def_cfa_offset 112
59 ; BE-NEXT: .cfi_offset lr, 16
62 ; BE-NEXT: addi r1, r1, 112
63 ; BE-NEXT: ld r0, 16(r1)
67 ; CHECK-LABEL: test_lrintf:
68 ; CHECK: # %bb.0: # %entry
70 ; CHECK-NEXT: stdu r1, -32(r1)
71 ; CHECK-NEXT: std r0, 48(r1)
72 ; CHECK-NEXT: .cfi_def_cfa_offset 32
73 ; CHECK-NEXT: .cfi_offset lr, 16
74 ; CHECK-NEXT: bl lrintf
76 ; CHECK-NEXT: addi r1, r1, 32
77 ; CHECK-NEXT: ld r0, 16(r1)
81 ; FAST-LABEL: test_lrintf:
82 ; FAST: # %bb.0: # %entry
83 ; FAST-NEXT: fctid f0, f1
84 ; FAST-NEXT: mffprd r3, f0
87 %0 = tail call i64 @llvm.lrint.i64.f32(float %f)
91 declare i64 @llvm.lrint.i64.f32(float)
93 define dso_local i64 @test_llrint(double %d) local_unnamed_addr {
94 ; BE-LABEL: test_llrint:
95 ; BE: # %bb.0: # %entry
97 ; BE-NEXT: stdu r1, -112(r1)
98 ; BE-NEXT: std r0, 128(r1)
99 ; BE-NEXT: .cfi_def_cfa_offset 112
100 ; BE-NEXT: .cfi_offset lr, 16
103 ; BE-NEXT: addi r1, r1, 112
104 ; BE-NEXT: ld r0, 16(r1)
108 ; CHECK-LABEL: test_llrint:
109 ; CHECK: # %bb.0: # %entry
110 ; CHECK-NEXT: mflr r0
111 ; CHECK-NEXT: stdu r1, -32(r1)
112 ; CHECK-NEXT: std r0, 48(r1)
113 ; CHECK-NEXT: .cfi_def_cfa_offset 32
114 ; CHECK-NEXT: .cfi_offset lr, 16
115 ; CHECK-NEXT: bl llrint
117 ; CHECK-NEXT: addi r1, r1, 32
118 ; CHECK-NEXT: ld r0, 16(r1)
119 ; CHECK-NEXT: mtlr r0
122 ; FAST-LABEL: test_llrint:
123 ; FAST: # %bb.0: # %entry
124 ; FAST-NEXT: fctid f0, f1
125 ; FAST-NEXT: mffprd r3, f0
128 %0 = tail call i64 @llvm.llrint.i64.f64(double %d)
132 declare i64 @llvm.llrint.i64.f64(double)
134 define dso_local i64 @test_llrintf(float %f) local_unnamed_addr {
135 ; BE-LABEL: test_llrintf:
136 ; BE: # %bb.0: # %entry
138 ; BE-NEXT: stdu r1, -112(r1)
139 ; BE-NEXT: std r0, 128(r1)
140 ; BE-NEXT: .cfi_def_cfa_offset 112
141 ; BE-NEXT: .cfi_offset lr, 16
142 ; BE-NEXT: bl llrintf
144 ; BE-NEXT: addi r1, r1, 112
145 ; BE-NEXT: ld r0, 16(r1)
149 ; CHECK-LABEL: test_llrintf:
150 ; CHECK: # %bb.0: # %entry
151 ; CHECK-NEXT: mflr r0
152 ; CHECK-NEXT: stdu r1, -32(r1)
153 ; CHECK-NEXT: std r0, 48(r1)
154 ; CHECK-NEXT: .cfi_def_cfa_offset 32
155 ; CHECK-NEXT: .cfi_offset lr, 16
156 ; CHECK-NEXT: bl llrintf
158 ; CHECK-NEXT: addi r1, r1, 32
159 ; CHECK-NEXT: ld r0, 16(r1)
160 ; CHECK-NEXT: mtlr r0
163 ; FAST-LABEL: test_llrintf:
164 ; FAST: # %bb.0: # %entry
165 ; FAST-NEXT: fctid f0, f1
166 ; FAST-NEXT: mffprd r3, f0
169 %0 = tail call i64 @llvm.llrint.i64.f32(float %f)
173 declare i64 @llvm.llrint.i64.f32(float)
175 define dso_local i64 @test_lround(double %d) local_unnamed_addr {
176 ; BE-LABEL: test_lround:
177 ; BE: # %bb.0: # %entry
179 ; BE-NEXT: stdu r1, -112(r1)
180 ; BE-NEXT: std r0, 128(r1)
181 ; BE-NEXT: .cfi_def_cfa_offset 112
182 ; BE-NEXT: .cfi_offset lr, 16
185 ; BE-NEXT: addi r1, r1, 112
186 ; BE-NEXT: ld r0, 16(r1)
190 ; CHECK-LABEL: test_lround:
191 ; CHECK: # %bb.0: # %entry
192 ; CHECK-NEXT: mflr r0
193 ; CHECK-NEXT: stdu r1, -32(r1)
194 ; CHECK-NEXT: std r0, 48(r1)
195 ; CHECK-NEXT: .cfi_def_cfa_offset 32
196 ; CHECK-NEXT: .cfi_offset lr, 16
197 ; CHECK-NEXT: bl lround
199 ; CHECK-NEXT: addi r1, r1, 32
200 ; CHECK-NEXT: ld r0, 16(r1)
201 ; CHECK-NEXT: mtlr r0
204 ; FAST-LABEL: test_lround:
205 ; FAST: # %bb.0: # %entry
206 ; FAST-NEXT: xsrdpi f0, f1
207 ; FAST-NEXT: fctid f0, f0
208 ; FAST-NEXT: mffprd r3, f0
211 %0 = tail call i64 @llvm.lround.i64.f64(double %d)
215 declare i64 @llvm.lround.i64.f64(double)
217 define dso_local i64 @test_lroundf(float %f) local_unnamed_addr {
218 ; BE-LABEL: test_lroundf:
219 ; BE: # %bb.0: # %entry
221 ; BE-NEXT: stdu r1, -112(r1)
222 ; BE-NEXT: std r0, 128(r1)
223 ; BE-NEXT: .cfi_def_cfa_offset 112
224 ; BE-NEXT: .cfi_offset lr, 16
225 ; BE-NEXT: bl lroundf
227 ; BE-NEXT: addi r1, r1, 112
228 ; BE-NEXT: ld r0, 16(r1)
232 ; CHECK-LABEL: test_lroundf:
233 ; CHECK: # %bb.0: # %entry
234 ; CHECK-NEXT: mflr r0
235 ; CHECK-NEXT: stdu r1, -32(r1)
236 ; CHECK-NEXT: std r0, 48(r1)
237 ; CHECK-NEXT: .cfi_def_cfa_offset 32
238 ; CHECK-NEXT: .cfi_offset lr, 16
239 ; CHECK-NEXT: bl lroundf
241 ; CHECK-NEXT: addi r1, r1, 32
242 ; CHECK-NEXT: ld r0, 16(r1)
243 ; CHECK-NEXT: mtlr r0
246 ; FAST-LABEL: test_lroundf:
247 ; FAST: # %bb.0: # %entry
248 ; FAST-NEXT: xsrdpi f0, f1
249 ; FAST-NEXT: fctid f0, f0
250 ; FAST-NEXT: mffprd r3, f0
253 %0 = tail call i64 @llvm.lround.i64.f32(float %f)
257 declare i64 @llvm.lround.i64.f32(float)
259 define dso_local i64 @test_llround(double %d) local_unnamed_addr {
260 ; BE-LABEL: test_llround:
261 ; BE: # %bb.0: # %entry
263 ; BE-NEXT: stdu r1, -112(r1)
264 ; BE-NEXT: std r0, 128(r1)
265 ; BE-NEXT: .cfi_def_cfa_offset 112
266 ; BE-NEXT: .cfi_offset lr, 16
267 ; BE-NEXT: bl llround
269 ; BE-NEXT: addi r1, r1, 112
270 ; BE-NEXT: ld r0, 16(r1)
274 ; CHECK-LABEL: test_llround:
275 ; CHECK: # %bb.0: # %entry
276 ; CHECK-NEXT: mflr r0
277 ; CHECK-NEXT: stdu r1, -32(r1)
278 ; CHECK-NEXT: std r0, 48(r1)
279 ; CHECK-NEXT: .cfi_def_cfa_offset 32
280 ; CHECK-NEXT: .cfi_offset lr, 16
281 ; CHECK-NEXT: bl llround
283 ; CHECK-NEXT: addi r1, r1, 32
284 ; CHECK-NEXT: ld r0, 16(r1)
285 ; CHECK-NEXT: mtlr r0
288 ; FAST-LABEL: test_llround:
289 ; FAST: # %bb.0: # %entry
290 ; FAST-NEXT: xsrdpi f0, f1
291 ; FAST-NEXT: fctid f0, f0
292 ; FAST-NEXT: mffprd r3, f0
295 %0 = tail call i64 @llvm.llround.i64.f64(double %d)
299 declare i64 @llvm.llround.i64.f64(double)
301 define dso_local i64 @test_llroundf(float %f) local_unnamed_addr {
302 ; BE-LABEL: test_llroundf:
303 ; BE: # %bb.0: # %entry
305 ; BE-NEXT: stdu r1, -112(r1)
306 ; BE-NEXT: std r0, 128(r1)
307 ; BE-NEXT: .cfi_def_cfa_offset 112
308 ; BE-NEXT: .cfi_offset lr, 16
309 ; BE-NEXT: bl llroundf
311 ; BE-NEXT: addi r1, r1, 112
312 ; BE-NEXT: ld r0, 16(r1)
316 ; CHECK-LABEL: test_llroundf:
317 ; CHECK: # %bb.0: # %entry
318 ; CHECK-NEXT: mflr r0
319 ; CHECK-NEXT: stdu r1, -32(r1)
320 ; CHECK-NEXT: std r0, 48(r1)
321 ; CHECK-NEXT: .cfi_def_cfa_offset 32
322 ; CHECK-NEXT: .cfi_offset lr, 16
323 ; CHECK-NEXT: bl llroundf
325 ; CHECK-NEXT: addi r1, r1, 32
326 ; CHECK-NEXT: ld r0, 16(r1)
327 ; CHECK-NEXT: mtlr r0
330 ; FAST-LABEL: test_llroundf:
331 ; FAST: # %bb.0: # %entry
332 ; FAST-NEXT: xsrdpi f0, f1
333 ; FAST-NEXT: fctid f0, f0
334 ; FAST-NEXT: mffprd r3, f0
337 %0 = tail call i64 @llvm.llround.i64.f32(float %f)
341 declare i64 @llvm.llround.i64.f32(float)
343 define dso_local double @test_nearbyint(double %d) local_unnamed_addr {
344 ; BE-LABEL: test_nearbyint:
345 ; BE: # %bb.0: # %entry
347 ; BE-NEXT: stdu r1, -112(r1)
348 ; BE-NEXT: std r0, 128(r1)
349 ; BE-NEXT: .cfi_def_cfa_offset 112
350 ; BE-NEXT: .cfi_offset lr, 16
351 ; BE-NEXT: bl nearbyint
353 ; BE-NEXT: addi r1, r1, 112
354 ; BE-NEXT: ld r0, 16(r1)
358 ; CHECK-LABEL: test_nearbyint:
359 ; CHECK: # %bb.0: # %entry
360 ; CHECK-NEXT: mflr r0
361 ; CHECK-NEXT: stdu r1, -32(r1)
362 ; CHECK-NEXT: std r0, 48(r1)
363 ; CHECK-NEXT: .cfi_def_cfa_offset 32
364 ; CHECK-NEXT: .cfi_offset lr, 16
365 ; CHECK-NEXT: bl nearbyint
367 ; CHECK-NEXT: addi r1, r1, 32
368 ; CHECK-NEXT: ld r0, 16(r1)
369 ; CHECK-NEXT: mtlr r0
372 ; FAST-LABEL: test_nearbyint:
373 ; FAST: # %bb.0: # %entry
374 ; FAST-NEXT: xsrdpic f1, f1
377 %0 = tail call double @llvm.nearbyint.f64(double %d)
381 declare double @llvm.nearbyint.f64(double)
383 define dso_local float @test_nearbyintf(float %f) local_unnamed_addr {
384 ; BE-LABEL: test_nearbyintf:
385 ; BE: # %bb.0: # %entry
387 ; BE-NEXT: stdu r1, -112(r1)
388 ; BE-NEXT: std r0, 128(r1)
389 ; BE-NEXT: .cfi_def_cfa_offset 112
390 ; BE-NEXT: .cfi_offset lr, 16
391 ; BE-NEXT: bl nearbyintf
393 ; BE-NEXT: addi r1, r1, 112
394 ; BE-NEXT: ld r0, 16(r1)
398 ; CHECK-LABEL: test_nearbyintf:
399 ; CHECK: # %bb.0: # %entry
400 ; CHECK-NEXT: mflr r0
401 ; CHECK-NEXT: stdu r1, -32(r1)
402 ; CHECK-NEXT: std r0, 48(r1)
403 ; CHECK-NEXT: .cfi_def_cfa_offset 32
404 ; CHECK-NEXT: .cfi_offset lr, 16
405 ; CHECK-NEXT: bl nearbyintf
407 ; CHECK-NEXT: addi r1, r1, 32
408 ; CHECK-NEXT: ld r0, 16(r1)
409 ; CHECK-NEXT: mtlr r0
412 ; FAST-LABEL: test_nearbyintf:
413 ; FAST: # %bb.0: # %entry
414 ; FAST-NEXT: xsrdpic f1, f1
417 %0 = tail call float @llvm.nearbyint.f32(float %f)
421 declare float @llvm.nearbyint.f32(float)
423 define dso_local double @test_round(double %d) local_unnamed_addr {
424 ; BE-LABEL: test_round:
425 ; BE: # %bb.0: # %entry
426 ; BE-NEXT: xsrdpi f1, f1
429 ; CHECK-LABEL: test_round:
430 ; CHECK: # %bb.0: # %entry
431 ; CHECK-NEXT: xsrdpi f1, f1
434 ; FAST-LABEL: test_round:
435 ; FAST: # %bb.0: # %entry
436 ; FAST-NEXT: xsrdpi f1, f1
439 %0 = tail call double @llvm.round.f64(double %d)
443 declare double @llvm.round.f64(double)
445 define dso_local float @test_roundf(float %f) local_unnamed_addr {
446 ; BE-LABEL: test_roundf:
447 ; BE: # %bb.0: # %entry
448 ; BE-NEXT: xsrdpi f1, f1
451 ; CHECK-LABEL: test_roundf:
452 ; CHECK: # %bb.0: # %entry
453 ; CHECK-NEXT: xsrdpi f1, f1
456 ; FAST-LABEL: test_roundf:
457 ; FAST: # %bb.0: # %entry
458 ; FAST-NEXT: xsrdpi f1, f1
461 %0 = tail call float @llvm.round.f32(float %f)
465 declare float @llvm.round.f32(float)
467 define dso_local double @test_trunc(double %d) local_unnamed_addr {
468 ; BE-LABEL: test_trunc:
469 ; BE: # %bb.0: # %entry
470 ; BE-NEXT: xsrdpiz f1, f1
473 ; CHECK-LABEL: test_trunc:
474 ; CHECK: # %bb.0: # %entry
475 ; CHECK-NEXT: xsrdpiz f1, f1
478 ; FAST-LABEL: test_trunc:
479 ; FAST: # %bb.0: # %entry
480 ; FAST-NEXT: xsrdpiz f1, f1
483 %0 = tail call double @llvm.trunc.f64(double %d)
487 declare double @llvm.trunc.f64(double)
489 define dso_local float @test_truncf(float %f) local_unnamed_addr {
490 ; BE-LABEL: test_truncf:
491 ; BE: # %bb.0: # %entry
492 ; BE-NEXT: xsrdpiz f1, f1
495 ; CHECK-LABEL: test_truncf:
496 ; CHECK: # %bb.0: # %entry
497 ; CHECK-NEXT: xsrdpiz f1, f1
500 ; FAST-LABEL: test_truncf:
501 ; FAST: # %bb.0: # %entry
502 ; FAST-NEXT: xsrdpiz f1, f1
505 %0 = tail call float @llvm.trunc.f32(float %f)
509 declare float @llvm.trunc.f32(float)
511 define dso_local double @test_floor(double %d) local_unnamed_addr {
512 ; BE-LABEL: test_floor:
513 ; BE: # %bb.0: # %entry
514 ; BE-NEXT: xsrdpim f1, f1
517 ; CHECK-LABEL: test_floor:
518 ; CHECK: # %bb.0: # %entry
519 ; CHECK-NEXT: xsrdpim f1, f1
522 ; FAST-LABEL: test_floor:
523 ; FAST: # %bb.0: # %entry
524 ; FAST-NEXT: xsrdpim f1, f1
527 %0 = tail call double @llvm.floor.f64(double %d)
531 declare double @llvm.floor.f64(double)
533 define dso_local float @test_floorf(float %f) local_unnamed_addr {
534 ; BE-LABEL: test_floorf:
535 ; BE: # %bb.0: # %entry
536 ; BE-NEXT: xsrdpim f1, f1
539 ; CHECK-LABEL: test_floorf:
540 ; CHECK: # %bb.0: # %entry
541 ; CHECK-NEXT: xsrdpim f1, f1
544 ; FAST-LABEL: test_floorf:
545 ; FAST: # %bb.0: # %entry
546 ; FAST-NEXT: xsrdpim f1, f1
549 %0 = tail call float @llvm.floor.f32(float %f)
553 declare float @llvm.floor.f32(float)
555 define dso_local double @test_ceil(double %d) local_unnamed_addr {
556 ; BE-LABEL: test_ceil:
557 ; BE: # %bb.0: # %entry
558 ; BE-NEXT: xsrdpip f1, f1
561 ; CHECK-LABEL: test_ceil:
562 ; CHECK: # %bb.0: # %entry
563 ; CHECK-NEXT: xsrdpip f1, f1
566 ; FAST-LABEL: test_ceil:
567 ; FAST: # %bb.0: # %entry
568 ; FAST-NEXT: xsrdpip f1, f1
571 %0 = tail call double @llvm.ceil.f64(double %d)
575 declare double @llvm.ceil.f64(double)
577 define dso_local float @test_ceilf(float %f) local_unnamed_addr {
578 ; BE-LABEL: test_ceilf:
579 ; BE: # %bb.0: # %entry
580 ; BE-NEXT: xsrdpip f1, f1
583 ; CHECK-LABEL: test_ceilf:
584 ; CHECK: # %bb.0: # %entry
585 ; CHECK-NEXT: xsrdpip f1, f1
588 ; FAST-LABEL: test_ceilf:
589 ; FAST: # %bb.0: # %entry
590 ; FAST-NEXT: xsrdpip f1, f1
593 %0 = tail call float @llvm.ceil.f32(float %f)
597 declare float @llvm.ceil.f32(float)
599 define dso_local double @test_rint(double %d) local_unnamed_addr {
600 ; BE-LABEL: test_rint:
601 ; BE: # %bb.0: # %entry
602 ; BE-NEXT: xsrdpic f1, f1
605 ; CHECK-LABEL: test_rint:
606 ; CHECK: # %bb.0: # %entry
607 ; CHECK-NEXT: xsrdpic f1, f1
610 ; FAST-LABEL: test_rint:
611 ; FAST: # %bb.0: # %entry
612 ; FAST-NEXT: xsrdpic f1, f1
615 %0 = tail call double @llvm.rint.f64(double %d)
619 declare double @llvm.rint.f64(double)
621 define dso_local float @test_rintf(float %f) local_unnamed_addr {
622 ; BE-LABEL: test_rintf:
623 ; BE: # %bb.0: # %entry
624 ; BE-NEXT: xsrdpic f1, f1
627 ; CHECK-LABEL: test_rintf:
628 ; CHECK: # %bb.0: # %entry
629 ; CHECK-NEXT: xsrdpic f1, f1
632 ; FAST-LABEL: test_rintf:
633 ; FAST: # %bb.0: # %entry
634 ; FAST-NEXT: xsrdpic f1, f1
637 %0 = tail call float @llvm.rint.f32(float %f)
641 declare float @llvm.rint.f32(float)