preproc.c: Make %substr robust
[nasm.git] / test / imul.asm
blobd30d25f1a5003583677d17d5d0043ff7ed0d5d14
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-3 5 -2
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
81 imul ax,cx,0xfffe
82 imul ax,MEM,0xfffe
83 imul ax,word MEM,0xfffe
84 imul ax,cx,0xfe
85 imul ax,MEM,0xfe
86 imul ax,word MEM,0xfe
87 imul eax,ecx,0xfffffffe
88 imul eax,MEM,0xfffffffe
89 imul eax,dword MEM,0xfffffffe
90 imul eax,ecx,0xfffe
91 imul eax,MEM,0xfffe
92 imul eax,dword MEM,0xfffe
93 %if %1 == 64
94 imul rax,rcx,%3
95 imul rax,MEM,%3
96 imul rax,qword MEM,%3
97 imul rax,rcx,0xfffe
98 imul rax,MEM,0xfffe
99 imul rax,qword MEM,0xfffe
100 %endif
102 imul ax,0xfffe
103 imul eax,0xfffffffe
104 %if %1 == 64
105 imul rax,%3
106 %endif
107 %endmacro
109 test 16
110 test 32
111 test 64
113 %ifdef WARN
114 test 16,0x999
115 test 32,0x999999
116 test 64,0x999999999,0xfffffffe
117 %endif