mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
Add mod, copysign, abs operations to APFloat.
Implement some constant folding in SelectionDAG and DAGCombiner using APFloat. Remove double versions of constructor and getValue from ConstantFPSDNode. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41664 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1147,33 +1147,26 @@ public:
|
||||
class ConstantFPSDNode : public SDNode {
|
||||
APFloat Value;
|
||||
virtual void ANCHOR(); // Out-of-line virtual method to give class a home.
|
||||
// Longterm plan: replace all uses of getValue with getValueAPF, remove
|
||||
// getValue, rename getValueAPF to getValue.
|
||||
protected:
|
||||
friend class SelectionDAG;
|
||||
ConstantFPSDNode(bool isTarget, double val, MVT::ValueType VT)
|
||||
: SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP,
|
||||
getSDVTList(VT)),
|
||||
Value(VT==MVT::f64 ? APFloat(val) : APFloat((float)val)) {
|
||||
}
|
||||
ConstantFPSDNode(bool isTarget, const APFloat& val, MVT::ValueType VT)
|
||||
: SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP,
|
||||
getSDVTList(VT)), Value(val) {
|
||||
}
|
||||
public:
|
||||
|
||||
// Longterm plan: replace all uses of getValue with getValueAPF, remove
|
||||
// getValue, rename getValueAPF to getValue.
|
||||
double getValue() const {
|
||||
if ( getValueType(0)==MVT::f64)
|
||||
return Value.convertToDouble();
|
||||
else
|
||||
return Value.convertToFloat();
|
||||
}
|
||||
const APFloat& getValueAPF() const { return Value; }
|
||||
|
||||
/// isExactlyValue - We don't rely on operator== working on double values, as
|
||||
/// it returns true for things that are clearly not equal, like -0.0 and 0.0.
|
||||
/// As such, this method can be used to do an exact bit-for-bit comparison of
|
||||
/// two floating point values.
|
||||
|
||||
/// We leave the version with the double argument here because it's just so
|
||||
/// convenient to write "2.0" and the like. Without this function we'd
|
||||
/// have to duplicate its logic everywhere it's called.
|
||||
bool isExactlyValue(double V) const {
|
||||
if (getValueType(0)==MVT::f64)
|
||||
return isExactlyValue(APFloat(V));
|
||||
|
||||
Reference in New Issue
Block a user