mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
[x86] Add PUSHA16,POPA16 instructions, and fix aliases for 16-bit mode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198753 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a493812047
commit
1a19e26276
@ -974,13 +974,17 @@ def PUSHF64 : I<0x9C, RawFrm, (outs), (ins), "pushfq", [], IIC_PUSH_F>,
|
||||
|
||||
let Defs = [EDI, ESI, EBP, EBX, EDX, ECX, EAX, ESP], Uses = [ESP],
|
||||
mayLoad = 1, neverHasSideEffects = 1, SchedRW = [WriteLoad] in {
|
||||
def POPA32 : I<0x61, RawFrm, (outs), (ins), "popa{l}", [], IIC_POP_A>,
|
||||
def POPA32 : I<0x61, RawFrm, (outs), (ins), "popal", [], IIC_POP_A>,
|
||||
OpSize16, Requires<[Not64BitMode]>;
|
||||
def POPA16 : I<0x61, RawFrm, (outs), (ins), "popaw", [], IIC_POP_A>,
|
||||
OpSize, Requires<[Not64BitMode]>;
|
||||
}
|
||||
let Defs = [ESP], Uses = [EDI, ESI, EBP, EBX, EDX, ECX, EAX, ESP],
|
||||
mayStore = 1, neverHasSideEffects = 1, SchedRW = [WriteStore] in {
|
||||
def PUSHA32 : I<0x60, RawFrm, (outs), (ins), "pusha{l}", [], IIC_PUSH_A>,
|
||||
def PUSHA32 : I<0x60, RawFrm, (outs), (ins), "pushal", [], IIC_PUSH_A>,
|
||||
OpSize16, Requires<[Not64BitMode]>;
|
||||
def PUSHA16 : I<0x60, RawFrm, (outs), (ins), "pushaw", [], IIC_PUSH_A>,
|
||||
OpSize, Requires<[Not64BitMode]>;
|
||||
}
|
||||
|
||||
let Constraints = "$src = $dst", SchedRW = [WriteALU] in {
|
||||
@ -2143,23 +2147,36 @@ def : MnemonicAlias<"leaveq", "leave", "att">, Requires<[In64BitMode]>;
|
||||
def : MnemonicAlias<"loopz", "loope", "att">;
|
||||
def : MnemonicAlias<"loopnz", "loopne", "att">;
|
||||
|
||||
def : MnemonicAlias<"pop", "popl", "att">, Requires<[Not64BitMode]>;
|
||||
def : MnemonicAlias<"pop", "popw", "att">, Requires<[In16BitMode]>;
|
||||
def : MnemonicAlias<"pop", "popl", "att">, Requires<[In32BitMode]>;
|
||||
def : MnemonicAlias<"pop", "popq", "att">, Requires<[In64BitMode]>;
|
||||
def : MnemonicAlias<"popf", "popfl", "att">, Requires<[Not64BitMode]>;
|
||||
def : MnemonicAlias<"popf", "popfw", "att">, Requires<[In16BitMode]>;
|
||||
def : MnemonicAlias<"popf", "popfl", "att">, Requires<[In32BitMode]>;
|
||||
def : MnemonicAlias<"popf", "popfq", "att">, Requires<[In64BitMode]>;
|
||||
def : MnemonicAlias<"popfd", "popfl", "att">;
|
||||
|
||||
// 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
|
||||
// pushl/pushq depending on the current mode. Similar for "pop %bx"
|
||||
def : MnemonicAlias<"push", "pushl", "att">, Requires<[Not64BitMode]>;
|
||||
def : MnemonicAlias<"push", "pushw", "att">, Requires<[In16BitMode]>;
|
||||
def : MnemonicAlias<"push", "pushl", "att">, Requires<[In32BitMode]>;
|
||||
def : MnemonicAlias<"push", "pushq", "att">, Requires<[In64BitMode]>;
|
||||
def : MnemonicAlias<"pushf", "pushfl", "att">, Requires<[Not64BitMode]>;
|
||||
def : MnemonicAlias<"pushf", "pushfw", "att">, Requires<[In16BitMode]>;
|
||||
def : MnemonicAlias<"pushf", "pushfl", "att">, Requires<[In32BitMode]>;
|
||||
def : MnemonicAlias<"pushf", "pushfq", "att">, Requires<[In64BitMode]>;
|
||||
def : MnemonicAlias<"pushfd", "pushfl", "att">;
|
||||
|
||||
def : MnemonicAlias<"popad", "popa", "intel">, Requires<[Not64BitMode]>;
|
||||
def : MnemonicAlias<"pushad", "pusha", "intel">, Requires<[Not64BitMode]>;
|
||||
def : MnemonicAlias<"popad", "popal", "intel">, Requires<[Not64BitMode]>;
|
||||
def : MnemonicAlias<"pushad", "pushal", "intel">, Requires<[Not64BitMode]>;
|
||||
def : MnemonicAlias<"popa", "popaw", "intel">, Requires<[In16BitMode]>;
|
||||
def : MnemonicAlias<"pusha", "pushaw", "intel">, Requires<[In16BitMode]>;
|
||||
def : MnemonicAlias<"popa", "popal", "intel">, Requires<[In32BitMode]>;
|
||||
def : MnemonicAlias<"pusha", "pushal", "intel">, Requires<[In32BitMode]>;
|
||||
|
||||
def : MnemonicAlias<"popa", "popaw", "att">, Requires<[In16BitMode]>;
|
||||
def : MnemonicAlias<"pusha", "pushaw", "att">, Requires<[In16BitMode]>;
|
||||
def : MnemonicAlias<"popa", "popal", "att">, Requires<[In32BitMode]>;
|
||||
def : MnemonicAlias<"pusha", "pushal", "att">, Requires<[In32BitMode]>;
|
||||
|
||||
def : MnemonicAlias<"repe", "rep", "att">;
|
||||
def : MnemonicAlias<"repz", "rep", "att">;
|
||||
|
@ -62,8 +62,12 @@ int $255
|
||||
// CHECK: int $255
|
||||
// CHECK: encoding: [0xcd,0xff]
|
||||
|
||||
// CHECK: pushfw # encoding: [0x9c]
|
||||
pushf
|
||||
// CHECK: pushfl # encoding: [0x66,0x9c]
|
||||
pushfl
|
||||
// CHECK: popfw # encoding: [0x9d]
|
||||
popf
|
||||
// CHECK: popfl # encoding: [0x66,0x9d]
|
||||
popfl
|
||||
|
||||
@ -311,6 +315,22 @@ cmovnae %bx,%bx
|
||||
// CHECK: encoding: [0x9b]
|
||||
fwait
|
||||
|
||||
// CHECK: pusha
|
||||
// CHECK: encoding: [0x60]
|
||||
pusha
|
||||
|
||||
// CHECK: popa
|
||||
// CHECK: encoding: [0x61]
|
||||
popa
|
||||
|
||||
// CHECK: pushaw
|
||||
// CHECK: encoding: [0x60]
|
||||
pushaw
|
||||
|
||||
// CHECK: popaw
|
||||
// CHECK: encoding: [0x61]
|
||||
popaw
|
||||
|
||||
// CHECK: pushal
|
||||
// CHECK: encoding: [0x66,0x60]
|
||||
pushal
|
||||
@ -341,6 +361,25 @@ testl -24(%ebp), %ecx
|
||||
// CHECK: testl -24(%ebp), %ecx
|
||||
|
||||
|
||||
push %cs
|
||||
// CHECK: pushw %cs
|
||||
// CHECK: encoding: [0x0e]
|
||||
push %ds
|
||||
// CHECK: pushw %ds
|
||||
// CHECK: encoding: [0x1e]
|
||||
push %ss
|
||||
// CHECK: pushw %ss
|
||||
// CHECK: encoding: [0x16]
|
||||
push %es
|
||||
// CHECK: pushw %es
|
||||
// CHECK: encoding: [0x06]
|
||||
push %fs
|
||||
// CHECK: pushw %fs
|
||||
// CHECK: encoding: [0x0f,0xa0]
|
||||
push %gs
|
||||
// CHECK: pushw %gs
|
||||
// CHECK: encoding: [0x0f,0xa8]
|
||||
|
||||
pushw %cs
|
||||
// CHECK: pushw %cs
|
||||
// CHECK: encoding: [0x0e]
|
||||
@ -379,6 +418,16 @@ pushl %gs
|
||||
// CHECK: pushl %gs
|
||||
// CHECK: encoding: [0x66,0x0f,0xa8]
|
||||
|
||||
pop %ss
|
||||
// CHECK: popw %ss
|
||||
// CHECK: encoding: [0x17]
|
||||
pop %ds
|
||||
// CHECK: popw %ds
|
||||
// CHECK: encoding: [0x1f]
|
||||
pop %es
|
||||
// CHECK: popw %es
|
||||
// CHECK: encoding: [0x07]
|
||||
|
||||
popl %ss
|
||||
// CHECK: popl %ss
|
||||
// CHECK: encoding: [0x66,0x17]
|
||||
|
@ -442,14 +442,22 @@ cmovnae %bx,%bx
|
||||
// FIXME: This is a correct bug poor encoding: Use 65 a1 7c 00 00 00
|
||||
movl %gs:124, %eax
|
||||
|
||||
// CHECK: pusha
|
||||
// CHECK: pushal
|
||||
// CHECK: encoding: [0x60]
|
||||
pusha
|
||||
|
||||
// CHECK: popa
|
||||
// CHECK: popal
|
||||
// CHECK: encoding: [0x61]
|
||||
popa
|
||||
|
||||
// CHECK: pushaw
|
||||
// CHECK: encoding: [0x66,0x60]
|
||||
pushaw
|
||||
|
||||
// CHECK: popaw
|
||||
// CHECK: encoding: [0x66,0x61]
|
||||
popaw
|
||||
|
||||
// CHECK: pushal
|
||||
// CHECK: encoding: [0x60]
|
||||
pushal
|
||||
|
Loading…
Reference in New Issue
Block a user