diff options
author | Dale Johannesen <dalej@apple.com> | 2007-09-14 22:26:36 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2007-09-14 22:26:36 +0000 |
commit | 9e3d3abd937c9bb79d56d25ec0e0724c7cbba67c (patch) | |
tree | c30fb34d6aa099b2c600d4a43088b7e99ef4e79b /lib/Transforms/Scalar/InstructionCombining.cpp | |
parent | 24f2ea3971065eb9e88d50ebeddad0463337cae3 (diff) |
Remove the assumption that FP's are either float or
double from some of the many places in the optimizers
it appears, and do something reasonable with x86
long double.
Make APInt::dump() public, remove newline, use it to
dump ConstantSDNode's.
Allow APFloats in FoldingSet.
Expand X86 backend handling of long doubles (conversions
to/from int, mostly).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41967 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 0343635270..ab6262b47e 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -1949,7 +1949,8 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) { if (RHSC->isNullValue()) return ReplaceInstUsesWith(I, LHS); } else if (ConstantFP *CFP = dyn_cast<ConstantFP>(RHSC)) { - if (CFP->isExactlyValue(-0.0)) + if (CFP->isExactlyValue(ConstantFP::getNegativeZero + (I.getType())->getValueAPF())) return ReplaceInstUsesWith(I, LHS); } @@ -2349,8 +2350,10 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) { // "In IEEE floating point, x*1 is not equivalent to x for nans. However, // ANSI says we can drop signals, so we can do this anyway." (from GCC) - if (Op1F->isExactlyValue(1.0)) - return ReplaceInstUsesWith(I, Op0); // Eliminate 'mul double %X, 1.0' + // We need a better interface for long double here. + if (Op1->getType() == Type::FloatTy || Op1->getType() == Type::DoubleTy) + if (Op1F->isExactlyValue(1.0)) + return ReplaceInstUsesWith(I, Op0); // Eliminate 'mul double %X, 1.0' } if (BinaryOperator *Op0I = dyn_cast<BinaryOperator>(Op0)) |