42241409ff8927aaefc37c5bf144c2534d0a3210
[oota-llvm.git] / test / Transforms / InstCombine / fast-math.ll
1 ; RUN: opt < %s -instcombine -S | FileCheck %s
2
3 ; testing-case "float fold(float a) { return 1.2f * a * 2.3f; }"
4 ; 1.2f and 2.3f is supposed to be fold.
5 define float @fold(float %a) {
6 fold:
7   %mul = fmul fast float %a, 0x3FF3333340000000
8   %mul1 = fmul fast float %mul, 0x4002666660000000
9   ret float %mul1
10 ; CHECK: fold
11 ; CHECK: fmul float %a, 0x4006147AE0000000
12 }
13
14 ; Same testing-case as the one used in fold() except that the operators have
15 ; fixed FP mode.
16 define float @notfold(float %a) {
17 notfold:
18 ; CHECK: notfold
19 ; CHECK: %mul = fmul fast float %a, 0x3FF3333340000000
20   %mul = fmul fast float %a, 0x3FF3333340000000
21   %mul1 = fmul float %mul, 0x4002666660000000
22   ret float %mul1
23 }
24
25 define float @fold2(float %a) {
26 notfold2:
27 ; CHECK: fold2
28 ; CHECK: fmul float %a, 0x4006147AE0000000
29   %mul = fmul float %a, 0x3FF3333340000000
30   %mul1 = fmul fast float %mul, 0x4002666660000000
31   ret float %mul1
32 }