summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-31 19:01:53 +0000
committerChris Lattner <sabre@nondot.org>2005-08-31 19:01:53 +0000
commit8a1a5f2818ddcadccdfcdf6afc29fa963462f855 (patch)
treee5781d5242810da048bfc9607904df8b49345b61 /llvm/lib
parent0e6b11da03f94db195c332f429cce10f4217c32a (diff)
downloadbcm5719-llvm-8a1a5f2818ddcadccdfcdf6afc29fa963462f855.tar.gz
bcm5719-llvm-8a1a5f2818ddcadccdfcdf6afc29fa963462f855.zip
Allow targets to custom expand shifts that are too large for their registers
llvm-svn: 23173
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 758fd2de8d6..d1417de951a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -3101,6 +3101,19 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
break;
case ISD::SHL:
+ // If the target wants custom lowering, do so.
+ if (TLI.getOperationAction(ISD::SHL, VT) == TargetLowering::Custom) {
+ SDOperand Op = DAG.getNode(ISD::SHL, VT, Node->getOperand(0),
+ LegalizeOp(Node->getOperand(1)));
+ Op = TLI.LowerOperation(Op, DAG);
+ if (Op.Val) {
+ // Now that the custom expander is done, expand the result, which is
+ // still VT.
+ ExpandOp(Op, Lo, Hi);
+ break;
+ }
+ }
+
// If we can emit an efficient shift operation, do so now.
if (ExpandShift(ISD::SHL, Node->getOperand(0), Node->getOperand(1), Lo, Hi))
break;
@@ -3117,6 +3130,19 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
break;
case ISD::SRA:
+ // If the target wants custom lowering, do so.
+ if (TLI.getOperationAction(ISD::SRA, VT) == TargetLowering::Custom) {
+ SDOperand Op = DAG.getNode(ISD::SRA, VT, Node->getOperand(0),
+ LegalizeOp(Node->getOperand(1)));
+ Op = TLI.LowerOperation(Op, DAG);
+ if (Op.Val) {
+ // Now that the custom expander is done, expand the result, which is
+ // still VT.
+ ExpandOp(Op, Lo, Hi);
+ break;
+ }
+ }
+
// If we can emit an efficient shift operation, do so now.
if (ExpandShift(ISD::SRA, Node->getOperand(0), Node->getOperand(1), Lo, Hi))
break;
@@ -3132,6 +3158,19 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
Lo = ExpandLibCall("__ashrdi3", Node, Hi);
break;
case ISD::SRL:
+ // If the target wants custom lowering, do so.
+ if (TLI.getOperationAction(ISD::SRL, VT) == TargetLowering::Custom) {
+ SDOperand Op = DAG.getNode(ISD::SRL, VT, Node->getOperand(0),
+ LegalizeOp(Node->getOperand(1)));
+ Op = TLI.LowerOperation(Op, DAG);
+ if (Op.Val) {
+ // Now that the custom expander is done, expand the result, which is
+ // still VT.
+ ExpandOp(Op, Lo, Hi);
+ break;
+ }
+ }
+
// If we can emit an efficient shift operation, do so now.
if (ExpandShift(ISD::SRL, Node->getOperand(0), Node->getOperand(1), Lo, Hi))
break;
OpenPOWER on IntegriCloud