mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-28 06:29:45 +00:00
Teach mode load folding and unfolding code about CMP32ri8 and friends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104068 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2abc93d0fb
commit
f8c1ef0510
@ -2598,9 +2598,9 @@ MachineInstr* X86InstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
|
||||
switch (MI->getOpcode()) {
|
||||
default: return NULL;
|
||||
case X86::TEST8rr: NewOpc = X86::CMP8ri; break;
|
||||
case X86::TEST16rr: NewOpc = X86::CMP16ri; break;
|
||||
case X86::TEST32rr: NewOpc = X86::CMP32ri; break;
|
||||
case X86::TEST64rr: NewOpc = X86::CMP64ri32; break;
|
||||
case X86::TEST16rr: NewOpc = X86::CMP16ri8; break;
|
||||
case X86::TEST32rr: NewOpc = X86::CMP32ri8; break;
|
||||
case X86::TEST64rr: NewOpc = X86::CMP64ri8; break;
|
||||
}
|
||||
// Change to CMPXXri r, 0 first.
|
||||
MI->setDesc(get(NewOpc));
|
||||
@ -2808,16 +2808,22 @@ bool X86InstrInfo::unfoldMemoryOperand(MachineFunction &MF, MachineInstr *MI,
|
||||
switch (DataMI->getOpcode()) {
|
||||
default: break;
|
||||
case X86::CMP64ri32:
|
||||
case X86::CMP64ri8:
|
||||
case X86::CMP32ri:
|
||||
case X86::CMP32ri8:
|
||||
case X86::CMP16ri:
|
||||
case X86::CMP16ri8:
|
||||
case X86::CMP8ri: {
|
||||
MachineOperand &MO0 = DataMI->getOperand(0);
|
||||
MachineOperand &MO1 = DataMI->getOperand(1);
|
||||
if (MO1.getImm() == 0) {
|
||||
switch (DataMI->getOpcode()) {
|
||||
default: break;
|
||||
case X86::CMP64ri8:
|
||||
case X86::CMP64ri32: NewOpc = X86::TEST64rr; break;
|
||||
case X86::CMP32ri8:
|
||||
case X86::CMP32ri: NewOpc = X86::TEST32rr; break;
|
||||
case X86::CMP16ri8:
|
||||
case X86::CMP16ri: NewOpc = X86::TEST16rr; break;
|
||||
case X86::CMP8ri: NewOpc = X86::TEST8rr; break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user