preproc: BR 2222615: fix segfault on bogus %ifmacro
[nasm/perl-rewrite.git] / test / imul.asm
blobb1777120d585d735d5584225fe4a4c6a16289a93
1 ;Testname=nowarn; Arguments=-fbin -oimul.bin; Files=stdout stderr imul.bin
2 ;Testname=warn; Arguments=-DWARN -fbin -oimul.bin; Files=stdout stderr imul.bin
4 %macro test 1-2 5
5 bits %1
7 %undef MEM
8 %if %1 == 16
9 %define MEM [di]
10 %elif %1 == 32
11 %define MEM [edi]
12 %elif %1 == 64
13 %define MEM [rdi]
14 %endif
16 imul al
17 imul byte MEM
18 imul ax
19 imul word MEM
20 imul eax
21 imul dword MEM
22 %if %1 == 64
23 imul rdx
24 imul qword MEM
25 %endif
27 imul ax,cx
28 imul ax,MEM
29 imul ax,word MEM
30 imul eax,ecx
31 imul eax,MEM
32 imul eax,dword MEM
33 %if %1 == 64
34 imul rax,rcx
35 imul rax,MEM
36 imul rax,qword MEM
37 %endif
39 imul ax,cx,%2
40 imul ax,cx,byte %2
41 imul ax,MEM,%2
42 imul ax,word MEM,%2
43 imul eax,ecx,%2
44 imul eax,ecx,byte %2
45 imul eax,MEM,%2
46 imul eax,dword MEM,%2
47 %if %1 == 64
48 imul rax,rcx,%2
49 imul rax,rcx,byte %2
50 imul rax,MEM,%2
51 imul rax,qword MEM,%2
52 %endif
54 imul ax,%2
55 imul ax,byte %2
56 imul eax,%2
57 imul eax,byte %2
58 %if %1 == 64
59 imul rax,%2
60 imul rax,byte %2
61 %endif
63 imul ax,cx,0x1234
64 imul ax,MEM,0x1234
65 imul ax,word MEM,0x1234
66 imul eax,ecx,0x12345678
67 imul eax,MEM,0x12345678
68 imul eax,dword MEM,0x12345678
69 %if %1 == 64
70 imul rax,rcx,0x12345678
71 imul rax,MEM,0x12345678
72 imul rax,qword MEM,0x12345678
73 %endif
75 imul ax,0x1234
76 imul eax,0x12345678
77 %if %1 == 64
78 imul rax,0x12345678
79 %endif
80 %endmacro
82 test 16
83 test 32
84 test 64
86 %ifdef WARN
87 test 16,0x999
88 test 32,0x999999
89 test 64,0x999999999
90 %endif