[x86] Do not relax PUSHi16 to PUSHi32 (PR18414)

They do *different* things to %esp, so they are not equivalent.

Rename PUSHi8 to PUSH32i8 and add the missing PUSH16i8.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198761 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Woodhouse 2014-01-08 12:58:32 +00:00
parent ab5b9489e9
commit 2634d1f6da
3 changed files with 12 additions and 4 deletions

View File

@ -217,9 +217,9 @@ static unsigned getRelaxedOpcodeArith(unsigned Op) {
case X86::CMP64mi8: return X86::CMP64mi32;
// PUSH
case X86::PUSHi8: return X86::PUSHi32;
case X86::PUSHi16: return X86::PUSHi32;
case X86::PUSH64i8: return X86::PUSH64i32;
case X86::PUSH32i8: return X86::PUSHi32;
case X86::PUSH16i8: return X86::PUSHi16;
case X86::PUSH64i8: return X86::PUSH64i32;
case X86::PUSH64i16: return X86::PUSH64i32;
}
}

View File

@ -917,7 +917,10 @@ def PUSH32rmr: I<0xFF, MRM6r, (outs), (ins GR32:$reg), "push{l}\t$reg",[],
def PUSH32rmm: I<0xFF, MRM6m, (outs), (ins i32mem:$src), "push{l}\t$src",[],
IIC_PUSH_MEM>, OpSize16, Requires<[Not64BitMode]>;
def PUSHi8 : Ii8<0x6a, RawFrm, (outs), (ins i32i8imm:$imm),
def PUSH16i8 : Ii8<0x6a, RawFrm, (outs), (ins i16i8imm:$imm),
"push{w}\t$imm", [], IIC_PUSH_IMM>, OpSize,
Requires<[Not64BitMode]>;
def PUSH32i8 : Ii8<0x6a, RawFrm, (outs), (ins i32i8imm:$imm),
"push{l}\t$imm", [], IIC_PUSH_IMM>, OpSize16,
Requires<[Not64BitMode]>;
def PUSHi16 : Ii16<0x68, RawFrm, (outs), (ins i16imm:$imm),

5
test/MC/X86/relax-insn.s Normal file
View File

@ -0,0 +1,5 @@
// RUN: llvm-mc -filetype=obj -triple i386-pc-linux-gnu %s -o %t
// RUN: llvm-objdump -d %t | FileCheck %s
.global foo
pushw $foo // CHECK: pushw