summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Canon <scanon@apple.com>2015-09-21 19:29:25 +0000
committerStephen Canon <scanon@apple.com>2015-09-21 19:29:25 +0000
commitb12db0e42ca1c0f58d740b44bdb3ec6b219291fd (patch)
treeb7df53b9e7f7fcab880e937d6dbdad3c6c0a4b6d
parent8055ed0c127e96cc0d008b4560ce8c6c45af8885 (diff)
downloadbcm5719-llvm-b12db0e42ca1c0f58d740b44bdb3ec6b219291fd.tar.gz
bcm5719-llvm-b12db0e42ca1c0f58d740b44bdb3ec6b219291fd.zip
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. llvm-svn: 248195
-rw-r--r--llvm/include/llvm/ADT/APFloat.h2
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp2
-rw-r--r--llvm/lib/ExecutionEngine/ExecutionEngine.cpp3
-rw-r--r--llvm/lib/IR/ConstantFold.cpp2
-rw-r--r--llvm/lib/Support/APFloat.cpp6
5 files changed, 7 insertions, 8 deletions
diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h
index bc7335e5b73..5984749ea9a 100644
--- a/llvm/include/llvm/ADT/APFloat.h
+++ b/llvm/include/llvm/ADT/APFloat.h
@@ -299,7 +299,7 @@ public:
/// IEEE remainder.
opStatus remainder(const APFloat &);
/// C fmod, or llvm frem.
- opStatus mod(const APFloat &, roundingMode);
+ opStatus mod(const APFloat &);
opStatus fusedMultiplyAdd(const APFloat &, const APFloat &, roundingMode);
opStatus roundToIntegral(roundingMode);
/// IEEE-754R 5.3.1: nextUp/nextDown.
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 2aec9050d97..a968e965a0d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -3738,7 +3738,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue N1,
}
break;
case ISD::FREM :
- s = V1.mod(V2, APFloat::rmNearestTiesToEven);
+ s = V1.mod(V2);
if (!HasFPExceptions || (s!=APFloat::opInvalidOp &&
s!=APFloat::opDivByZero)) {
return getConstantFP(V1, DL, VT);
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index 136a2d5f037..cd62525122c 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -869,8 +869,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
GV.IntVal = apfLHS.bitcastToAPInt();
break;
case Instruction::FRem:
- apfLHS.mod(APFloat(Sem, RHS.IntVal),
- APFloat::rmNearestTiesToEven);
+ apfLHS.mod(APFloat(Sem, RHS.IntVal));
GV.IntVal = apfLHS.bitcastToAPInt();
break;
}
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 1d2f4b2c203..68ddf096754 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -1187,7 +1187,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
(void)C3V.divide(C2V, APFloat::rmNearestTiesToEven);
return ConstantFP::get(C1->getContext(), C3V);
case Instruction::FRem:
- (void)C3V.mod(C2V, APFloat::rmNearestTiesToEven);
+ (void)C3V.mod(C2V);
return ConstantFP::get(C1->getContext(), C3V);
}
}
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 6bcc053d467..91b3db59d0e 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -1771,7 +1771,7 @@ APFloat::remainder(const APFloat &rhs)
/* Normalized llvm frem (C fmod).
This is not currently correct in all cases. */
APFloat::opStatus
-APFloat::mod(const APFloat &rhs, roundingMode rounding_mode)
+APFloat::mod(const APFloat &rhs)
{
opStatus fs;
fs = modSpecials(rhs);
@@ -1796,10 +1796,10 @@ APFloat::mod(const APFloat &rhs, roundingMode rounding_mode)
rmNearestTiesToEven);
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
- fs = subtract(V, rounding_mode);
+ fs = subtract(V, rmNearestTiesToEven);
assert(fs==opOK || fs==opInexact); // likewise
if (isZero())
OpenPOWER on IntegriCloud