beta-0.89.2
[luatex.git] / source / texk / web2c / lib / mfmpi386.asm
blobcc356d5f8251c39ffc2c78941019997664823504
1 /* i386 assembly routines for inner loop fraction routines in Metafont
2 and MetaPost. Public domain. Included in texmfmp.c.
3 By Wayne Sullivan <wgs@maths.ucd.ie>. */
5 asm(".text\n"
6 " .align 4\n"
7 #ifdef ASM_NEEDS_UNDERSCORE
8 ".globl _ztakefraction\n"
9 "_ztakefraction:\n"
10 #else
11 ".globl ztakefraction\n"
12 "ztakefraction:\n"
13 #endif
14 " pushl %ebp\n"
15 " movl %esp,%ebp\n"
16 " xorl %ecx,%ecx\n"
17 " movl 8(%ebp),%eax\n"
18 " cmpl $0x80000000,%eax\n"
19 " jz LL5\n"
20 " imull 12(%ebp)\n"
21 " orl %edx,%edx\n"
22 " jns LL2\n"
23 " negl %edx\n"
24 " negl %eax\n"
25 " sbbl %ecx,%edx\n"
26 " incl %ecx\n"
27 "LL2:\n"
28 " addl $0x08000000,%eax\n"
29 " adcl $0,%edx\n"
30 " cmpl $0x07ffffff,%edx\n"
31 " ja LL3\n"
32 " shrd $28, %edx,%eax\n"
33 "LL1: jecxz LL4\n"
34 " negl %eax\n"
35 "LL4:\n"
36 " movl %ebp,%esp\n"
37 " popl %ebp\n"
38 " ret\n"
39 "LL5: incl %ecx\n"
40 "LL3: movl $0x7fffffff,%eax\n"
41 #ifdef ASM_NEEDS_UNDERSCORE
42 " movb $1,_aritherror\n"
43 #else
44 " movb $1,aritherror\n"
45 #endif
46 " jmp LL1\n"
47 " .align 4, 0x90\n"
48 #ifdef ASM_NEEDS_UNDERSCORE
49 ".globl _ztakescaled\n"
50 "_ztakescaled:\n"
51 #else
52 ".globl ztakescaled\n"
53 "ztakescaled:\n"
54 #endif
55 " pushl %ebp\n"
56 " movl %esp,%ebp\n"
57 " movl 8(%ebp),%eax\n"
58 " xorl %ecx,%ecx\n"
59 " cmpl $0x80000000,%eax\n"
60 " jz LL5\n"
61 " imull 12(%ebp)\n"
62 " orl %edx,%edx\n"
63 " jns LL12\n"
64 " negl %edx\n"
65 " negl %eax\n"
66 " sbbl %ecx,%edx\n"
67 " incl %ecx\n"
68 "LL12:\n"
69 " addl $0x00008000,%eax\n"
70 " adcl $0,%edx\n"
71 " cmpl $0x00007fff,%edx\n"
72 " ja LL3\n"
73 " shrd $16, %edx,%eax\n"
74 " jecxz LL4\n"
75 " negl %eax\n"
76 " jmp LL4\n"
77 " .align 4, 0x90\n"
78 #ifdef ASM_NEEDS_UNDERSCORE
79 ".globl _zmakescaled\n"
80 ".globl _zmakefraction\n"
81 "_zmakescaled:\n"
82 #else
83 ".globl zmakescaled\n"
84 ".globl zmakefraction\n"
85 "zmakescaled:\n"
86 #endif
87 " movb $16,%cl\n"
88 " jmp LL30\n"
89 " .align 4, 0x90\n"
90 #ifdef ASM_NEEDS_UNDERSCORE
91 "_zmakefraction:\n"
92 #else
93 "zmakefraction:\n"
94 #endif
95 " movb $4,%cl\n"
96 "LL30:\n"
97 " movb $0,%ch\n"
98 " pushl %ebp\n"
99 " movl %esp,%ebp\n"
100 " pushl %ebx\n"
101 " movl 8(%ebp),%edx\n"
102 " xorl %eax,%eax\n"
103 " orl %edx,%edx\n"
104 " jns LL32\n"
105 " inc %ch\n"
106 " negl %edx\n"
107 "LL32:\n"
108 " movl 12(%ebp),%ebx\n"
109 " orl %ebx,%ebx\n"
110 " jns LL33\n"
111 " dec %ch\n"
112 " negl %ebx\n"
113 " orl %ebx,%ebx\n"
114 " js LL34\n"
115 "LL33:\n"
116 " orl %edx,%edx\n"
117 " js LL34\n"
118 " shrd %cl,%edx,%eax\n"
119 " shrl %cl,%edx\n"
120 " cmpl %ebx,%edx\n"
121 " jae LL34\n"
122 " divl %ebx\n"
123 " addl %edx,%edx\n"
124 " incl %edx\n"
125 " subl %edx,%ebx\n"
126 " adcl $0,%eax\n"
127 " jc LL34\n"
128 " cmpl $0x7fffffff,%eax\n"
129 " ja LL34\n"
130 "LL31: or %ch,%ch\n"
131 " jz LL35\n"
132 " negl %eax\n"
133 "LL35:\n"
134 " popl %ebx\n"
135 " movl %ebp,%esp\n"
136 " popl %ebp\n"
137 " ret\n"
138 "LL34: movl $0x7fffffff,%eax\n"
139 #ifdef ASM_NEEDS_UNDERSCORE
140 " movb $1,_aritherror\n"
141 #else
142 " movb $1,aritherror\n"
143 #endif
144 " jmp LL31\n");