Add a second ValueType argument to isFPImmLegal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85361 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng
2009-10-28 01:43:28 +00:00
parent a104d1eab2
commit a1eaa3c52b
10 changed files with 15 additions and 11 deletions

View File

@ -328,7 +328,7 @@ public:
/// isFPImmLegal - Returns true if the target can instruction select the /// isFPImmLegal - Returns true if the target can instruction select the
/// specified FP immediate natively. If false, the legalizer will materialize /// specified FP immediate natively. If false, the legalizer will materialize
/// the FP immediate as a load from a constant pool. /// the FP immediate as a load from a constant pool.
virtual bool isFPImmLegal(const APFloat &Imm) const { virtual bool isFPImmLegal(const APFloat &Imm, EVT VT) const {
return false; return false;
} }

View File

@ -2574,7 +2574,7 @@ void SelectionDAGLegalize::ExpandNode(SDNode *Node,
ConstantFPSDNode *CFP = cast<ConstantFPSDNode>(Node); ConstantFPSDNode *CFP = cast<ConstantFPSDNode>(Node);
// Check to see if this FP immediate is already legal. // Check to see if this FP immediate is already legal.
// If this is a legal constant, turn it into a TargetConstantFP node. // If this is a legal constant, turn it into a TargetConstantFP node.
if (TLI.isFPImmLegal(CFP->getValueAPF())) if (TLI.isFPImmLegal(CFP->getValueAPF(), Node->getValueType(0)))
Results.push_back(SDValue(Node, 0)); Results.push_back(SDValue(Node, 0));
else else
Results.push_back(ExpandConstantFP(CFP, true, DAG, TLI)); Results.push_back(ExpandConstantFP(CFP, true, DAG, TLI));

View File

@ -915,7 +915,9 @@ AlphaTargetLowering::isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const {
return false; return false;
} }
bool AlphaTargetLowering::isFPImmLegal(const APFloat &Imm) const { bool AlphaTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT) const {
if (VT != MVT::f32 && VT != MVT::f64)
return false;
// +0.0 F31 // +0.0 F31
// +0.0f F31 // +0.0f F31
// -0.0 -F31 // -0.0 -F31

View File

@ -105,7 +105,7 @@ namespace llvm {
/// isFPImmLegal - Returns true if the target can instruction select the /// isFPImmLegal - Returns true if the target can instruction select the
/// specified FP immediate natively. If false, the legalizer will /// specified FP immediate natively. If false, the legalizer will
/// materialize the FP immediate as a load from a constant pool. /// materialize the FP immediate as a load from a constant pool.
virtual bool isFPImmLegal(const APFloat &Imm) const; virtual bool isFPImmLegal(const APFloat &Imm, EVT VT) const;
private: private:
// Helpers for custom lowering. // Helpers for custom lowering.

View File

@ -1222,6 +1222,8 @@ MipsTargetLowering::isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const {
return false; return false;
} }
bool MipsTargetLowering::isFPImmLegal(const APFloat &Imm) const { bool MipsTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT) const {
if (VT != MVT::f32 && VT != MVT::f64)
return false;
return Imm.isZero(); return Imm.isZero();
} }

View File

@ -150,7 +150,7 @@ namespace llvm {
/// isFPImmLegal - Returns true if the target can instruction select the /// isFPImmLegal - Returns true if the target can instruction select the
/// specified FP immediate natively. If false, the legalizer will /// specified FP immediate natively. If false, the legalizer will
/// materialize the FP immediate as a load from a constant pool. /// materialize the FP immediate as a load from a constant pool.
virtual bool isFPImmLegal(const APFloat &Imm) const; virtual bool isFPImmLegal(const APFloat &Imm, EVT VT) const;
}; };
} }

View File

@ -170,8 +170,8 @@ SDValue SystemZTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) {
} }
} }
bool SystemZTargetLowering::isFPImmLegal(const APFloat &Imm) const { bool SystemZTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT) const {
if (UseSoftFloat) if (UseSoftFloat || (VT != MVT::f32 && VT != MVT::f64))
return false; return false;
// +0.0 lzer // +0.0 lzer

View File

@ -92,7 +92,7 @@ namespace llvm {
/// isFPImmLegal - Returns true if the target can instruction select the /// isFPImmLegal - Returns true if the target can instruction select the
/// specified FP immediate natively. If false, the legalizer will /// specified FP immediate natively. If false, the legalizer will
/// materialize the FP immediate as a load from a constant pool. /// materialize the FP immediate as a load from a constant pool.
virtual bool isFPImmLegal(const APFloat &Imm) const; virtual bool isFPImmLegal(const APFloat &Imm, EVT VT) const;
private: private:
SDValue LowerCCCCallTo(SDValue Chain, SDValue Callee, SDValue LowerCCCCallTo(SDValue Chain, SDValue Callee,

View File

@ -2313,7 +2313,7 @@ static bool hasFPCMov(unsigned X86CC) {
/// isFPImmLegal - Returns true if the target can instruction select the /// isFPImmLegal - Returns true if the target can instruction select the
/// specified FP immediate natively. If false, the legalizer will /// specified FP immediate natively. If false, the legalizer will
/// materialize the FP immediate as a load from a constant pool. /// materialize the FP immediate as a load from a constant pool.
bool X86TargetLowering::isFPImmLegal(const APFloat &Imm) const { bool X86TargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT) const {
for (unsigned i = 0, e = LegalFPImmediates.size(); i != e; ++i) { for (unsigned i = 0, e = LegalFPImmediates.size(); i != e; ++i) {
if (Imm.bitwiseIsEqual(LegalFPImmediates[i])) if (Imm.bitwiseIsEqual(LegalFPImmediates[i]))
return true; return true;

View File

@ -502,7 +502,7 @@ namespace llvm {
/// isFPImmLegal - Returns true if the target can instruction select the /// isFPImmLegal - Returns true if the target can instruction select the
/// specified FP immediate natively. If false, the legalizer will /// specified FP immediate natively. If false, the legalizer will
/// materialize the FP immediate as a load from a constant pool. /// materialize the FP immediate as a load from a constant pool.
virtual bool isFPImmLegal(const APFloat &Imm) const; virtual bool isFPImmLegal(const APFloat &Imm, EVT VT) const;
/// isShuffleMaskLegal - Targets can use this to indicate that they only /// isShuffleMaskLegal - Targets can use this to indicate that they only
/// support *some* VECTOR_SHUFFLE operations, those with specific masks. /// support *some* VECTOR_SHUFFLE operations, those with specific masks.