mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-23 05:29:23 +00:00
This finishes the job started in r198756, and creates separate opcodes for 64-bit vs. 32-bit versions of the rest of the RET instructions too. LRETL/LRETQ are interesting... I can't see any justification for their existence in the SDM. There should be no 'LRETL' in 64-bit mode, and no need for a REX.W prefix for LRETQ. But this is what GAS does, and my Sandybridge CPU and an Opteron 6376 concur when tested as follows: asm __volatile__("pushq $0x1234\nmovq $0x33,%rax\nsalq $32,%rax\norq $1f,%rax\npushq %rax\nlretl $8\n1:"); asm __volatile__("pushq $1234\npushq $0x33\npushq $1f\nlretq $8\n1:"); asm __volatile__("pushq $0x33\npushq $1f\nlretq\n1:"); asm __volatile__("pushq $0x1234\npushq $0x33\npushq $1f\nlretq $8\n1:"); cf. PR8592 and commit r118903, which added LRETQ. I only added LRETIQ to match it. I don't quite understand how the Intel syntax parsing for ret instructions is working, despite r154468 allegedly fixing it. Aren't the explicitly sized 'retw', 'retd' and 'retq' supposed to work? I have at least made the 'lretq' work with (and indeed *require*) the 'q'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199106 91177308-0d34-0410-b5e6-96231b3b80d8
86 lines
1.9 KiB
ArmAsm
86 lines
1.9 KiB
ArmAsm
// RUN: not llvm-mc -triple x86_64-unknown-unknown --show-encoding %s 2> %t.err | FileCheck --check-prefix=64 %s
|
|
// RUN: FileCheck --check-prefix=ERR64 < %t.err %s
|
|
// RUN: not llvm-mc -triple i386-unknown-unknown --show-encoding %s 2> %t.err | FileCheck --check-prefix=32 %s
|
|
// RUN: FileCheck --check-prefix=ERR32 < %t.err %s
|
|
|
|
|
|
ret
|
|
// 64: retq
|
|
// 64: encoding: [0xc3]
|
|
// 32: retl
|
|
// 32: encoding: [0xc3]
|
|
retw
|
|
// 64: retw
|
|
// 64: encoding: [0x66,0xc3]
|
|
// 32: retw
|
|
// 32: encoding: [0x66,0xc3]
|
|
retl
|
|
// ERR64: error: instruction requires: Not 64-bit mode
|
|
// 32: retl
|
|
// 32: encoding: [0xc3]
|
|
retq
|
|
// 64: retq
|
|
// 64: encoding: [0xc3]
|
|
// ERR32: error: instruction requires: 64-bit mode
|
|
|
|
ret $0
|
|
// 64: retq $0
|
|
// 64: encoding: [0xc2,0x00,0x00]
|
|
// 32: retl $0
|
|
// 32: encoding: [0xc2,0x00,0x00]
|
|
retw $0
|
|
// 64: retw $0
|
|
// 64: encoding: [0x66,0xc2,0x00,0x00]
|
|
// 32: retw $0
|
|
// 32: encoding: [0x66,0xc2,0x00,0x00]
|
|
retl $0
|
|
// ERR64: error: instruction requires: Not 64-bit mode
|
|
// 32: retl $0
|
|
// 32: encoding: [0xc2,0x00,0x00]
|
|
retq $0
|
|
// 64: retq $0
|
|
// 64: encoding: [0xc2,0x00,0x00]
|
|
// ERR32: error: instruction requires: 64-bit mode
|
|
|
|
lret
|
|
// 64: lretl
|
|
// 64: encoding: [0xcb]
|
|
// 32: lretl
|
|
// 32: encoding: [0xcb]
|
|
lretw
|
|
// 64: lretw
|
|
// 64: encoding: [0x66,0xcb]
|
|
// 32: lretw
|
|
// 32: encoding: [0x66,0xcb]
|
|
lretl
|
|
// 64: lretl
|
|
// 64: encoding: [0xcb]
|
|
// 32: lretl
|
|
// 32: encoding: [0xcb]
|
|
lretq
|
|
// 64: lretq
|
|
// 64: encoding: [0x48,0xcb]
|
|
// ERR32: error: instruction requires: 64-bit mode
|
|
|
|
lret $0
|
|
// 64: lretl $0
|
|
// 64: encoding: [0xca,0x00,0x00]
|
|
// 32: lretl $0
|
|
// 32: encoding: [0xca,0x00,0x00]
|
|
lretw $0
|
|
// 64: lretw $0
|
|
// 64: encoding: [0x66,0xca,0x00,0x00]
|
|
// 32: lretw $0
|
|
// 32: encoding: [0x66,0xca,0x00,0x00]
|
|
lretl $0
|
|
// 64: lretl $0
|
|
// 64: encoding: [0xca,0x00,0x00]
|
|
// 32: lretl $0
|
|
// 32: encoding: [0xca,0x00,0x00]
|
|
lretq $0
|
|
// 64: lretq $0
|
|
// 64: encoding: [0x48,0xca,0x00,0x00]
|
|
// ERR32: error: instruction requires: 64-bit mode
|
|
|
|
|