diff options
author | David Woodhouse <dwmw2@infradead.org> | 2014-01-08 12:58:32 +0000 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2014-01-08 12:58:32 +0000 |
commit | 2634d1f6da25827035b2c71fb8b5c744da5b3872 (patch) | |
tree | e52aa013f5f71849b77dc547c6075690557c9e94 | |
parent | ab5b9489e9e91ef21d9cebf5cf9453d2e9fce1d7 (diff) | |
download | llvm-2634d1f6da25827035b2c71fb8b5c744da5b3872.tar.gz llvm-2634d1f6da25827035b2c71fb8b5c744da5b3872.tar.bz2 llvm-2634d1f6da25827035b2c71fb8b5c744da5b3872.tar.xz |
[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
-rw-r--r-- | lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp | 6 | ||||
-rw-r--r-- | lib/Target/X86/X86InstrInfo.td | 5 | ||||
-rw-r--r-- | test/MC/X86/relax-insn.s | 5 |
3 files changed, 12 insertions, 4 deletions
diff --git a/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp b/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp index 2cf6381198..dfd8a658bd 100644 --- a/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp +++ b/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp @@ -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; } } diff --git a/lib/Target/X86/X86InstrInfo.td b/lib/Target/X86/X86InstrInfo.td index b495564666..bfa59ea9df 100644 --- a/lib/Target/X86/X86InstrInfo.td +++ b/lib/Target/X86/X86InstrInfo.td @@ -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), diff --git a/test/MC/X86/relax-insn.s b/test/MC/X86/relax-insn.s new file mode 100644 index 0000000000..510766c828 --- /dev/null +++ b/test/MC/X86/relax-insn.s @@ -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 |