diff options
| author | Duncan Sands <baldrick@free.fr> | 2008-07-11 16:54:57 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2008-07-11 16:54:57 +0000 |
| commit | d9948110a66af052cd386ed5dc6349949dcd283d (patch) | |
| tree | 208d0a29e4653d814554919c245a9edf1dc51a1b /llvm/lib | |
| parent | 927a3648d5b2a2fb44a69c88b3daa5ba146027de (diff) | |
| download | bcm5719-llvm-d9948110a66af052cd386ed5dc6349949dcd283d.tar.gz bcm5719-llvm-d9948110a66af052cd386ed5dc6349949dcd283d.zip | |
Port a shift-by-1 optimization from LegalizeDAG: it
was presumably added after the rest of the code was
copied to LegalizeTypes.
llvm-svn: 53459
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp index a1840f130fc..4e3e21732b9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp @@ -1556,6 +1556,13 @@ void DAGTypeLegalizer::ExpandShiftByConstant(SDNode *N, unsigned Amt, } else if (Amt == NVTBits) { Lo = DAG.getConstant(0, NVT); Hi = InL; + } else if (Amt == 1) { + // Emit this X << 1 as X+X. + SDVTList VTList = DAG.getVTList(NVT, MVT::Flag); + SDOperand LoOps[2] = { InL, InL }; + Lo = DAG.getNode(ISD::ADDC, VTList, LoOps, 2); + SDOperand HiOps[3] = { InH, InH, Lo.getValue(1) }; + Hi = DAG.getNode(ISD::ADDE, VTList, HiOps, 3); } else { Lo = DAG.getNode(ISD::SHL, NVT, InL, DAG.getConstant(Amt, ShTy)); Hi = DAG.getNode(ISD::OR, NVT, |

