aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine
diff options
context:
space:
mode:
authorShuxin Yang <shuxin.llvm@gmail.com>2013-03-25 20:43:41 +0000
committerShuxin Yang <shuxin.llvm@gmail.com>2013-03-25 20:43:41 +0000
commitc76067b7746f15879232c2aa27cf5c1ca35b3449 (patch)
tree0584c05a82b5b4166a7c7ea1ad92d1b6a2760fe2 /test/Transforms/InstCombine
parentdceaf4ac8dcb2167b57853d354760fe9a8cb8273 (diff)
downloadexternal_llvm-c76067b7746f15879232c2aa27cf5c1ca35b3449.zip
external_llvm-c76067b7746f15879232c2aa27cf5c1ca35b3449.tar.gz
external_llvm-c76067b7746f15879232c2aa27cf5c1ca35b3449.tar.bz2
Fix a bug in fast-math fadd/fsub simplification.
The problem is that the code mistakenly took for granted that following constructor is able to create an APFloat from a *SIGNED* integer: APFloat::APFloat(const fltSemantics &ourSemantics, integerPart value) rdar://13486998 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177906 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r--test/Transforms/InstCombine/fast-math.ll10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/fast-math.ll b/test/Transforms/InstCombine/fast-math.ll
index 47f1ec4..edcbcc7 100644
--- a/test/Transforms/InstCombine/fast-math.ll
+++ b/test/Transforms/InstCombine/fast-math.ll
@@ -130,6 +130,16 @@ define double @fail2(double %f1, double %f2) {
; CHECK: ret
}
+; c1 * x - x => (c1 - 1.0) * x
+define float @fold13(float %x) {
+ %mul = fmul fast float %x, 7.000000e+00
+ %sub = fsub fast float %mul, %x
+ ret float %sub
+; CHECK: fold13
+; CHECK: fmul fast float %x, 6.000000e+00
+; CHECK: ret
+}
+
; =========================================================================
;
; Testing-cases about fmul begin