From 43c81906dbf4c2bf9f89a53a08f0e05c7adf4113 Mon Sep 17 00:00:00 2001 From: Greg McGary Date: Mon, 26 Jun 2000 16:48:10 +0000 Subject: * sysdeps/i386/asm-syntax.h (R, MEM, MEM_DISP, MEM_INDEX, INSN1, INSN2, TEXT, GLOBL): Remove macros. (ALIGN): Cleanup surrounding conditionals. * sysdeps/i386/addmul_1.S: Replace asm-syntax macros with gas syntax. Call ENTER/LEAVE macros. * sysdeps/i386/mul_1.S: Replace asm-syntax macros with gas syntax. * sysdeps/i386/submul_1.S: Likewise. * sysdeps/i386/i586/addmul_1.S: Replace asm-syntax macros with gas syntax. Define & use symbolic argument stack offsets. Call ENTER/LEAVE macros. * sysdeps/i386/i586/mul_1.S: Likewise. * sysdeps/i386/i586/submul_1.S: Likewise. 2000-06-26 Greg McGary * sysdeps/i386/asm-syntax.h (R, MEM, MEM_DISP, MEM_INDEX, INSN1, INSN2, TEXT, GLOBL): Remove macros. (ALIGN): Cleanup surrounding conditionals. * sysdeps/i386/addmul_1.S: Replace asm-syntax macros with gas syntax. Call ENTER/LEAVE macros. * sysdeps/i386/mul_1.S: Replace asm-syntax macros with gas syntax. * sysdeps/i386/submul_1.S: Likewise. * sysdeps/i386/i586/addmul_1.S: Replace asm-syntax macros with gas syntax. Define & use symbolic argument stack offsets. Call ENTER/LEAVE macros. * sysdeps/i386/i586/mul_1.S: Likewise. * sysdeps/i386/i586/submul_1.S: Likewise. --- sysdeps/i386/addmul_1.S | 55 +++++++++++++++-------------- sysdeps/i386/asm-syntax.h | 66 ++++++++-------------------------- sysdeps/i386/i586/addmul_1.S | 84 +++++++++++++++++++++++--------------------- sysdeps/i386/i586/mul_1.S | 78 ++++++++++++++++++++-------------------- sysdeps/i386/i586/submul_1.S | 84 +++++++++++++++++++++++--------------------- sysdeps/i386/mul_1.S | 58 +++++++++++++----------------- sysdeps/i386/submul_1.S | 52 +++++++++++++-------------- 7 files changed, 220 insertions(+), 257 deletions(-) (limited to 'sysdeps/i386') diff --git a/sysdeps/i386/addmul_1.S b/sysdeps/i386/addmul_1.S index 50151ea07d..a5d3fb0539 100644 --- a/sysdeps/i386/addmul_1.S +++ b/sysdeps/i386/addmul_1.S @@ -35,38 +35,41 @@ .text ENTRY(__mpn_addmul_1) + ENTER - INSN1(push,l ,R(edi)) - INSN1(push,l ,R(esi)) - INSN1(push,l ,R(ebx)) - INSN1(push,l ,R(ebp)) + pushl %edi + pushl %esi + pushl %ebx + pushl %ebp - INSN2(mov,l ,R(res_ptr),MEM_DISP(esp,RES)) - INSN2(mov,l ,R(s1_ptr),MEM_DISP(esp,S1)) - INSN2(mov,l ,R(sizeP),MEM_DISP(esp,SIZE)) - INSN2(mov,l ,R(s2_limb),MEM_DISP(esp,S2LIMB)) + movl RES(%esp), %res_ptr + movl S1(%esp), %s1_ptr + movl SIZE(%esp), %sizeP + movl S2LIMB(%esp), %s2_limb - INSN2(lea,l ,R(res_ptr),MEM_INDEX(res_ptr,sizeP,4)) - INSN2(lea,l ,R(s1_ptr),MEM_INDEX(s1_ptr,sizeP,4)) - INSN1(neg,l ,R(sizeP)) - INSN2(xor,l ,R(ebx),R(ebx)) + leal (%res_ptr,%sizeP,4), %res_ptr + leal (%s1_ptr,%sizeP,4), %s1_ptr + negl %sizeP + xorl %ebx, %ebx ALIGN (3) L(oop): - INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,sizeP,4)) - INSN1(mul,l ,R(s2_limb)) - INSN2(add,l ,R(eax),R(ebx)) - INSN2(adc,l ,R(edx),$0) - INSN2(add,l ,MEM_INDEX(res_ptr,sizeP,4),R(eax)) - INSN2(adc,l ,R(edx),$0) - INSN2(mov,l ,R(ebx),R(edx)) + movl (%s1_ptr,%sizeP,4), %eax + mull %s2_limb + addl %ebx, %eax + adcl $0, %edx + addl %eax, (%res_ptr,%sizeP,4) + adcl $0, %edx + movl %edx, %ebx - INSN1(inc,l ,R(sizeP)) - INSN1(jnz, ,L(oop)) - INSN2(mov,l ,R(eax),R(ebx)) + incl %sizeP + jnz L(oop) + movl %ebx, %eax - INSN1(pop,l ,R(ebp)) - INSN1(pop,l ,R(ebx)) - INSN1(pop,l ,R(esi)) - INSN1(pop,l ,R(edi)) + popl %ebp + popl %ebx + popl %esi + popl %edi + + LEAVE ret END(__mpn_addmul_1) diff --git a/sysdeps/i386/asm-syntax.h b/sysdeps/i386/asm-syntax.h index 68c7b0e584..a534a9b046 100644 --- a/sysdeps/i386/asm-syntax.h +++ b/sysdeps/i386/asm-syntax.h @@ -1,5 +1,5 @@ /* Definitions for x86 syntax variations. - Copyright (C) 1992, 1994, 1995, 1997 Free Software Foundation, Inc. + Copyright (C) 1992, 1994, 1995, 1997, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in the GNU MP Library. @@ -20,61 +20,23 @@ Boston, MA 02111-1307, USA. */ #undef ALIGN - -#ifdef GAS_SYNTAX -#define R(r) %r -#define MEM(base)(base) -#define MEM_DISP(base,displacement)displacement(R(base)) -#define MEM_INDEX(base,index,size)(R(base),R(index),size) -#ifdef __STDC__ -#define INSN1(mnemonic,size_suffix,dst)mnemonic##size_suffix dst -#define INSN2(mnemonic,size_suffix,dst,src)mnemonic##size_suffix src,dst +#if defined NOLOG_ALIGN || defined HAVE_ELF +# define ALIGN(log) .align 1< #include "asm-syntax.h" #include "bp-asm.h" @@ -45,37 +37,37 @@ ENTRY(__mpn_mul_1) ENTER - INSN1(push,l ,R(edi)) - INSN1(push,l ,R(esi)) - INSN1(push,l ,R(ebx)) - INSN1(push,l ,R(ebp)) + pushl %edi + pushl %esi + pushl %ebx + pushl %ebp - INSN2(mov,l ,R(res_ptr),MEM_DISP(esp,RES)) - INSN2(mov,l ,R(s1_ptr),MEM_DISP(esp,S1)) - INSN2(mov,l ,R(size),MEM_DISP(esp,SIZE)) - INSN2(mov,l ,R(s2_limb),MEM_DISP(esp,S2LIMB)) + movl RES(%esp), %res_ptr + movl S1(%esp), %s1_ptr + movl SIZE(%esp), %size + movl S2LIMB(%esp), %s2_limb - 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)) + leal (%res_ptr,%size,4), %res_ptr + leal (%s1_ptr,%size,4), %s1_ptr + negl %size + xorl %ebx, %ebx ALIGN (3) L(oop): - INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4)) - INSN1(mul,l ,R(s2_limb)) - INSN2(add,l ,R(eax),R(ebx)) - INSN2(mov,l ,MEM_INDEX(res_ptr,size,4),R(eax)) - INSN2(adc,l ,R(edx),$0) - INSN2(mov,l ,R(ebx),R(edx)) + movl (%s1_ptr,%size,4), %eax + mull %s2_limb + addl %ebx, %eax + movl %eax, (%res_ptr,%size,4) + adcl $0, %edx + movl %edx, %ebx - INSN1(inc,l ,R(size)) - INSN1(jnz, ,L(oop)) - INSN2(mov,l ,R(eax),R(ebx)) + incl %size + jnz L(oop) + movl %ebx, %eax - INSN1(pop,l ,R(ebp)) - INSN1(pop,l ,R(ebx)) - INSN1(pop,l ,R(esi)) - INSN1(pop,l ,R(edi)) + popl %ebp + popl %ebx + popl %esi + popl %edi LEAVE ret diff --git a/sysdeps/i386/submul_1.S b/sysdeps/i386/submul_1.S index 99a1c81f2d..8715aba7f4 100644 --- a/sysdeps/i386/submul_1.S +++ b/sysdeps/i386/submul_1.S @@ -37,38 +37,38 @@ ENTRY(__mpn_submul_1) ENTER - INSN1(push,l ,R(edi)) - INSN1(push,l ,R(esi)) - INSN1(push,l ,R(ebx)) - INSN1(push,l ,R(ebp)) + pushl %edi + pushl %esi + pushl %ebx + pushl %ebp - INSN2(mov,l ,R(res_ptr),MEM_DISP(esp,RES)) - INSN2(mov,l ,R(s1_ptr),MEM_DISP(esp,S1)) - INSN2(mov,l ,R(sizeP),MEM_DISP(esp,SIZE)) - INSN2(mov,l ,R(s2_limb),MEM_DISP(esp,S2LIMB)) + movl RES(%esp), %res_ptr + movl S1(%esp), %s1_ptr + movl SIZE(%esp), %sizeP + movl S2LIMB(%esp), %s2_limb - INSN2(lea,l ,R(res_ptr),MEM_INDEX(res_ptr,sizeP,4)) - INSN2(lea,l ,R(s1_ptr),MEM_INDEX(s1_ptr,sizeP,4)) - INSN1(neg,l ,R(sizeP)) - INSN2(xor,l ,R(ebx),R(ebx)) + leal (%res_ptr,%sizeP,4), %res_ptr + leal (%s1_ptr,%sizeP,4), %s1_ptr + negl %sizeP + xorl %ebx, %ebx ALIGN (3) L(oop): - INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,sizeP,4)) - INSN1(mul,l ,R(s2_limb)) - INSN2(add,l ,R(eax),R(ebx)) - INSN2(adc,l ,R(edx),$0) - INSN2(sub,l ,MEM_INDEX(res_ptr,sizeP,4),R(eax)) - INSN2(adc,l ,R(edx),$0) - INSN2(mov,l ,R(ebx),R(edx)) + movl (%s1_ptr,%sizeP,4), %eax + mull %s2_limb + addl %ebx, %eax + adcl $0, %edx + subl %eax, (%res_ptr,%sizeP,4) + adcl $0, %edx + movl %edx, %ebx - INSN1(inc,l ,R(sizeP)) - INSN1(jnz, ,L(oop)) - INSN2(mov,l ,R(eax),R(ebx)) + incl %sizeP + jnz L(oop) + movl %ebx, %eax - INSN1(pop,l ,R(ebp)) - INSN1(pop,l ,R(ebx)) - INSN1(pop,l ,R(esi)) - INSN1(pop,l ,R(edi)) + popl %ebp + popl %ebx + popl %esi + popl %edi LEAVE ret -- cgit 1.4.1