[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Evan Cheng
evan.cheng at apple.com
Wed Apr 12 09:33:30 PDT 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.362 -> 1.363
---
Log message:
Vector type promotion for ISD::LOAD and ISD::SELECT
---
Diffs of the changes: (+23 -9)
LegalizeDAG.cpp | 32 +++++++++++++++++++++++---------
1 files changed, 23 insertions(+), 9 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.362 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.363
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.362 Wed Apr 12 11:20:43 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Apr 12 11:33:18 2006
@@ -1256,25 +1256,36 @@
MVT::ValueType VT = Node->getValueType(0);
Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Node->getOperand(2));
- Tmp2 = Result.getValue(0);
- Tmp3 = Result.getValue(1);
+ Tmp3 = Result.getValue(0);
+ Tmp4 = Result.getValue(1);
switch (TLI.getOperationAction(Node->getOpcode(), VT)) {
default: assert(0 && "This action is not supported yet!");
case TargetLowering::Legal: break;
case TargetLowering::Custom:
- Tmp1 = TLI.LowerOperation(Tmp2, DAG);
+ Tmp1 = TLI.LowerOperation(Tmp3, DAG);
if (Tmp1.Val) {
- Tmp2 = LegalizeOp(Tmp1);
- Tmp3 = LegalizeOp(Tmp1.getValue(1));
+ Tmp3 = LegalizeOp(Tmp1);
+ Tmp4 = LegalizeOp(Tmp1.getValue(1));
}
break;
+ case TargetLowering::Promote: {
+ // Only promote a load of vector type to another.
+ assert(MVT::isVector(VT) && "Cannot promote this load!");
+ // Change base type to a different vector type.
+ MVT::ValueType NVT = TLI.getTypeToPromoteTo(Node->getOpcode(), VT);
+
+ Tmp1 = DAG.getLoad(NVT, Tmp1, Tmp2, Node->getOperand(2));
+ Tmp3 = LegalizeOp(DAG.getNode(ISD::BIT_CONVERT, VT, Tmp1));
+ Tmp4 = LegalizeOp(Tmp1.getValue(1));
+ break;
+ }
}
// Since loads produce two values, make sure to remember that we
// legalized both of them.
- AddLegalizedOperand(SDOperand(Node, 0), Tmp2);
- AddLegalizedOperand(SDOperand(Node, 1), Tmp3);
- return Op.ResNo ? Tmp3 : Tmp2;
+ AddLegalizedOperand(SDOperand(Node, 0), Tmp3);
+ AddLegalizedOperand(SDOperand(Node, 1), Tmp4);
+ return Op.ResNo ? Tmp4 : Tmp3;
}
case ISD::EXTLOAD:
case ISD::SEXTLOAD:
@@ -1755,7 +1766,10 @@
MVT::ValueType NVT =
TLI.getTypeToPromoteTo(ISD::SELECT, Tmp2.getValueType());
unsigned ExtOp, TruncOp;
- if (MVT::isInteger(Tmp2.getValueType())) {
+ if (MVT::isVector(Tmp2.getValueType())) {
+ ExtOp = ISD::BIT_CONVERT;
+ TruncOp = ISD::BIT_CONVERT;
+ } else if (MVT::isInteger(Tmp2.getValueType())) {
ExtOp = ISD::ANY_EXTEND;
TruncOp = ISD::TRUNCATE;
} else {
More information about the llvm-commits
mailing list