[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Evan Cheng
evan.cheng at apple.com
Wed Apr 12 14:20:36 PDT 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.363 -> 1.364
---
Log message:
Promote vector AND, OR, and XOR
---
Diffs of the changes: (+27 -0)
LegalizeDAG.cpp | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.363 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.364
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.363 Wed Apr 12 11:33:18 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Apr 12 16:20:24 2006
@@ -2076,6 +2076,25 @@
Result = DAG.getNode(ISD::BUILD_VECTOR, Node->getValueType(0), Ops);
break;
}
+ case TargetLowering::Promote: {
+ switch (Node->getOpcode()) {
+ default: assert(0 && "Do not know how to promote this BinOp!");
+ case ISD::AND:
+ case ISD::OR:
+ case ISD::XOR: {
+ MVT::ValueType OVT = Node->getValueType(0);
+ MVT::ValueType NVT = TLI.getTypeToPromoteTo(Node->getOpcode(), OVT);
+ assert(MVT::isVector(OVT) && "Cannot promote this BinOp!");
+ // Bit convert each of the values to the new type.
+ Tmp1 = DAG.getNode(ISD::BIT_CONVERT, NVT, Tmp1);
+ Tmp2 = DAG.getNode(ISD::BIT_CONVERT, NVT, Tmp2);
+ Result = DAG.getNode(Node->getOpcode(), NVT, Tmp1, Tmp2);
+ // Bit convert the result back the original type.
+ Result = DAG.getNode(ISD::BIT_CONVERT, OVT, Result);
+ break;
+ }
+ }
+ }
}
break;
@@ -2953,6 +2972,14 @@
case ISD::AND:
case ISD::OR:
case ISD::XOR:
+ // The input may have strange things in the top bits of the registers, but
+ // these operations don't care. They may have weird bits going out, but
+ // that too is okay if they are integer operations.
+ Tmp1 = PromoteOp(Node->getOperand(0));
+ Tmp2 = PromoteOp(Node->getOperand(1));
+ assert(Tmp1.getValueType() == NVT && Tmp2.getValueType() == NVT);
+ Result = DAG.getNode(Node->getOpcode(), NVT, Tmp1, Tmp2);
+ break;
case ISD::ADD:
case ISD::SUB:
case ISD::MUL:
More information about the llvm-commits
mailing list