summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-05-17 18:16:39 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-05-17 18:16:39 +0000
commit6c43f35d740ccd1d746be90d98ee11f8829fe543 (patch)
tree0f476283cc40c65a252f6857d9f29828c793d272 /lib/CodeGen/SelectionDAG
parente9b3da17cdc5b54bb1194043f27d4d2914d77097 (diff)
downloadllvm-6c43f35d740ccd1d746be90d98ee11f8829fe543.tar.gz
llvm-6c43f35d740ccd1d746be90d98ee11f8829fe543.tar.bz2
llvm-6c43f35d740ccd1d746be90d98ee11f8829fe543.tar.xz
Fixed a LowerCallTo and LowerArguments bug. They were introducing illegal
VBIT_VECTOR nodes. There were some confusion about the semantics of getPackedTypeBreakdown(). e.g. for <4 x f32> it returns 1 and v4f32, not 4, and f32. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28352 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp39
1 files changed, 27 insertions, 12 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index bddaa904aa..e1d4d8e1e6 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -2455,20 +2455,25 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
// Figure out if there is a Packed type corresponding to this Vector
// type. If so, convert to the packed type.
+ bool Supported = false;
MVT::ValueType TVT = MVT::getVectorType(getValueType(EltTy), NumElems);
- if (TVT != MVT::Other && isTypeLegal(TVT)) {
+ if (TVT != MVT::Other) {
SDOperand N = SDOperand(Result, i++);
// Handle copies from generic vectors to registers.
MVT::ValueType PTyElementVT, PTyLegalElementVT;
unsigned NE = getPackedTypeBreakdown(PTy, PTyElementVT,
PTyLegalElementVT);
- // Insert a VBIT_CONVERT of the FORMAL_ARGUMENTS to a
- // "N x PTyElementVT" MVT::Vector type.
- N = DAG.getNode(ISD::VBIT_CONVERT, MVT::Vector, N,
- DAG.getConstant(NE, MVT::i32),
- DAG.getValueType(PTyElementVT));
- Ops.push_back(N);
- } else {
+ // FIXME: handle NE > 1 cases.
+ if (NE == 1) {
+ N = DAG.getNode(ISD::VBIT_CONVERT, MVT::Vector, N,
+ DAG.getConstant(NumElems, MVT::i32),
+ DAG.getValueType(getValueType(EltTy)));
+ Ops.push_back(N);
+ Supported = true;
+ }
+ }
+
+ if (!Supported) {
assert(0 && "Don't support illegal by-val vector arguments yet!");
abort();
}
@@ -2546,15 +2551,25 @@ TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy, bool isVarArg,
// Figure out if there is a Packed type corresponding to this Vector
// type. If so, convert to the packed type.
+ bool Supported = false;
MVT::ValueType TVT = MVT::getVectorType(getValueType(EltTy), NumElems);
- if (TVT != MVT::Other && isTypeLegal(TVT)) {
+ if (TVT != MVT::Other) {
// Handle copies from generic vectors to registers.
MVT::ValueType PTyElementVT, PTyLegalElementVT;
unsigned NE = getPackedTypeBreakdown(PTy, PTyElementVT,
PTyLegalElementVT);
- // Insert a VBIT_CONVERT of the MVT::Vector type to the packed type.
- Ops.push_back(DAG.getNode(ISD::VBIT_CONVERT, TVT, Op));
- } else {
+ // FIXME: handle NE > 1 cases.
+ if (NE == 1) {
+ // Insert a VBIT_CONVERT of the MVT::Vector type to the packed type.
+ Op = DAG.getNode(ISD::VBIT_CONVERT, MVT::Vector, Op,
+ DAG.getConstant(NumElems, MVT::i32),
+ DAG.getValueType(getValueType(EltTy)));
+ Ops.push_back(Op);
+ Supported = true;
+ }
+ }
+
+ if (!Supported) {
assert(0 && "Don't support illegal by-val vector call args yet!");
abort();
}