[llvm-commits] [llvm] r58378 - in /llvm/trunk: include/llvm/CodeGen/ValueTypes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Duncan Sands
baldrick at free.fr
Wed Oct 29 07:22:20 PDT 2008
Author: baldrick
Date: Wed Oct 29 09:22:20 2008
New Revision: 58378
URL: http://llvm.org/viewvc/llvm-project?rev=58378&view=rev
Log:
Add sanity checking for BUILD_PAIR (I noticed the
other day that PPC custom lowering could create
a BUILD_PAIR of two f64 with a result type of...
f64! - already fixed). Fix a place that triggers
the sanity check.
Modified:
llvm/trunk/include/llvm/CodeGen/ValueTypes.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=58378&r1=58377&r2=58378&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Wed Oct 29 09:22:20 2008
@@ -142,6 +142,24 @@
inline bool operator== (const MVT VT) const { return V == VT.V; }
inline bool operator!= (const MVT VT) const { return V != VT.V; }
+ /// getFloatingPointVT - Returns the MVT that represents a floating point
+ /// type with the given number of bits. There are two floating point types
+ /// with 128 bits - this returns f128 rather than ppcf128.
+ static inline MVT getFloatingPointVT(unsigned BitWidth) {
+ switch (BitWidth) {
+ default:
+ assert(false && "Bad bit width!");
+ case 32:
+ return f32;
+ case 64:
+ return f64;
+ case 80:
+ return f80;
+ case 128:
+ return f128;
+ }
+ }
+
/// getIntegerVT - Returns the MVT that represents an integer with the given
/// number of bits.
static inline MVT getIntegerVT(unsigned BitWidth) {
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=58378&r1=58377&r2=58378&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Oct 29 09:22:20 2008
@@ -758,11 +758,25 @@
switch (N->getOpcode()) {
default:
break;
+ case ISD::BUILD_PAIR: {
+ MVT VT = N->getValueType(0);
+ assert(N->getNumValues() == 1 && "Too many results!");
+ assert(!VT.isVector() && (VT.isInteger() || VT.isFloatingPoint()) &&
+ "Wrong return type!");
+ assert(N->getNumOperands() == 2 && "Wrong number of operands!");
+ assert(N->getOperand(0).getValueType() == N->getOperand(1).getValueType() &&
+ "Mismatched operand types!");
+ assert(N->getOperand(0).getValueType().isInteger() == VT.isInteger() &&
+ "Wrong operand type!");
+ assert(VT.getSizeInBits() == 2 * N->getOperand(0).getValueSizeInBits() &&
+ "Wrong return type size");
+ break;
+ }
case ISD::BUILD_VECTOR: {
- assert(N->getNumValues() == 1 && "Too many results for BUILD_VECTOR!");
- assert(N->getValueType(0).isVector() && "Wrong BUILD_VECTOR return type!");
+ assert(N->getNumValues() == 1 && "Too many results!");
+ assert(N->getValueType(0).isVector() && "Wrong return type!");
assert(N->getNumOperands() == N->getValueType(0).getVectorNumElements() &&
- "Wrong number of BUILD_VECTOR operands!");
+ "Wrong number of operands!");
// FIXME: Change vector_shuffle to a variadic node with mask elements being
// operands of the node. Currently the mask is a BUILD_VECTOR passed as an
// operand, and it is not always possible to legalize it. Turning off the
@@ -770,7 +784,7 @@
// MVT EltVT = N->getValueType(0).getVectorElementType();
// for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I)
// assert(I->getSDValue().getValueType() == EltVT &&
-// "Wrong BUILD_VECTOR operand type!");
+// "Wrong operand type!");
break;
}
}
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=58378&r1=58377&r2=58378&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed Oct 29 09:22:20 2008
@@ -390,14 +390,17 @@
ValueVT : MVT::getIntegerVT(RoundBits);
SDValue Lo, Hi;
+ MVT HalfVT = ValueVT.isInteger() ?
+ MVT::getIntegerVT(RoundBits/2) :
+ MVT::getFloatingPointVT(RoundBits/2);
+
if (RoundParts > 2) {
- MVT HalfVT = MVT::getIntegerVT(RoundBits/2);
Lo = getCopyFromParts(DAG, Parts, RoundParts/2, PartVT, HalfVT);
Hi = getCopyFromParts(DAG, Parts+RoundParts/2, RoundParts/2,
PartVT, HalfVT);
} else {
- Lo = Parts[0];
- Hi = Parts[1];
+ Lo = DAG.getNode(ISD::BIT_CONVERT, HalfVT, Parts[0]);
+ Hi = DAG.getNode(ISD::BIT_CONVERT, HalfVT, Parts[1]);
}
if (TLI.isBigEndian())
std::swap(Lo, Hi);
More information about the llvm-commits
mailing list