1; RUN: llc -mcpu=pwr7 -mattr=-fpcvt < %s | FileCheck %s
2target 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"
3target triple = "powerpc64-unknown-linux-gnu"
4
5define float @test(i64 %x) nounwind readnone {
6entry:
7  %conv = sitofp i64 %x to float
8  ret float %conv
9}
10
11; Verify that we get the code sequence needed to avoid double-rounding.
12; Note that only parts of the sequence are checked for here, to allow
13; for minor code generation differences.
14
15; CHECK: sradi [[REG1:[0-9]+]], 3, 53
16; CHECK: addi [[REG2:[0-9]+]], [[REG1]], 1
17; CHECK: cmpldi 0, [[REG2]], 1
18; CHECK: isel [[REG3:[0-9]+]], {{[0-9]+}}, 3, 1
19; CHECK: std [[REG3]], -{{[0-9]+}}(1)
20
21
22; Also check that with -enable-unsafe-fp-math we do not get that extra
23; code sequence.  Simply verify that there is no "isel" present.
24
25; RUN: llc -mcpu=pwr7 -mattr=-fpcvt -enable-unsafe-fp-math < %s | FileCheck %s -check-prefix=CHECK-UNSAFE
26; CHECK-UNSAFE-NOT: isel
27
28