mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-16 16:37:30 +00:00
Compile CodeGen/X86/lea-3.ll:test2 to:
_test3: leaq (,%rdi,4), %rax orq %rdi, %rax ret instead of: _test2: movq %rdi, %rax shlq $2, %rax orq %rdi, %rax ret git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35434 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
57b82b7845
commit
995f55036f
@ -149,6 +149,19 @@ X86InstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI,
|
||||
NewMI = BuildMI(get(X86::PSHUFDri), A).addReg(B).addImm(M);
|
||||
break;
|
||||
}
|
||||
case X86::SHL64ri: {
|
||||
assert(MI->getNumOperands() == 3 && "Unknown shift instruction!");
|
||||
// NOTE: LEA doesn't produce flags like shift does, but LLVM never uses
|
||||
// the flags produced by a shift yet, so this is safe.
|
||||
unsigned Dest = MI->getOperand(0).getReg();
|
||||
unsigned Src = MI->getOperand(1).getReg();
|
||||
unsigned ShAmt = MI->getOperand(2).getImm();
|
||||
if (ShAmt == 0 || ShAmt >= 4) return 0;
|
||||
|
||||
NewMI = BuildMI(get(X86::LEA64r), Dest)
|
||||
.addReg(0).addImm(1 << ShAmt).addReg(Src).addImm(0);
|
||||
break;
|
||||
}
|
||||
case X86::SHL32ri: {
|
||||
assert(MI->getNumOperands() == 3 && "Unknown shift instruction!");
|
||||
// NOTE: LEA doesn't produce flags like shift does, but LLVM never uses
|
||||
|
Loading…
Reference in New Issue
Block a user