Remove roundingMode argument in APFloat::mod

Because mod is always exact, this function should have never taken a rounding mode argument.  The actual implementation still has issues, which I'll look at resolving in a subsequent patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248195 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Stephen Canon 2015-09-21 19:29:25 +00:00
parent 82ede2f136
commit ff278be8cf
5 changed files with 7 additions and 8 deletions

View File

@ -299,7 +299,7 @@ public:
/// IEEE remainder. /// IEEE remainder.
opStatus remainder(const APFloat &); opStatus remainder(const APFloat &);
/// C fmod, or llvm frem. /// C fmod, or llvm frem.
opStatus mod(const APFloat &, roundingMode); opStatus mod(const APFloat &);
opStatus fusedMultiplyAdd(const APFloat &, const APFloat &, roundingMode); opStatus fusedMultiplyAdd(const APFloat &, const APFloat &, roundingMode);
opStatus roundToIntegral(roundingMode); opStatus roundToIntegral(roundingMode);
/// IEEE-754R 5.3.1: nextUp/nextDown. /// IEEE-754R 5.3.1: nextUp/nextDown.

View File

@ -3738,7 +3738,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue N1,
} }
break; break;
case ISD::FREM : case ISD::FREM :
s = V1.mod(V2, APFloat::rmNearestTiesToEven); s = V1.mod(V2);
if (!HasFPExceptions || (s!=APFloat::opInvalidOp && if (!HasFPExceptions || (s!=APFloat::opInvalidOp &&
s!=APFloat::opDivByZero)) { s!=APFloat::opDivByZero)) {
return getConstantFP(V1, DL, VT); return getConstantFP(V1, DL, VT);

View File

@ -869,8 +869,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
GV.IntVal = apfLHS.bitcastToAPInt(); GV.IntVal = apfLHS.bitcastToAPInt();
break; break;
case Instruction::FRem: case Instruction::FRem:
apfLHS.mod(APFloat(Sem, RHS.IntVal), apfLHS.mod(APFloat(Sem, RHS.IntVal));
APFloat::rmNearestTiesToEven);
GV.IntVal = apfLHS.bitcastToAPInt(); GV.IntVal = apfLHS.bitcastToAPInt();
break; break;
} }

View File

@ -1187,7 +1187,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
(void)C3V.divide(C2V, APFloat::rmNearestTiesToEven); (void)C3V.divide(C2V, APFloat::rmNearestTiesToEven);
return ConstantFP::get(C1->getContext(), C3V); return ConstantFP::get(C1->getContext(), C3V);
case Instruction::FRem: case Instruction::FRem:
(void)C3V.mod(C2V, APFloat::rmNearestTiesToEven); (void)C3V.mod(C2V);
return ConstantFP::get(C1->getContext(), C3V); return ConstantFP::get(C1->getContext(), C3V);
} }
} }

View File

@ -1771,7 +1771,7 @@ APFloat::remainder(const APFloat &rhs)
/* Normalized llvm frem (C fmod). /* Normalized llvm frem (C fmod).
This is not currently correct in all cases. */ This is not currently correct in all cases. */
APFloat::opStatus APFloat::opStatus
APFloat::mod(const APFloat &rhs, roundingMode rounding_mode) APFloat::mod(const APFloat &rhs)
{ {
opStatus fs; opStatus fs;
fs = modSpecials(rhs); fs = modSpecials(rhs);
@ -1796,10 +1796,10 @@ APFloat::mod(const APFloat &rhs, roundingMode rounding_mode)
rmNearestTiesToEven); rmNearestTiesToEven);
assert(fs==opOK); // should always work assert(fs==opOK); // should always work
fs = V.multiply(rhs, rounding_mode); fs = V.multiply(rhs, rmNearestTiesToEven);
assert(fs==opOK || fs==opInexact); // should not overflow or underflow assert(fs==opOK || fs==opInexact); // should not overflow or underflow
fs = subtract(V, rounding_mode); fs = subtract(V, rmNearestTiesToEven);
assert(fs==opOK || fs==opInexact); // likewise assert(fs==opOK || fs==opInexact); // likewise
if (isZero()) if (isZero())