blob: 5ae1be8953cc01352c078db86f2957a1ef31e652 [file] [log] [blame]
Ulrich Weigandd34b5bd2012-10-18 13:16:11 +00001; RUN: llc -mcpu=pwr7 < %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
Eli Benderskyeaf1a282012-11-26 14:09:46 +000015; 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)
Ulrich Weigandd34b5bd2012-10-18 13:16:11 +000020
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 -enable-unsafe-fp-math < %s | FileCheck %s -check-prefix=UNSAFE
26; CHECK-UNSAFE-NOT: isel
27