0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-07-24 10:25:42 -04:00

insns: fix MOVBE CPUID flag, BSWAP 16-bit XCHG patterns

Add the MOVBE CPUID flag, add helper patterns for 16-bit BSWAP
emulation. Unfortunately using ROL/ROR for registers other than the
ones for which XCHG can work clobbers the flags.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2024-08-22 23:32:42 -07:00
parent 2b2f1fc98a
commit ecbd1c81b3
2 changed files with 13 additions and 9 deletions

View File

@ -161,9 +161,11 @@ if_("MONITORX", "MONITORX and MWAITX");
if_("WAITPKG", "User wait instruction package");
# Single-instruction CPUID bits without additional help text
foreach my $ins (qw(invpcid prefetchwt1 pconfig wbnoinvd serialize lkgs
wrmsrns clflushopt clwb rdrand rdseed rdpid
lzcnt ptwrite cldemote movdiri movdir64b clzero)) {
my @oneins = qw(invpcid prefetchwt1 pconfig wbnoinvd serialize lkgs
wrmsrns clflushopt clwb rdrand rdseed rdpid
lzcnt ptwrite cldemote movdiri movdir64b clzero
movbe);
foreach my $ins (@oneins) {
if_($ins, "\U$ins\E instruction");
}

View File

@ -192,12 +192,14 @@ AAS void [ 3f] 8086,NOLONG
DAA void [ 27] 8086,NOLONG
DAS void [ 2f] 8086,NOLONG
; ---
;# Endianness instructions
$wdq BSWAP reg# [r: o# 0f c8+r] 486,(w:UNDOC)
$wdq MOVBE reg#,mem# [rm: o# norep 0f38 f0 /r] NEHALEM,SM
$wdq MOVBE mem#,reg# [mr: o# norep 0f38 f1 /r] NEHALEM,SM
;# Endianness handling
$dq BSWAP reg# [r: o# 0f c8+r] 486
BSWAP reg_ax [-: 86 c4] 8086,OPT,ND
BSWAP reg_cx [-: 86 cd] 8086,OPT,ND
BSWAP reg_dx [-: 86 d6] 8086,OPT,ND
BSWAP reg_bx [-: 86 df] 8086,OPT,ND
$wdq MOVBE reg#,mem# [rm: o# norep 0f38 f0 /r] NEHALEM,MOVBE,SM
$wdq MOVBE mem#,reg# [mr: o# norep 0f38 f1 /r] NEHALEM,MOVBE,SM
;# Sign and zero extension
CBW void [ o16 98] 8086