Hal Finkel | f6d45f2 | 2013-04-01 17:52:07 +0000 | [diff] [blame] | 1 | ; RUN: llc -mcpu=pwr7 -mattr=-fpcvt < %s | FileCheck %s |
Ulrich Weigand | d34b5bd | 2012-10-18 13:16:11 +0000 | [diff] [blame] | 2 | 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" |
| 3 | target triple = "powerpc64-unknown-linux-gnu" |
| 4 | |
| 5 | define float @test(i64 %x) nounwind readnone { |
| 6 | entry: |
| 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 Bendersky | eaf1a28 | 2012-11-26 14:09:46 +0000 | [diff] [blame] | 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) |
Ulrich Weigand | d34b5bd | 2012-10-18 13:16:11 +0000 | [diff] [blame] | 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 | |
Tim Northover | 501977e | 2013-08-12 12:43:26 +0000 | [diff] [blame] | 25 | ; RUN: llc -mcpu=pwr7 -mattr=-fpcvt -enable-unsafe-fp-math < %s | FileCheck %s -check-prefix=CHECK-UNSAFE |
Ulrich Weigand | d34b5bd | 2012-10-18 13:16:11 +0000 | [diff] [blame] | 26 | ; CHECK-UNSAFE-NOT: isel |
| 27 | |