1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; Verify that we get the code sequence needed to avoid double-rounding.
3 ; Note that only parts of the sequence are checked for here, to allow
4 ; for minor code generation differences.
5 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-fpcvt < %s | FileCheck %s
6 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-fpcvt -mattr=-isel < %s | FileCheck %s --check-prefix=CHECK-NO-ISEL
7 ; Also check that with -enable-unsafe-fp-math we do not get that extra
8 ; code sequence. Simply verify that there is no "isel" present.
9 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-fpcvt -enable-unsafe-fp-math < %s | FileCheck %s -check-prefix=CHECK-UNSAFE
10 ; CHECK-UNSAFE-NOT: isel
11 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-v128:128:128-n32:64"
12 target triple = "powerpc64-unknown-linux-gnu"
14 define float @test(i64 %x) nounwind readnone {
15 ; Verify that we get the code sequence needed to avoid double-rounding.
16 ; Note that only parts of the sequence are checked for here, to allow
17 ; for minor code generation differences.
18 ; Also check that with -enable-unsafe-fp-math we do not get that extra
19 ; code sequence. Simply verify that there is no "isel" present.
20 ; RUN: llc -verify-machineinstrs -mcpu=pwr7 -mattr=-fpcvt -enable-unsafe-fp-math < %s | FileCheck %s -check-prefix=CHECK-UNSAFE
22 ; CHECK: # %bb.0: # %entry
23 ; CHECK-NEXT: clrldi 4, 3, 53
24 ; CHECK-NEXT: sradi 5, 3, 53
25 ; CHECK-NEXT: addi 4, 4, 2047
26 ; CHECK-NEXT: addi 5, 5, 1
27 ; CHECK-NEXT: or 4, 4, 3
28 ; CHECK-NEXT: cmpldi 5, 1
29 ; CHECK-NEXT: rldicr 4, 4, 0, 52
30 ; CHECK-NEXT: iselgt 3, 4, 3
31 ; CHECK-NEXT: std 3, -8(1)
32 ; CHECK-NEXT: lfd 0, -8(1)
33 ; CHECK-NEXT: xscvsxddp 0, 0
34 ; CHECK-NEXT: frsp 1, 0
37 ; CHECK-NO-ISEL-LABEL: test:
38 ; CHECK-NO-ISEL: # %bb.0: # %entry
39 ; CHECK-NO-ISEL-NEXT: sradi 4, 3, 53
40 ; CHECK-NO-ISEL-NEXT: addi 4, 4, 1
41 ; CHECK-NO-ISEL-NEXT: cmpldi 4, 1
42 ; CHECK-NO-ISEL-NEXT: bc 4, 1, .LBB0_2
43 ; CHECK-NO-ISEL-NEXT: # %bb.1:
44 ; CHECK-NO-ISEL-NEXT: clrldi 4, 3, 53
45 ; CHECK-NO-ISEL-NEXT: addi 4, 4, 2047
46 ; CHECK-NO-ISEL-NEXT: or 3, 4, 3
47 ; CHECK-NO-ISEL-NEXT: rldicr 3, 3, 0, 52
48 ; CHECK-NO-ISEL-NEXT: .LBB0_2: # %entry
49 ; CHECK-NO-ISEL-NEXT: std 3, -8(1)
50 ; CHECK-NO-ISEL-NEXT: lfd 0, -8(1)
51 ; CHECK-NO-ISEL-NEXT: xscvsxddp 0, 0
52 ; CHECK-NO-ISEL-NEXT: frsp 1, 0
53 ; CHECK-NO-ISEL-NEXT: blr
55 ; CHECK-UNSAFE-LABEL: test:
56 ; CHECK-UNSAFE: # %bb.0: # %entry
57 ; CHECK-UNSAFE-NEXT: std 3, -8(1)
58 ; CHECK-UNSAFE-NEXT: lfd 0, -8(1)
59 ; CHECK-UNSAFE-NEXT: xscvsxddp 0, 0
60 ; CHECK-UNSAFE-NEXT: frsp 1, 0
61 ; CHECK-UNSAFE-NEXT: blr
64 %conv = sitofp i64 %x to float