summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/lib/mfmpi386.asm
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-02-25 19:22:25 +0000
committerKarl Berry <karl@freefriends.org>2021-02-25 19:22:25 +0000
commitad547a6b5986815fda458221149728d9d9ab1d87 (patch)
tree16296910eb3eca724371474ea9aea3994dc69614 /Build/source/texk/web2c/lib/mfmpi386.asm
parent947b43de3dd21d58ccc2ffadefc4441ea1c2a813 (diff)
restore Build,TODO from r57911
git-svn-id: svn://tug.org/texlive/trunk@57915 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/lib/mfmpi386.asm')
-rw-r--r--Build/source/texk/web2c/lib/mfmpi386.asm145
1 files changed, 145 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/lib/mfmpi386.asm b/Build/source/texk/web2c/lib/mfmpi386.asm
new file mode 100644
index 00000000000..cc356d5f825
--- /dev/null
+++ b/Build/source/texk/web2c/lib/mfmpi386.asm
@@ -0,0 +1,145 @@
+/* i386 assembly routines for inner loop fraction routines in Metafont
+ and MetaPost. Public domain. Included in texmfmp.c.
+ By Wayne Sullivan <wgs@maths.ucd.ie>. */
+
+asm(".text\n"
+" .align 4\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+".globl _ztakefraction\n"
+"_ztakefraction:\n"
+#else
+".globl ztakefraction\n"
+"ztakefraction:\n"
+#endif
+" pushl %ebp\n"
+" movl %esp,%ebp\n"
+" xorl %ecx,%ecx\n"
+" movl 8(%ebp),%eax\n"
+" cmpl $0x80000000,%eax\n"
+" jz LL5\n"
+" imull 12(%ebp)\n"
+" orl %edx,%edx\n"
+" jns LL2\n"
+" negl %edx\n"
+" negl %eax\n"
+" sbbl %ecx,%edx\n"
+" incl %ecx\n"
+"LL2:\n"
+" addl $0x08000000,%eax\n"
+" adcl $0,%edx\n"
+" cmpl $0x07ffffff,%edx\n"
+" ja LL3\n"
+" shrd $28, %edx,%eax\n"
+"LL1: jecxz LL4\n"
+" negl %eax\n"
+"LL4:\n"
+" movl %ebp,%esp\n"
+" popl %ebp\n"
+" ret\n"
+"LL5: incl %ecx\n"
+"LL3: movl $0x7fffffff,%eax\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+" movb $1,_aritherror\n"
+#else
+" movb $1,aritherror\n"
+#endif
+" jmp LL1\n"
+" .align 4, 0x90\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+".globl _ztakescaled\n"
+"_ztakescaled:\n"
+#else
+".globl ztakescaled\n"
+"ztakescaled:\n"
+#endif
+" pushl %ebp\n"
+" movl %esp,%ebp\n"
+" movl 8(%ebp),%eax\n"
+" xorl %ecx,%ecx\n"
+" cmpl $0x80000000,%eax\n"
+" jz LL5\n"
+" imull 12(%ebp)\n"
+" orl %edx,%edx\n"
+" jns LL12\n"
+" negl %edx\n"
+" negl %eax\n"
+" sbbl %ecx,%edx\n"
+" incl %ecx\n"
+"LL12:\n"
+" addl $0x00008000,%eax\n"
+" adcl $0,%edx\n"
+" cmpl $0x00007fff,%edx\n"
+" ja LL3\n"
+" shrd $16, %edx,%eax\n"
+" jecxz LL4\n"
+" negl %eax\n"
+" jmp LL4\n"
+" .align 4, 0x90\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+".globl _zmakescaled\n"
+".globl _zmakefraction\n"
+"_zmakescaled:\n"
+#else
+".globl zmakescaled\n"
+".globl zmakefraction\n"
+"zmakescaled:\n"
+#endif
+" movb $16,%cl\n"
+" jmp LL30\n"
+" .align 4, 0x90\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+"_zmakefraction:\n"
+#else
+"zmakefraction:\n"
+#endif
+" movb $4,%cl\n"
+"LL30:\n"
+" movb $0,%ch\n"
+" pushl %ebp\n"
+" movl %esp,%ebp\n"
+" pushl %ebx\n"
+" movl 8(%ebp),%edx\n"
+" xorl %eax,%eax\n"
+" orl %edx,%edx\n"
+" jns LL32\n"
+" inc %ch\n"
+" negl %edx\n"
+"LL32:\n"
+" movl 12(%ebp),%ebx\n"
+" orl %ebx,%ebx\n"
+" jns LL33\n"
+" dec %ch\n"
+" negl %ebx\n"
+" orl %ebx,%ebx\n"
+" js LL34\n"
+"LL33:\n"
+" orl %edx,%edx\n"
+" js LL34\n"
+" shrd %cl,%edx,%eax\n"
+" shrl %cl,%edx\n"
+" cmpl %ebx,%edx\n"
+" jae LL34\n"
+" divl %ebx\n"
+" addl %edx,%edx\n"
+" incl %edx\n"
+" subl %edx,%ebx\n"
+" adcl $0,%eax\n"
+" jc LL34\n"
+" cmpl $0x7fffffff,%eax\n"
+" ja LL34\n"
+"LL31: or %ch,%ch\n"
+" jz LL35\n"
+" negl %eax\n"
+"LL35:\n"
+" popl %ebx\n"
+" movl %ebp,%esp\n"
+" popl %ebp\n"
+" ret\n"
+"LL34: movl $0x7fffffff,%eax\n"
+#ifdef ASM_NEEDS_UNDERSCORE
+" movb $1,_aritherror\n"
+#else
+" movb $1,aritherror\n"
+#endif
+" jmp LL31\n");
+