summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-04-02 05:06:04 +0000
committerChris Lattner <sabre@nondot.org>2006-04-02 05:06:04 +0000
commit42a5fca47e8009e7c82ec8e41d6252a757f40c8c (patch)
treebbd4d2a5bc5647d369a234aedf759cb537fc099e /llvm/lib
parentb80f1147072cf4a30d9907e412174f5eb759a9f1 (diff)
downloadbcm5719-llvm-42a5fca47e8009e7c82ec8e41d6252a757f40c8c.tar.gz
bcm5719-llvm-42a5fca47e8009e7c82ec8e41d6252a757f40c8c.zip
Implement promotion for EXTRACT_VECTOR_ELT, allowing v16i8 multiplies to work with PowerPC.
llvm-svn: 27349
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp43
1 files changed, 27 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 27afe117e6f..3583e9e14a1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -194,6 +194,7 @@ private:
SDOperand &Lo, SDOperand &Hi);
SDOperand LowerVEXTRACT_VECTOR_ELT(SDOperand Op);
+ SDOperand ExpandEXTRACT_VECTOR_ELT(SDOperand Op);
SDOperand getIntPtrConstant(uint64_t Val) {
return DAG.getConstant(Val, TLI.getPointerTy());
@@ -901,24 +902,10 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
break;
}
// FALLTHROUGH
- case TargetLowering::Expand: {
- // If the target doesn't support this, store the value to a temporary
- // stack slot, then LOAD the scalar element back out.
- SDOperand StackPtr = CreateStackTemporary(Tmp1.getValueType());
- SDOperand Ch = DAG.getNode(ISD::STORE, MVT::Other, DAG.getEntryNode(),
- Tmp1, StackPtr, DAG.getSrcValue(NULL));
-
- // Add the offset to the index.
- unsigned EltSize = MVT::getSizeInBits(Result.getValueType())/8;
- Tmp2 = DAG.getNode(ISD::MUL, Tmp2.getValueType(), Tmp2,
- DAG.getConstant(EltSize, Tmp2.getValueType()));
- StackPtr = DAG.getNode(ISD::ADD, Tmp2.getValueType(), Tmp2, StackPtr);
-
- Result = DAG.getLoad(Result.getValueType(), Ch, StackPtr,
- DAG.getSrcValue(NULL));
+ case TargetLowering::Expand:
+ Result = ExpandEXTRACT_VECTOR_ELT(Result);
break;
}
- }
break;
case ISD::VEXTRACT_VECTOR_ELT:
@@ -2990,6 +2977,9 @@ SDOperand SelectionDAGLegalize::PromoteOp(SDOperand Op) {
case ISD::VEXTRACT_VECTOR_ELT:
Result = PromoteOp(LowerVEXTRACT_VECTOR_ELT(Op));
break;
+ case ISD::EXTRACT_VECTOR_ELT:
+ Result = PromoteOp(ExpandEXTRACT_VECTOR_ELT(Op));
+ break;
}
assert(Result.Val && "Didn't set a result!");
@@ -3048,6 +3038,27 @@ SDOperand SelectionDAGLegalize::LowerVEXTRACT_VECTOR_ELT(SDOperand Op) {
}
}
+/// ExpandEXTRACT_VECTOR_ELT - Expand an EXTRACT_VECTOR_ELT operation into
+/// memory traffic.
+SDOperand SelectionDAGLegalize::ExpandEXTRACT_VECTOR_ELT(SDOperand Op) {
+ SDOperand Vector = Op.getOperand(0);
+ SDOperand Idx = Op.getOperand(1);
+
+ // If the target doesn't support this, store the value to a temporary
+ // stack slot, then LOAD the scalar element back out.
+ SDOperand StackPtr = CreateStackTemporary(Vector.getValueType());
+ SDOperand Ch = DAG.getNode(ISD::STORE, MVT::Other, DAG.getEntryNode(),
+ Vector, StackPtr, DAG.getSrcValue(NULL));
+
+ // Add the offset to the index.
+ unsigned EltSize = MVT::getSizeInBits(Op.getValueType())/8;
+ Idx = DAG.getNode(ISD::MUL, Idx.getValueType(), Idx,
+ DAG.getConstant(EltSize, Idx.getValueType()));
+ StackPtr = DAG.getNode(ISD::ADD, Idx.getValueType(), Idx, StackPtr);
+
+ return DAG.getLoad(Op.getValueType(), Ch, StackPtr, DAG.getSrcValue(NULL));
+}
+
/// LegalizeSetCCOperands - Attempts to create a legal LHS and RHS for a SETCC
/// with condition CC on the current target. This usually involves legalizing
OpenPOWER on IntegriCloud