diff options
author | Dale Johannesen <dalej@apple.com> | 2007-09-24 00:32:45 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2007-09-24 00:32:45 +0000 |
commit | 79653fcdc233476ad78bc232fb2c3764c89427f4 (patch) | |
tree | d600696d5a56696fa4dc0eb714811dc1c1132242 /lib/VMCore/ConstantFold.cpp | |
parent | 04fa56932052f416ea911fe65615ebecbf154f6d (diff) | |
download | external_llvm-79653fcdc233476ad78bc232fb2c3764c89427f4.zip external_llvm-79653fcdc233476ad78bc232fb2c3764c89427f4.tar.gz external_llvm-79653fcdc233476ad78bc232fb2c3764c89427f4.tar.bz2 |
Just use APFloat for const / const. Fixes
-1. / -0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42254 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 917098d..0c1d7f7 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -699,23 +699,6 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, (void)C3V.multiply(C2V, APFloat::rmNearestTiesToEven); return ConstantFP::get(CFP1->getType(), C3V); case Instruction::FDiv: - // FIXME better to look at the return code - if (C2V.isZero()) - if (C1V.isZero()) - // IEEE 754, Section 7.1, #4 - return ConstantFP::get(CFP1->getType(), isDouble ? - APFloat(std::numeric_limits<double>::quiet_NaN()) : - APFloat(std::numeric_limits<float>::quiet_NaN())); - else if (C2V.isNegZero() || C1V.isNegative()) - // IEEE 754, Section 7.2, negative infinity case - return ConstantFP::get(CFP1->getType(), isDouble ? - APFloat(-std::numeric_limits<double>::infinity()) : - APFloat(-std::numeric_limits<float>::infinity())); - else - // IEEE 754, Section 7.2, positive infinity case - return ConstantFP::get(CFP1->getType(), isDouble ? - APFloat(std::numeric_limits<double>::infinity()) : - APFloat(std::numeric_limits<float>::infinity())); (void)C3V.divide(C2V, APFloat::rmNearestTiesToEven); return ConstantFP::get(CFP1->getType(), C3V); case Instruction::FRem: |