1 # Rules to optimize BCC assembler output for 386
3 # Many of these rules are very broken, ho hum.
5 # Rules for loading a long constant
8 xor %[bx|si|di]1,%[bx|si|di]1
13 mov %[ebx|ecx|edx]1,eax
18 mov %[bx|si|di]*,%[*|#]0%1
23 xor %[bx|si|di]2,%[bx|si|di]2
25 mov eax,%0%1 & $0000FFFF
28 xor %[bx|si|di]2,%[bx|si|di]2
30 movzx eax,word ptr %0[%1]
37 %[movzx|movsx]5 eax,%1
38 mov %[ebx|ecx|edx]2,eax
42 %[movzx|movsx]5 %[ebx|ecx|edx]1,%2
44 %[add|and|xor|or]4 eax,%[ebx|ecx|edx]1
52 movsx eax,word ptr %0[%1]
60 mov %[bx|si|di]*,%[#|*]4%2
65 # Rules for pushing variables and constants onto the stack
67 push %![dword ptr]%1[%[bx|si|di|bp]3]
68 push %![dword ptr]%(%1-2)[%[bx|si|di|bp]3]
70 push dword ptr %(%1-2)[%3]
87 mov %1,%[eax|ebx|ecx|edx]2
94 # Rules for loading long variables
97 mov %[bx|si|di]*,[%1+2]
101 mov ax,%1[%[bx|si|di|bp]3]
102 mov %[bx|si|di]*,%(%1+2)[%[bx|si|di|bp]3]
107 mov %[bx|si|di]*,#%1+2[bx]
112 mov [%1+2],%[bx|si|di]*
117 mov [%1+%(%3+2)],%[bx|si|di]*
121 mov %1[%[si|di|bp]3],ax
122 mov %(%1+2)[%[si|di|bp]3],%[bx|si|di]*
127 mov #%1+2[bx],%[bx|si|di]*
132 mov %![dword ptr]%3[%2],eax
134 mov dword ptr %3[%2],%0%1
137 xor %[bx|si|di]3,%[bx|si|di]3
139 mov %(%1+2)[%[bx|bp]4],%[bx|si|di]3
141 mov dword ptr %1[%4],#0
146 mov %(%3+2)[%[bx|bp]6],%[bx|si|di]5
149 mov dword ptr %3[%6],eax
152 # Long return values are in EAX, so we can skip dx
160 # Rules for manipulating long values
180 mov %2,%[eax|ebx|ecx|edx]1
181 mov %[eax|ebx|ecx|edx]1,%2
190 mov %[ebx|ecx|edx]0,%1
192 %3 eax,%[ebc|ecx|edx]0
197 %[movzx|movsx|mov]0 %[eax|ebx|ecx|edx]2,%4
198 %[add|and|xor|sub|or]1 %[eax|ebx|ecx|edx]2,%6
199 mov %6,%[eax|ebx|ecx|edx]2
206 %[jbe |jae |jne |jge |jle ]3 %4
208 cmp dword ptr %2,%0%1
209 %=[jbe |jae |jne |jge |jle ][jae |jbe |jne |jle |jge ]3 %4
213 %[jb |ja |je |jg |jl ]3 %4
215 cmp dword ptr %2,%0%1
216 %=[jb |ja |je |jg |jl ][ja |jb |je |jl |jg ]3 %4
219 cmp eax,dword %[#|*]0%2
221 cmp dword ptr %1[%3],%0%2
224 # Rules for calling the bcc library routines.
317 # Rules for calling the basic bcc library routines.
339 mov di,%[ax|bx|cx|dx]1
342 mov di,%[ax|bx|cx|dx]1
346 # Rules for pushing short values
348 mov %[ax|bx|cx|dx|si|di]2,%0[%1]
349 push %[ax|bx|cx|dx|si|di]2
353 mov %[ax|bx|cx|dx|si|di]2,%[#|*]0%1
354 push %[ax|bx|cx|dx|si|di]2
377 imul ax,*%(1<%1+1<%2)
396 %[add|and|xor|sub|or]2 ax,%![dx]%3
419 %1 dword ptr %[eax|ebx|ecx|edx]3,*%2
423 %1 dword ptr %[eax|ebx|ecx|edx]3,#%2