summaryrefslogtreecommitdiff
path: root/sysdeps/i386/i586
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/i586')
-rw-r--r--sysdeps/i386/i586/addmul_1.S84
-rw-r--r--sysdeps/i386/i586/mul_1.S78
-rw-r--r--sysdeps/i386/i586/submul_1.S84
3 files changed, 126 insertions, 120 deletions
diff --git a/sysdeps/i386/i586/addmul_1.S b/sysdeps/i386/i586/addmul_1.S
index 76bf25f817..bf5b718a9f 100644
--- a/sysdeps/i386/i586/addmul_1.S
+++ b/sysdeps/i386/i586/addmul_1.S
@@ -1,6 +1,6 @@
/* Pentium __mpn_addmul_1 -- Multiply a limb vector with a limb and add
the result to a second limb vector.
- Copyright (C) 1992, 94, 96, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1992, 94, 96, 97, 98, 00 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
@@ -18,16 +18,15 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s1_ptr (sp + 8)
- size (sp + 12)
- s2_limb (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+16 /* space for 4 saved regs */
+#define RES PARMS
+#define S1 RES+PTR_SIZE
+#define SIZE S1+PTR_SIZE
+#define S2LIMB SIZE+4
#define res_ptr edi
#define s1_ptr esi
@@ -36,46 +35,49 @@
.text
ENTRY(__mpn_addmul_1)
-
- INSN1(push,l ,R(edi))
- INSN1(push,l ,R(esi))
- INSN1(push,l ,R(ebx))
- INSN1(push,l ,R(ebp))
-
- INSN2(mov,l ,R(res_ptr),MEM_DISP(esp,20))
- INSN2(mov,l ,R(s1_ptr),MEM_DISP(esp,24))
- INSN2(mov,l ,R(size),MEM_DISP(esp,28))
- INSN2(mov,l ,R(s2_limb),MEM_DISP(esp,32))
-
- INSN2(lea,l ,R(res_ptr),MEM_INDEX(res_ptr,size,4))
- INSN2(lea,l ,R(s1_ptr),MEM_INDEX(s1_ptr,size,4))
- INSN1(neg,l ,R(size))
- INSN2(xor,l ,R(ebx),R(ebx))
+ ENTER
+
+ pushl %edi
+ pushl %esi
+ pushl %ebx
+ pushl %ebp
+
+ movl RES(%esp), %res_ptr
+ movl S1(%esp), %s1_ptr
+ movl SIZE(%esp), %size
+ movl S2LIMB(%esp), %s2_limb
+
+ leal (%res_ptr,%size,4), %res_ptr
+ leal (%s1_ptr,%size,4), %s1_ptr
+ negl %size
+ xorl %ebx, %ebx
ALIGN (3)
-L(oop): INSN2(adc,l ,R(ebx),$0)
- INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4))
+L(oop): adcl $0, %ebx
+ movl (%s1_ptr,%size,4), %eax
+
+ mull %s2_limb
- INSN1(mul,l ,R(s2_limb))
+ addl %ebx, %eax
+ movl (%res_ptr,%size,4), %ebx
- INSN2(add,l ,R(eax),R(ebx))
- INSN2(mov,l ,R(ebx),MEM_INDEX(res_ptr,size,4))
+ adcl $0, %edx
+ addl %eax, %ebx
- INSN2(adc,l ,R(edx),$0)
- INSN2(add,l ,R(ebx),R(eax))
+ movl %ebx, (%res_ptr,%size,4)
+ incl %size
- INSN2(mov,l ,MEM_INDEX(res_ptr,size,4),R(ebx))
- INSN1(inc,l ,R(size))
+ movl %edx, %ebx
+ jnz L(oop)
- INSN2(mov,l ,R(ebx),R(edx))
- INSN1(jnz, ,L(oop))
+ adcl $0, %ebx
+ movl %ebx, %eax
+ popl %ebp
+ popl %ebx
+ popl %esi
+ popl %edi
- INSN2(adc,l ,R(ebx),$0)
- INSN2(mov,l ,R(eax),R(ebx))
- INSN1(pop,l ,R(ebp))
- INSN1(pop,l ,R(ebx))
- INSN1(pop,l ,R(esi))
- INSN1(pop,l ,R(edi))
+ LEAVE
ret
#undef size
END(__mpn_addmul_1)
diff --git a/sysdeps/i386/i586/mul_1.S b/sysdeps/i386/i586/mul_1.S
index e2f7f6ce6c..1910c66eab 100644
--- a/sysdeps/i386/i586/mul_1.S
+++ b/sysdeps/i386/i586/mul_1.S
@@ -1,6 +1,6 @@
/* Pentium __mpn_mul_1 -- Multiply a limb vector with a limb and store
the result in a second limb vector.
- Copyright (C) 1992, 94, 96, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1992, 94, 96, 97, 98, 00 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
@@ -18,16 +18,15 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s1_ptr (sp + 8)
- size (sp + 12)
- s2_limb (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+16 /* space for 4 saved regs */
+#define RES PARMS
+#define S1 RES+PTR_SIZE
+#define SIZE S1+PTR_SIZE
+#define S2LIMB SIZE+4
#define res_ptr edi
#define s1_ptr esi
@@ -36,42 +35,45 @@
.text
ENTRY(__mpn_mul_1)
-
- INSN1(push,l ,R(edi))
- INSN1(push,l ,R(esi))
- INSN1(push,l ,R(ebx))
- INSN1(push,l ,R(ebp))
-
- INSN2(mov,l ,R(res_ptr),MEM_DISP(esp,20))
- INSN2(mov,l ,R(s1_ptr),MEM_DISP(esp,24))
- INSN2(mov,l ,R(size),MEM_DISP(esp,28))
- INSN2(mov,l ,R(s2_limb),MEM_DISP(esp,32))
-
- INSN2(lea,l ,R(res_ptr),MEM_INDEX(res_ptr,size,4))
- INSN2(lea,l ,R(s1_ptr),MEM_INDEX(s1_ptr,size,4))
- INSN1(neg,l ,R(size))
- INSN2(xor,l ,R(ebx),R(ebx))
+ ENTER
+
+ pushl %edi
+ pushl %esi
+ pushl %ebx
+ pushl %ebp
+
+ movl RES(%esp), %res_ptr
+ movl S1(%esp), %s1_ptr
+ movl SIZE(%esp), %size
+ movl S2LIMB(%esp), %s2_limb
+
+ leal (%res_ptr,%size,4), %res_ptr
+ leal (%s1_ptr,%size,4), %s1_ptr
+ negl %size
+ xorl %ebx, %ebx
ALIGN (3)
-L(oop): INSN2(adc,l ,R(ebx),$0)
- INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4))
+L(oop): adcl $0, %ebx
+ movl (%s1_ptr,%size,4), %eax
+
+ mull %s2_limb
- INSN1(mul,l ,R(s2_limb))
+ addl %eax, %ebx
- INSN2(add,l ,R(ebx),R(eax))
+ movl %ebx, (%res_ptr,%size,4)
+ incl %size
- INSN2(mov,l ,MEM_INDEX(res_ptr,size,4),R(ebx))
- INSN1(inc,l ,R(size))
+ movl %edx, %ebx
+ jnz L(oop)
- INSN2(mov,l ,R(ebx),R(edx))
- INSN1(jnz, ,L(oop))
+ adcl $0, %ebx
+ movl %ebx, %eax
+ popl %ebp
+ popl %ebx
+ popl %esi
+ popl %edi
- INSN2(adc,l ,R(ebx),$0)
- INSN2(mov,l ,R(eax),R(ebx))
- INSN1(pop,l ,R(ebp))
- INSN1(pop,l ,R(ebx))
- INSN1(pop,l ,R(esi))
- INSN1(pop,l ,R(edi))
+ LEAVE
ret
#undef size
END(__mpn_mul_1)
diff --git a/sysdeps/i386/i586/submul_1.S b/sysdeps/i386/i586/submul_1.S
index 905ad19d7f..4cb2b5da92 100644
--- a/sysdeps/i386/i586/submul_1.S
+++ b/sysdeps/i386/i586/submul_1.S
@@ -1,6 +1,6 @@
/* Pentium __mpn_submul_1 -- Multiply a limb vector with a limb and subtract
the result from a second limb vector.
- Copyright (C) 1992, 94, 96, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1992, 94, 96, 97, 98, 00 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
@@ -18,16 +18,15 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s1_ptr (sp + 8)
- size (sp + 12)
- s2_limb (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+16 /* space for 4 saved regs */
+#define RES PARMS
+#define S1 RES+PTR_SIZE
+#define SIZE S1+PTR_SIZE
+#define S2LIMB SIZE+4
#define res_ptr edi
#define s1_ptr esi
@@ -36,46 +35,49 @@
.text
ENTRY(__mpn_submul_1)
-
- INSN1(push,l ,R(edi))
- INSN1(push,l ,R(esi))
- INSN1(push,l ,R(ebx))
- INSN1(push,l ,R(ebp))
-
- INSN2(mov,l ,R(res_ptr),MEM_DISP(esp,20))
- INSN2(mov,l ,R(s1_ptr),MEM_DISP(esp,24))
- INSN2(mov,l ,R(size),MEM_DISP(esp,28))
- INSN2(mov,l ,R(s2_limb),MEM_DISP(esp,32))
-
- INSN2(lea,l ,R(res_ptr),MEM_INDEX(res_ptr,size,4))
- INSN2(lea,l ,R(s1_ptr),MEM_INDEX(s1_ptr,size,4))
- INSN1(neg,l ,R(size))
- INSN2(xor,l ,R(ebx),R(ebx))
+ ENTER
+
+ pushl %edi
+ pushl %esi
+ pushl %ebx
+ pushl %ebp
+
+ movl RES(%esp), %res_ptr
+ movl S1(%esp), %s1_ptr
+ movl SIZE(%esp), %size
+ movl S2LIMB(%esp), %s2_limb
+
+ leal (%res_ptr,%size,4), %res_ptr
+ leal (%s1_ptr,%size,4), %s1_ptr
+ negl %size
+ xorl %ebx, %ebx
ALIGN (3)
-L(oop): INSN2(adc,l ,R(ebx),$0)
- INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4))
+L(oop): adcl $0, %ebx
+ movl (%s1_ptr,%size,4), %eax
+
+ mull %s2_limb
- INSN1(mul,l ,R(s2_limb))
+ addl %ebx, %eax
+ movl (%res_ptr,%size,4), %ebx
- INSN2(add,l ,R(eax),R(ebx))
- INSN2(mov,l ,R(ebx),MEM_INDEX(res_ptr,size,4))
+ adcl $0, %edx
+ subl %eax, %ebx
- INSN2(adc,l ,R(edx),$0)
- INSN2(sub,l ,R(ebx),R(eax))
+ movl %ebx, (%res_ptr,%size,4)
+ incl %size
- INSN2(mov,l ,MEM_INDEX(res_ptr,size,4),R(ebx))
- INSN1(inc,l ,R(size))
+ movl %edx, %ebx
+ jnz L(oop)
- INSN2(mov,l ,R(ebx),R(edx))
- INSN1(jnz, ,L(oop))
+ adcl $0, %ebx
+ movl %ebx, %eax
+ popl %ebp
+ popl %ebx
+ popl %esi
+ popl %edi
- INSN2(adc,l ,R(ebx),$0)
- INSN2(mov,l ,R(eax),R(ebx))
- INSN1(pop,l ,R(ebp))
- INSN1(pop,l ,R(ebx))
- INSN1(pop,l ,R(esi))
- INSN1(pop,l ,R(edi))
+ LEAVE
ret
#undef size
END(__mpn_submul_1)