From e287a0044073c94603466791194657aeba8f3501 Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Tue, 17 Feb 2004 15:14:29 +0000 Subject: [PATCH] Peephole optimize SUBmi{16,32} into SUBmi{16,32}b when immediate is 8 bits wide. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11548 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/PeepholeOptimizer.cpp | 3 +++ lib/Target/X86/X86PeepholeOpt.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/Target/X86/PeepholeOptimizer.cpp b/lib/Target/X86/PeepholeOptimizer.cpp index 27baa521e84..3e0af70717c 100644 --- a/lib/Target/X86/PeepholeOptimizer.cpp +++ b/lib/Target/X86/PeepholeOptimizer.cpp @@ -154,6 +154,7 @@ bool PH::PeepholeOptimize(MachineBasicBlock &MBB, case X86::ADDmi16: case X86::ADDmi32: + case X86::SUBmi16: case X86::SUBmi32: case X86::ANDmi16: case X86::ANDmi32: assert(MI->getNumOperands() == 5 && "These should all have 5 operands!"); if (MI->getOperand(4).isImmediate()) { @@ -165,6 +166,8 @@ bool PH::PeepholeOptimize(MachineBasicBlock &MBB, default: assert(0 && "Unknown opcode value!"); case X86::ADDmi16: Opcode = X86::ADDmi16b; break; case X86::ADDmi32: Opcode = X86::ADDmi32b; break; + case X86::SUBmi16: Opcode = X86::SUBmi16b; break; + case X86::SUBmi32: Opcode = X86::SUBmi32b; break; case X86::ANDmi16: Opcode = X86::ANDmi16b; break; case X86::ANDmi32: Opcode = X86::ANDmi32b; break; } diff --git a/lib/Target/X86/X86PeepholeOpt.cpp b/lib/Target/X86/X86PeepholeOpt.cpp index 27baa521e84..3e0af70717c 100644 --- a/lib/Target/X86/X86PeepholeOpt.cpp +++ b/lib/Target/X86/X86PeepholeOpt.cpp @@ -154,6 +154,7 @@ bool PH::PeepholeOptimize(MachineBasicBlock &MBB, case X86::ADDmi16: case X86::ADDmi32: + case X86::SUBmi16: case X86::SUBmi32: case X86::ANDmi16: case X86::ANDmi32: assert(MI->getNumOperands() == 5 && "These should all have 5 operands!"); if (MI->getOperand(4).isImmediate()) { @@ -165,6 +166,8 @@ bool PH::PeepholeOptimize(MachineBasicBlock &MBB, default: assert(0 && "Unknown opcode value!"); case X86::ADDmi16: Opcode = X86::ADDmi16b; break; case X86::ADDmi32: Opcode = X86::ADDmi32b; break; + case X86::SUBmi16: Opcode = X86::SUBmi16b; break; + case X86::SUBmi32: Opcode = X86::SUBmi32b; break; case X86::ANDmi16: Opcode = X86::ANDmi16b; break; case X86::ANDmi32: Opcode = X86::ANDmi32b; break; }