Legal, // The target natively supports this type.
Promote, // This type should be executed in a larger type.
Expand, // This type should be split into two types of half the size.
+ FloatToInt, // Convert a floating point type to an integer of the same size.
Scalarize, // Replace this one-element vector type with its element type.
Split // This vector type should be split into smaller vectors.
};
case TargetLowering::Promote:
return Promote;
case TargetLowering::Expand:
- // Expand can mean 1) split integer in half 2) scalarize single-element
- // vector 3) split vector in two.
- if (!MVT::isVector(VT))
- return Expand;
- else if (MVT::getVectorNumElements(VT) == 1)
+ // Expand can mean
+ // 1) split scalar in half, 2) convert a float to an integer,
+ // 3) scalarize a single-element vector, 4) split a vector in two.
+ if (!MVT::isVector(VT)) {
+ if (MVT::getSizeInBits(VT) ==
+ MVT::getSizeInBits(TLI.getTypeToTransformTo(VT)))
+ return FloatToInt;
+ else
+ return Expand;
+ } else if (MVT::getVectorNumElements(VT) == 1) {
return Scalarize;
- else
+ } else {
return Split;
+ }
}
}
/// PromotedNodes - For nodes that are below legal width, this map indicates
/// what promoted value to use.
- DenseMap<SDOperand, SDOperand> PromotedNodes;
+ DenseMap<SDOperandImpl, SDOperand> PromotedNodes;
/// ExpandedNodes - For nodes that need to be expanded this map indicates
/// which operands are the expanded version of the input.
- DenseMap<SDOperand, std::pair<SDOperand, SDOperand> > ExpandedNodes;
+ DenseMap<SDOperandImpl, std::pair<SDOperand, SDOperand> > ExpandedNodes;
+
+ /// FloatToIntedNodes - For floating point nodes converted to integers of
+ /// the same size, this map indicates the converted value to use.
+ DenseMap<SDOperandImpl, SDOperand> FloatToIntedNodes;
/// ScalarizedNodes - For nodes that are <1 x ty>, this map indicates the
/// scalar value of type 'ty' to use.
- DenseMap<SDOperand, SDOperand> ScalarizedNodes;
+ DenseMap<SDOperandImpl, SDOperand> ScalarizedNodes;
/// SplitNodes - For nodes that need to be split this map indicates
/// which operands are the expanded version of the input.
- DenseMap<SDOperand, std::pair<SDOperand, SDOperand> > SplitNodes;
+ DenseMap<SDOperandImpl, std::pair<SDOperand, SDOperand> > SplitNodes;
/// ReplacedNodes - For nodes that have been replaced with another,
/// indicates the replacement node to use.
- DenseMap<SDOperand, SDOperand> ReplacedNodes;
+ DenseMap<SDOperandImpl, SDOperand> ReplacedNodes;
/// Worklist - This defines a worklist of nodes to process. In order to be
/// pushed onto this worklist, all operands of a node must have already been
void RemapNode(SDOperand &N);
// Common routines.
+ SDOperand BitConvertToInteger(SDOperand Op);
SDOperand CreateStackStoreLoad(SDOperand Op, MVT::ValueType DestVT);
SDOperand HandleMemIntrinsic(SDNode *N);
- void SplitOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi);
+ SDOperand JoinIntegers(SDOperand Lo, SDOperand Hi);
+ void SplitInteger(SDOperand Op, SDOperand &Lo, SDOperand &Hi);
+ void SplitInteger(SDOperand Op, MVT::ValueType LoVT, MVT::ValueType HiVT,
+ SDOperand &Lo, SDOperand &Hi);
//===--------------------------------------------------------------------===//
// Promotion Support: LegalizeTypesPromote.cpp
void ExpandSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS,
ISD::CondCode &CCCode);
+ //===--------------------------------------------------------------------===//
+ // Float to Integer Conversion Support: LegalizeTypesFloatToInt.cpp
+ //===--------------------------------------------------------------------===//
+
+ SDOperand GetIntegerOp(SDOperand Op) {
+ SDOperand &IntegerOp = FloatToIntedNodes[Op];
+ RemapNode(IntegerOp);
+ assert(IntegerOp.Val && "Operand wasn't converted to integer?");
+ return IntegerOp;
+ }
+ void SetIntegerOp(SDOperand Op, SDOperand Result);
+
+ // Result Float to Integer Conversion.
+ void FloatToIntResult(SDNode *N, unsigned OpNo);
+ SDOperand FloatToIntRes_BIT_CONVERT(SDNode *N);
+ SDOperand FloatToIntRes_BUILD_PAIR(SDNode *N);
+ SDOperand FloatToIntRes_FCOPYSIGN(SDNode *N);
+
+ // Operand Float to Integer Conversion.
+ bool FloatToIntOperand(SDNode *N, unsigned OpNo);
+ SDOperand FloatToIntOp_BIT_CONVERT(SDNode *N);
+
//===--------------------------------------------------------------------===//
// Scalarization Support: LegalizeTypesScalarize.cpp
//===--------------------------------------------------------------------===//
void SplitRes_FPOWI(SDNode *N, SDOperand &Lo, SDOperand &Hi);
void SplitRes_SELECT(SDNode *N, SDOperand &Lo, SDOperand &Hi);
- // Operand Vector Scalarization: <128 x ty> -> 2 x <64 x ty>.
+ // Operand Vector Splitting: <128 x ty> -> 2 x <64 x ty>.
bool SplitOperand(SDNode *N, unsigned OpNo);
SDOperand SplitOp_BIT_CONVERT(SDNode *N);