[llvm-commits] [llvm] r42254 - /llvm/trunk/lib/VMCore/ConstantFold.cpp
Dale Johannesen
dalej at apple.com
Sun Sep 23 17:32:46 PDT 2007
Author: johannes
Date: Sun Sep 23 19:32:45 2007
New Revision: 42254
URL: http://llvm.org/viewvc/llvm-project?rev=42254&view=rev
Log:
Just use APFloat for const / const. Fixes
-1. / -0.
Modified:
llvm/trunk/lib/VMCore/ConstantFold.cpp
Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=42254&r1=42253&r2=42254&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
+++ llvm/trunk/lib/VMCore/ConstantFold.cpp Sun Sep 23 19:32:45 2007
@@ -699,23 +699,6 @@
(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:
More information about the llvm-commits
mailing list