Normally an 'optnone' function goes through fast-isel, which does not
[oota-llvm.git] / test / CodeGen / X86 / fastmath-optnone.ll
1 ; RUN: llc < %s -mcpu=corei7 -march=x86-64 -mattr=+sse2 | FileCheck %s
2 ; Verify that floating-point operations inside 'optnone' functions
3 ; are not optimized even if unsafe-fp-math is set.
4
5 define float @foo(float %x) #0 {
6 entry:
7   %add = fadd fast float %x, %x
8   %add1 = fadd fast float %add, %x
9   ret float %add1
10 }
11
12 ; CHECK-LABEL: @foo
13 ; CHECK-NOT: add
14 ; CHECK: mul
15 ; CHECK-NOT: add
16 ; CHECK: ret
17
18 define float @fooWithOptnone(float %x) #1 {
19 entry:
20   %add = fadd fast float %x, %x
21   %add1 = fadd fast float %add, %x
22   ret float %add1
23 }
24
25 ; CHECK-LABEL: @fooWithOptnone
26 ; CHECK-NOT: mul
27 ; CHECK: add
28 ; CHECK-NOT: mul
29 ; CHECK: add
30 ; CHECK-NOT: mul
31 ; CHECK: ret
32
33
34 attributes #0 = { "unsafe-fp-math"="true" }
35 attributes #1 = { noinline optnone "unsafe-fp-math"="true" }