summaryrefslogtreecommitdiffstats
path: root/llvm/test
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
commit389ed4b8f74e02cf36b2b1a9e5f346a32150e0b6 (patch)
tree0f7e95e301963cf162ce6493314a925a01d57b35 /llvm/test
parentf60f2fb14230f0f03dea217682df81e028a1264c (diff)
downloadbcm5719-llvm-389ed4b8f74e02cf36b2b1a9e5f346a32150e0b6.tar.gz
bcm5719-llvm-389ed4b8f74e02cf36b2b1a9e5f346a32150e0b6.zip
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 llvm-svn: 177906
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstCombine/fast-math.ll10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fast-math.ll b/llvm/test/Transforms/InstCombine/fast-math.ll
index 47f1ec48046..edcbcc71dfb 100644
--- a/llvm/test/Transforms/InstCombine/fast-math.ll
+++ b/llvm/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
OpenPOWER on IntegriCloud