From c76067b7746f15879232c2aa27cf5c1ca35b3449 Mon Sep 17 00:00:00 2001 From: Shuxin Yang Date: Mon, 25 Mar 2013 20:43:41 +0000 Subject: 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 --- test/Transforms/InstCombine/fast-math.ll | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/Transforms/InstCombine') diff --git a/test/Transforms/InstCombine/fast-math.ll b/test/Transforms/InstCombine/fast-math.ll index 47f1ec4804..edcbcc71df 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 -- cgit v1.2.3