X86: add alias for pushfw/popfw in Intel mode

A while ago we changed pushf and popf in Intel mode to generate pushfq
and popfq. Unfortunately that left us with no way to get the 16-bit
encoding in Intel mode so this patch adds pushfw and popfw as aliases
there.

llvm-svn: 344949
This commit is contained in:
Tim Northover 2018-10-22 20:38:13 +00:00
parent e94d8823d9
commit a23c12a627
2 changed files with 9 additions and 0 deletions

View File

@ -2966,6 +2966,8 @@ def : MnemonicAlias<"popf", "popfl", "att">, Requires<[In32BitMode]>;
def : MnemonicAlias<"popf", "popfq", "att">, Requires<[In64BitMode]>;
def : MnemonicAlias<"popf", "popfq", "intel">, Requires<[In64BitMode]>;
def : MnemonicAlias<"popfd", "popfl", "att">;
def : MnemonicAlias<"popfw", "popf", "intel">, Requires<[In32BitMode]>;
def : MnemonicAlias<"popfw", "popf", "intel">, Requires<[In64BitMode]>;
// FIXME: This is wrong for "push reg". "push %bx" should turn into pushw in
// all modes. However: "push (addr)" and "push $42" should default to
@ -2978,6 +2980,8 @@ def : MnemonicAlias<"pushf", "pushfl", "att">, Requires<[In32BitMode]>;
def : MnemonicAlias<"pushf", "pushfq", "att">, Requires<[In64BitMode]>;
def : MnemonicAlias<"pushf", "pushfq", "intel">, Requires<[In64BitMode]>;
def : MnemonicAlias<"pushfd", "pushfl", "att">;
def : MnemonicAlias<"pushfw", "pushf", "intel">, Requires<[In32BitMode]>;
def : MnemonicAlias<"pushfw", "pushf", "intel">, Requires<[In64BitMode]>;
def : MnemonicAlias<"popad", "popal", "intel">, Requires<[Not64BitMode]>;
def : MnemonicAlias<"pushad", "pushal", "intel">, Requires<[Not64BitMode]>;

View File

@ -64,6 +64,11 @@
pushf
popf
// CHECK: encoding: [0x66,0x9c]
// CHECK: encoding: [0x66,0x9d]
pushfw
popfw
LBB0_3:
// CHECK: encoding: [0xeb,A]
jmp LBB0_3