mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-17 17:19:35 +08:00
Add missing IMUL pattern: reg64,imm8
Make "imul rax,byte 5" work as expected. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
37c6d166d2
commit
65feb5ae33
@ -569,6 +569,7 @@ IMUL reg32,imm8 \321\1\x6B\100\15 386
|
||||
IMUL reg32,sbyte32 \321\1\x6B\100\15 386,SM,ND
|
||||
IMUL reg32,imm32 \321\1\x69\100\41 386
|
||||
IMUL reg32,imm \321\155\x69\100\151 386,SM,ND
|
||||
IMUL reg64,imm8 \324\1\x6B\100\15 X64
|
||||
IMUL reg64,sbyte64 \324\1\x6B\100\15 X64,SM,ND
|
||||
IMUL reg64,imm32 \324\1\x69\100\255 X64
|
||||
IMUL reg64,imm \324\155\x69\100\251 X64,SM,ND
|
||||
|
89
test/imul.asm
Normal file
89
test/imul.asm
Normal file
@ -0,0 +1,89 @@
|
||||
;Testname=test; Arguments=-fbin -oimul.bin; Files=stdout stderr imul.bin
|
||||
|
||||
%macro test 1-2 5
|
||||
bits %1
|
||||
|
||||
%undef MEM
|
||||
%if %1 == 16
|
||||
%define MEM [di]
|
||||
%elif %1 == 32
|
||||
%define MEM [edi]
|
||||
%elif %1 == 64
|
||||
%define MEM [rdi]
|
||||
%endif
|
||||
|
||||
imul al
|
||||
imul byte MEM
|
||||
imul ax
|
||||
imul word MEM
|
||||
imul eax
|
||||
imul dword MEM
|
||||
%if %1 == 64
|
||||
imul rdx
|
||||
imul qword MEM
|
||||
%endif
|
||||
|
||||
imul ax,cx
|
||||
imul ax,MEM
|
||||
imul ax,word MEM
|
||||
imul eax,ecx
|
||||
imul eax,MEM
|
||||
imul eax,dword MEM
|
||||
%if %1 == 64
|
||||
imul rax,rcx
|
||||
imul rax,MEM
|
||||
imul rax,qword MEM
|
||||
%endif
|
||||
|
||||
imul ax,cx,%2
|
||||
imul ax,cx,byte %2
|
||||
imul ax,MEM,%2
|
||||
imul ax,word MEM,%2
|
||||
imul eax,ecx,%2
|
||||
imul eax,ecx,byte %2
|
||||
imul eax,MEM,%2
|
||||
imul eax,dword MEM,%2
|
||||
%if %1 == 64
|
||||
imul rax,rcx,%2
|
||||
imul rax,rcx,byte %2
|
||||
imul rax,MEM,%2
|
||||
imul rax,qword MEM,%2
|
||||
%endif
|
||||
|
||||
imul ax,%2
|
||||
imul ax,byte %2
|
||||
imul eax,%2
|
||||
imul eax,byte %2
|
||||
%if %1 == 64
|
||||
imul rax,%2
|
||||
; imul rax,byte %2 ; ERROR
|
||||
%endif
|
||||
|
||||
imul ax,cx,0x1234
|
||||
imul ax,MEM,0x1234
|
||||
imul ax,word MEM,0x1234
|
||||
imul eax,ecx,0x12345678
|
||||
imul eax,MEM,0x12345678
|
||||
imul eax,dword MEM,0x12345678
|
||||
%if %1 == 64
|
||||
imul rax,rcx,0x12345678
|
||||
imul rax,MEM,0x12345678
|
||||
imul rax,qword MEM,0x12345678
|
||||
%endif
|
||||
|
||||
imul ax,0x1234
|
||||
imul eax,0x12345678
|
||||
%if %1 == 64
|
||||
imul rax,0x12345678
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
test 16
|
||||
test 32
|
||||
test 64
|
||||
|
||||
%ifdef WARN
|
||||
test 16,0x999
|
||||
test 32,0x999999
|
||||
test 64,0x999999999
|
||||
%endif
|
Loading…
Reference in New Issue
Block a user