When converting a test to a cmp to fold a load, use the cmp that has an

8-bit immediate field rather than one with a wider immediate field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104064 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2010-05-18 21:42:03 +00:00
parent b4e876e37e
commit e5efbafdac
2 changed files with 71 additions and 3 deletions
+3 -3
View File
@@ -2529,9 +2529,9 @@ MachineInstr* X86InstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
switch (MI->getOpcode()) {
default: return NULL;
case X86::TEST8rr: NewOpc = X86::CMP8ri; RCSize = 1; break;
case X86::TEST16rr: NewOpc = X86::CMP16ri; RCSize = 2; break;
case X86::TEST32rr: NewOpc = X86::CMP32ri; RCSize = 4; break;
case X86::TEST64rr: NewOpc = X86::CMP64ri32; RCSize = 8; break;
case X86::TEST16rr: NewOpc = X86::CMP16ri8; RCSize = 2; break;
case X86::TEST32rr: NewOpc = X86::CMP32ri8; RCSize = 4; break;
case X86::TEST64rr: NewOpc = X86::CMP64ri8; RCSize = 8; break;
}
// Check if it's safe to fold the load. If the size of the object is
// narrower than the load width, then it's not.