aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-12-11 21:31:27 +0000
committerDan Gohman <gohman@apple.com>2009-12-11 21:31:27 +0000
commit87862e77bbf90cf1b68c9eea1f3641ad81435e38 (patch)
treedaf3f31f6a1a8732160f7fd891a085a53a783f6f /lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
parentc8f9e4fdc584c6bf48dc0f42083d05b707024b20 (diff)
Implement vector widening, splitting, and scalarizing for SIGN_EXTEND_INREG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91158 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 3e2ab2c4ab..31b2a47f8f 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -2294,9 +2294,16 @@ void SelectionDAGLegalize::ExpandNode(SDNode *Node,
// NOTE: we could fall back on load/store here too for targets without
// SAR. However, it is doubtful that any exist.
EVT ExtraVT = cast<VTSDNode>(Node->getOperand(1))->getVT();
- unsigned BitsDiff = Node->getValueType(0).getSizeInBits() -
+ EVT VT = Node->getValueType(0);
+ EVT ShiftAmountTy = TLI.getShiftAmountTy();
+ if (ExtraVT.isVector()) ExtraVT = ExtraVT.getVectorElementType();
+ if (VT.isVector()) {
+ ShiftAmountTy = VT;
+ VT = VT.getVectorElementType();
+ }
+ unsigned BitsDiff = VT.getSizeInBits() -
ExtraVT.getSizeInBits();
- SDValue ShiftCst = DAG.getConstant(BitsDiff, TLI.getShiftAmountTy());
+ SDValue ShiftCst = DAG.getConstant(BitsDiff, ShiftAmountTy);
Tmp1 = DAG.getNode(ISD::SHL, dl, Node->getValueType(0),
Node->getOperand(0), ShiftCst);
Tmp1 = DAG.getNode(ISD::SRA, dl, Node->getValueType(0), Tmp1, ShiftCst);