mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 20:59:51 +00:00
Port a shift-by-1 optimization from LegalizeDAG: it
was presumably added after the rest of the code was copied to LegalizeTypes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53459 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dddc6291fb
commit
edfba7e707
@ -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,
|
||||
|
5
test/CodeGen/X86/2008-07-11-SHLBy1.ll
Normal file
5
test/CodeGen/X86/2008-07-11-SHLBy1.ll
Normal file
@ -0,0 +1,5 @@
|
||||
; RUN: llvm-as < %s | llc -march=x86-64 -o - | not grep shr
|
||||
define i128 @sl(i128 %x) {
|
||||
%t = shl i128 %x, 1
|
||||
ret i128 %t
|
||||
}
|
Loading…
Reference in New Issue
Block a user