diff options
author | Shuxin Yang <shuxin.llvm@gmail.com> | 2012-11-29 01:47:31 +0000 |
---|---|---|
committer | Shuxin Yang <shuxin.llvm@gmail.com> | 2012-11-29 01:47:31 +0000 |
commit | 9b7f6f2de89a321f7eae5e942c8668cb50acfd1d (patch) | |
tree | 3f34a5f5d5e79b5f79237baf71ae60f7037d538c /test | |
parent | 89bea17af235ea3a69485e73e54e71053c1bd936 (diff) | |
download | external_llvm-9b7f6f2de89a321f7eae5e942c8668cb50acfd1d.zip external_llvm-9b7f6f2de89a321f7eae5e942c8668cb50acfd1d.tar.gz external_llvm-9b7f6f2de89a321f7eae5e942c8668cb50acfd1d.tar.bz2 |
Instruction::isAssociative() returns true for fmul/fadd if they are tagged "unsafe" mode.
Approved by: Eli and Michael.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168848 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/fast-math.ll | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/fast-math.ll b/test/Transforms/InstCombine/fast-math.ll new file mode 100644 index 0000000..4224140 --- /dev/null +++ b/test/Transforms/InstCombine/fast-math.ll @@ -0,0 +1,32 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s + +; testing-case "float fold(float a) { return 1.2f * a * 2.3f; }" +; 1.2f and 2.3f is supposed to be fold. +define float @fold(float %a) { +fold: + %mul = fmul fast float %a, 0x3FF3333340000000 + %mul1 = fmul fast float %mul, 0x4002666660000000 + ret float %mul1 +; CHECK: fold +; CHECK: fmul float %a, 0x4006147AE0000000 +} + +; Same testing-case as the one used in fold() except that the operators have +; fixed FP mode. +define float @notfold(float %a) { +notfold: +; CHECK: notfold +; CHECK: %mul = fmul fast float %a, 0x3FF3333340000000 + %mul = fmul fast float %a, 0x3FF3333340000000 + %mul1 = fmul float %mul, 0x4002666660000000 + ret float %mul1 +} + +define float @fold2(float %a) { +notfold2: +; CHECK: fold2 +; CHECK: fmul float %a, 0x4006147AE0000000 + %mul = fmul float %a, 0x3FF3333340000000 + %mul1 = fmul fast float %mul, 0x4002666660000000 + ret float %mul1 +} |