Index: llvm/lib/Target/X86/X86InstrInfo.td =================================================================== --- llvm/lib/Target/X86/X86InstrInfo.td +++ llvm/lib/Target/X86/X86InstrInfo.td @@ -2973,6 +2973,8 @@ 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 @@ -2985,6 +2987,8 @@ 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]>; Index: llvm/test/MC/X86/intel-syntax-encoding.s =================================================================== --- llvm/test/MC/X86/intel-syntax-encoding.s +++ llvm/test/MC/X86/intel-syntax-encoding.s @@ -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