From 3f02f778cdbec7d95e0a9d6f9368ce9cda0a6d03 Mon Sep 17 00:00:00 2001 From: Greg McGary Date: Fri, 9 Jun 2000 06:14:39 +0000 Subject: * sysdeps/i386/bp-asm.h: New file. * sysdeps/i386/__longjmp.S: Define & use symbolic argument stack offsets. Add ENTER/LEAVE macros for optionally maintaining frame-pointer chain when debugging. * sysdeps/i386/add_n.S: Likewise. * sysdeps/i386/addmul_1.S: Likewise. * sysdeps/i386/lshift.S: Likewise. * sysdeps/i386/memchr.S: Likewise. * sysdeps/i386/memcmp.S: Likewise. * sysdeps/i386/mul_1.S: Likewise. * sysdeps/i386/rawmemchr.S: Likewise. * sysdeps/i386/rshift.S: Likewise. * sysdeps/i386/stpcpy.S: Likewise. * sysdeps/i386/stpncpy.S: Likewise. * sysdeps/i386/strchr.S: Likewise. * sysdeps/i386/strchrnul.S: Likewise. * sysdeps/i386/strcspn.S: Likewise. * sysdeps/i386/strpbrk.S: Likewise. * sysdeps/i386/strrchr.S: Likewise. * sysdeps/i386/strspn.S: Likewise. * sysdeps/i386/strtok.S: Likewise. * sysdeps/i386/sub_n.S: Likewise. * sysdeps/i386/submul_1.S: Likewise. * sysdeps/i386/elf/setjmp.S: Likewise. * sysdeps/i386/i486/strcat.S: Likewise. * sysdeps/i386/i486/strlen.S: Likewise. * sysdeps/i386/i586/add_n.S: Likewise. * sysdeps/i386/i586/lshift.S: Likewise. * sysdeps/i386/i586/memcpy.S: Likewise. * sysdeps/i386/i586/memset.S: Likewise. * sysdeps/i386/i586/rshift.S: Likewise. * sysdeps/i386/i586/strchr.S: Likewise. * sysdeps/i386/i586/strcpy.S: Likewise. * sysdeps/i386/i586/strlen.S: Likewise. * sysdeps/i386/i586/sub_n.S: Likewise. * sysdeps/i386/i686/add_n.S: Likewise. * sysdeps/i386/i686/memcpy.S: Likewise. * sysdeps/i386/i686/mempcpy.S: Likewise. * sysdeps/i386/i686/memset.S: Likewise. * sysdeps/i386/i686/strcmp.S: Likewise. 2000-06-08 Greg McGary * sysdeps/i386/bp-asm.h: New file. * sysdeps/i386/__longjmp.S: Define & use symbolic argument stack offsets. Add ENTER/LEAVE macros for optionally maintaining frame-pointer chain when debugging. * sysdeps/i386/add_n.S: Likewise. * sysdeps/i386/addmul_1.S: Likewise. * sysdeps/i386/lshift.S: Likewise. * sysdeps/i386/memchr.S: Likewise. * sysdeps/i386/memcmp.S: Likewise. * sysdeps/i386/mul_1.S: Likewise. * sysdeps/i386/rawmemchr.S: Likewise. * sysdeps/i386/rshift.S: Likewise. * sysdeps/i386/stpcpy.S: Likewise. * sysdeps/i386/stpncpy.S: Likewise. * sysdeps/i386/strchr.S: Likewise. * sysdeps/i386/strchrnul.S: Likewise. * sysdeps/i386/strcspn.S: Likewise. * sysdeps/i386/strpbrk.S: Likewise. * sysdeps/i386/strrchr.S: Likewise. * sysdeps/i386/strspn.S: Likewise. * sysdeps/i386/strtok.S: Likewise. * sysdeps/i386/sub_n.S: Likewise. * sysdeps/i386/submul_1.S: Likewise. * sysdeps/i386/elf/setjmp.S: Likewise. * sysdeps/i386/i486/strcat.S: Likewise. * sysdeps/i386/i486/strlen.S: Likewise. * sysdeps/i386/i586/add_n.S: Likewise. * sysdeps/i386/i586/lshift.S: Likewise. * sysdeps/i386/i586/memcpy.S: Likewise. * sysdeps/i386/i586/memset.S: Likewise. * sysdeps/i386/i586/rshift.S: Likewise. * sysdeps/i386/i586/strchr.S: Likewise. * sysdeps/i386/i586/strcpy.S: Likewise. * sysdeps/i386/i586/strlen.S: Likewise. * sysdeps/i386/i586/sub_n.S: Likewise. * sysdeps/i386/i686/add_n.S: Likewise. * sysdeps/i386/i686/memcpy.S: Likewise. * sysdeps/i386/i686/mempcpy.S: Likewise. * sysdeps/i386/i686/memset.S: Likewise. * sysdeps/i386/i686/strcmp.S: Likewise. --- sysdeps/i386/i586/add_n.S | 29 ++++++++++++++++------------- sysdeps/i386/i586/lshift.S | 33 +++++++++++++++++++-------------- sysdeps/i386/i586/memcpy.S | 39 ++++++++++++++++++++++++++------------- sysdeps/i386/i586/memset.S | 41 ++++++++++++++++++++++++++--------------- sysdeps/i386/i586/rshift.S | 33 +++++++++++++++++++-------------- sysdeps/i386/i586/strchr.S | 24 ++++++++++++++---------- sysdeps/i386/i586/strcpy.S | 23 ++++++++++++++++------- sysdeps/i386/i586/strlen.S | 17 +++++++++-------- sysdeps/i386/i586/sub_n.S | 29 ++++++++++++++++------------- 9 files changed, 161 insertions(+), 107 deletions(-) (limited to 'sysdeps/i386/i586') diff --git a/sysdeps/i386/i586/add_n.S b/sysdeps/i386/i586/add_n.S index 8b4130b415..9bea31b068 100644 --- a/sysdeps/i386/i586/add_n.S +++ b/sysdeps/i386/i586/add_n.S @@ -1,6 +1,6 @@ /* Pentium __mpn_add_n -- Add two limb vectors of the same length > 0 and store sum in a third limb vector. - Copyright (C) 1992, 94, 95, 96, 97, 98 Free Software Foundation, Inc. + Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 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,28 +18,29 @@ 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) - s2_ptr (sp + 12) - size (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 S2 S1+PTR_SIZE +#define SIZE S2+PTR_SIZE .text ENTRY(__mpn_add_n) + ENTER + pushl %edi pushl %esi pushl %ebx pushl %ebp - movl 20(%esp),%edi /* res_ptr */ - movl 24(%esp),%esi /* s1_ptr */ - movl 28(%esp),%ebp /* s2_ptr */ - movl 32(%esp),%ecx /* size */ + movl RES(%esp),%edi + movl S1(%esp),%esi + movl S2(%esp),%ebp + movl SIZE(%esp),%ecx movl (%ebp),%ebx @@ -123,5 +124,7 @@ L(end2): popl %ebx popl %esi popl %edi + + LEAVE ret END(__mpn_add_n) diff --git a/sysdeps/i386/i586/lshift.S b/sysdeps/i386/i586/lshift.S index 22dc03ea65..d3f0da0062 100644 --- a/sysdeps/i386/i586/lshift.S +++ b/sysdeps/i386/i586/lshift.S @@ -1,5 +1,5 @@ /* Pentium optimized __mpn_lshift -- - Copyright (C) 1992, 94, 95, 96, 97, 98 Free Software Foundation, Inc. + Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify @@ -17,28 +17,29 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* - INPUT PARAMETERS - res_ptr (sp + 4) - s_ptr (sp + 8) - size (sp + 12) - cnt (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 S RES+PTR_SIZE +#define SIZE S+PTR_SIZE +#define CNT SIZE+4 -.text + .text ENTRY(__mpn_lshift) + ENTER + pushl %edi pushl %esi pushl %ebx pushl %ebp - movl 20(%esp),%edi /* res_ptr */ - movl 24(%esp),%esi /* s_ptr */ - movl 28(%esp),%ebp /* size */ - movl 32(%esp),%ecx /* cnt */ + movl RES(%esp),%edi + movl S(%esp),%esi + movl SIZE(%esp),%ebp + movl CNT(%esp),%ecx /* We can use faster code for shift-by-1 under certain conditions. */ cmp $1,%ecx @@ -127,6 +128,8 @@ L(end2): popl %ebx popl %esi popl %edi + + LEAVE ret /* We loop from least significant end of the arrays, which is only @@ -216,5 +219,7 @@ L(L1): movl %edx,(%edi) /* store last limb */ popl %ebx popl %esi popl %edi + + LEAVE ret END(__mpn_lshift) diff --git a/sysdeps/i386/i586/memcpy.S b/sysdeps/i386/i586/memcpy.S index 9116c8d741..82d5e79564 100644 --- a/sysdeps/i386/i586/memcpy.S +++ b/sysdeps/i386/i586/memcpy.S @@ -1,5 +1,5 @@ /* Highly optimized version for i586. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -20,23 +20,31 @@ #include #include "asm-syntax.h" +#include "bp-asm.h" -/* - INPUT PARAMETERS: - dst (sp + 4) - src (sp + 8) - len (sp + 12) -*/ +/* BEWARE: `#ifdef memset' means that memset is redefined as `bzero' */ +#define BCOPY_P (defined memcpy) +#define PARMS LINKAGE+8 /* space for 2 saved regs */ +#if BCOPY_P +# define DEST PARMS +#else +# define RTN PARMS +# define DEST RTN+RTN_SIZE +#endif +#define SRC DEST+PTR_SIZE +#define LEN SRC+PTR_SIZE .text ENTRY (memcpy) + ENTER + pushl %edi pushl %esi - movl 12(%esp), %edi /* dst */ - movl 16(%esp), %esi /* src */ - movl 20(%esp), %ecx /* len */ + movl DEST(%esp), %edi + movl SRC(%esp), %esi + movl LEN(%esp), %ecx movl %edi, %eax /* We need this in any case. */ @@ -91,18 +99,23 @@ L(3): movl 28(%edi), %edx /* Correct extra loop counter modification. */ L(2): addl $32, %ecx -#ifndef memcpy - movl 12(%esp), %eax /* dst */ +#if !BCOPY_P + movl DEST(%esp), %eax #endif L(1): rep; movsb -#ifdef memcpy +#if BCOPY_P movl %edi, %eax #endif popl %esi popl %edi + LEAVE +#if BCOPY_P ret +#else + RET_PTR +#endif END (memcpy) diff --git a/sysdeps/i386/i586/memset.S b/sysdeps/i386/i586/memset.S index 01bed35534..8b292e92fa 100644 --- a/sysdeps/i386/i586/memset.S +++ b/sysdeps/i386/i586/memset.S @@ -1,6 +1,6 @@ /* memset/bzero -- set memory area to CH/0 Highly optimized version for ix86, x>=5. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund, @@ -21,27 +21,33 @@ #include #include "asm-syntax.h" +#include "bp-asm.h" -/* - INPUT PARAMETERS: - (memset) (bzero) - dst (sp + 4) dst (sp + 4) - ch (sp + 8) len (sp + 8) - len (sp + 12) -*/ +/* BEWARE: `#ifdef memset' means that memset is redefined as `bzero' */ +#define BZERO_P (defined memset) +#define PARMS LINKAGE+4 /* space for 1 saved reg */ +#define RTN PARMS +#define DEST RTN+RTN_SIZE +#if BZERO_P +# define LEN DEST+PTR_SIZE +#else +# define CHR DEST+PTR_SIZE +# define LEN CHR+4 +#endif .text ENTRY (memset) + ENTER + pushl %edi - movl 8(%esp), %edi /* destination pointer */ -#ifdef memset + movl DEST(%esp), %edi + movl LEN(%esp), %edx +#if BZERO_P xorl %eax, %eax /* we fill with 0 */ - movl 12(%esp), %edx /* size (in 8-bit words) */ #else - movb 12(%esp), %al /* use CH to fill */ - movl 16(%esp), %edx /* size (in 8-bit words) */ + movb CHR(%esp), %al movb %al, %ah movl %eax, %ecx @@ -93,11 +99,16 @@ L(2): shrl $2, %ecx /* convert byte count to longword count */ rep stosb +#if !BZERO_P /* Load result (only if used as memset). */ -#ifndef memset - movl 8(%esp), %eax + movl DEST(%esp), %eax #endif popl %edi + LEAVE +#if BZERO_P ret +#else + RET_PTR +#endif END (memset) diff --git a/sysdeps/i386/i586/rshift.S b/sysdeps/i386/i586/rshift.S index 64e4047642..2395446d1b 100644 --- a/sysdeps/i386/i586/rshift.S +++ b/sysdeps/i386/i586/rshift.S @@ -1,5 +1,5 @@ /* Pentium optimized __mpn_rshift -- - Copyright (C) 1992, 94, 95, 96, 97, 98 Free Software Foundation, Inc. + Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 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 @@ -17,28 +17,29 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* - INPUT PARAMETERS - res_ptr (sp + 4) - s_ptr (sp + 8) - size (sp + 12) - cnt (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 S RES+PTR_SIZE +#define SIZE S+PTR_SIZE +#define CNT SIZE+4 -.text + .text ENTRY(__mpn_rshift) + ENTER + pushl %edi pushl %esi pushl %ebx pushl %ebp - movl 20(%esp),%edi /* res_ptr */ - movl 24(%esp),%esi /* s_ptr */ - movl 28(%esp),%ebp /* size */ - movl 32(%esp),%ecx /* cnt */ + movl RES(%esp),%edi + movl S(%esp),%esi + movl SIZE(%esp),%ebp + movl CNT(%esp),%ecx /* We can use faster code for shift-by-1 under certain conditions. */ cmp $1,%ecx @@ -124,6 +125,8 @@ L(end2): popl %ebx popl %esi popl %edi + + LEAVE ret /* We loop from least significant end of the arrays, which is only @@ -216,5 +219,7 @@ L(L1): movl %edx,(%edi) /* store last limb */ popl %ebx popl %esi popl %edi + + LEAVE ret END(__mpn_rshift) diff --git a/sysdeps/i386/i586/strchr.S b/sysdeps/i386/i586/strchr.S index e351853231..bf351f605e 100644 --- a/sysdeps/i386/i586/strchr.S +++ b/sysdeps/i386/i586/strchr.S @@ -1,6 +1,6 @@ /* Find character CH in a NUL terminated string. Highly optimized version for ix85, x>=5. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, . @@ -21,6 +21,7 @@ #include #include "asm-syntax.h" +#include "bp-asm.h" /* This version is especially optimized for the i586 (and following?) processors. This is mainly done by using the two pipelines. The @@ -35,22 +36,23 @@ /* The magic value which is used throughout in the whole code. */ #define magic 0xfefefeff -/* - INPUT PARAMETERS: - str (sp + 4) - ch (sp + 8) -*/ +#define PARMS LINKAGE+16 /* space for 4 saved regs */ +#define RTN PARMS +#define STR RTN+RTN_SIZE +#define CHR STR+PTR_SIZE .text ENTRY (strchr) + ENTER + pushl %edi /* Save callee-safe registers. */ pushl %esi pushl %ebx pushl %ebp - movl 20(%esp), %eax /* get string pointer */ - movl 24(%esp), %edx /* get character we are looking for */ + movl STR(%esp), %eax + movl CHR(%esp), %edx movl %eax, %edi /* duplicate string pointer for later */ xorl %ecx, %ecx /* clear %ecx */ @@ -283,7 +285,8 @@ L(2): popl %ebp /* restore saved registers */ popl %esi popl %edi - ret + LEAVE + RET_PTR /* We know there is a NUL byte in the word. But we have to test whether there is an C byte before it in the word. */ @@ -326,7 +329,8 @@ L(3): xorl %eax, %eax /* set return value = NULL */ popl %esi popl %edi - ret + LEAVE + RET_PTR END (strchr) #undef index diff --git a/sysdeps/i386/i586/strcpy.S b/sysdeps/i386/i586/strcpy.S index 7f89a2c0f7..a48fbb68f8 100644 --- a/sysdeps/i386/i586/strcpy.S +++ b/sysdeps/i386/i586/strcpy.S @@ -1,5 +1,5 @@ /* strcpy/stpcpy implementation for i586. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -20,6 +20,12 @@ #include #include "asm-syntax.h" +#include "bp-asm.h" + +#define PARMS LINKAGE+12 /* space for 3 saved regs */ +#define RTN PARMS +#define DEST RTN+RTN_SIZE +#define SRC DEST+PTR_SIZE #ifndef USE_AS_STPCPY # define STRCPY strcpy @@ -29,12 +35,14 @@ .text ENTRY(STRCPY) + ENTER + pushl %edi pushl %esi pushl %ebx - movl 16(%esp), %edi - movl 20(%esp), %esi + movl DEST(%esp), %edi + movl SRC(%esp), %esi xorl %eax, %eax leal -1(%esi), %ecx @@ -136,12 +144,13 @@ L(end): movb %ah, (%edi) L(end2): #ifdef USE_AS_STPCPY movl %edi, %eax +#else + movl DEST(%esp), %eax #endif popl %ebx popl %esi popl %edi -#ifndef USE_AS_STPCPY - movl 4(%esp), %eax -#endif - ret + + LEAVE + RET_PTR END(STRCPY) diff --git a/sysdeps/i386/i586/strlen.S b/sysdeps/i386/i586/strlen.S index 2e6ea680ec..e2771268ed 100644 --- a/sysdeps/i386/i586/strlen.S +++ b/sysdeps/i386/i586/strlen.S @@ -1,6 +1,6 @@ /* strlen -- Compute length og NUL terminated string. Highly optimized version for ix86, x>=5. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, . @@ -21,6 +21,7 @@ #include #include "asm-syntax.h" +#include "bp-asm.h" /* This version is especially optimized for the i586 (and following?) processors. This is mainly done by using the two pipelines. The @@ -35,14 +36,14 @@ /* The magic value which is used throughout in the whole code. */ #define magic 0xfefefeff -/* - INPUT PARAMETERS: - str (sp + 4) -*/ +#define PARMS LINKAGE /* no space for saved regs */ +#define STR PARMS .text ENTRY(strlen) - movl 4(%esp), %eax /* get string pointer */ + ENTER + + movl STR(%esp), %eax movl $3, %edx /* load mask (= 3) */ andl %eax, %edx /* separate last two bits of address */ @@ -176,9 +177,9 @@ L(3): subl $4, %eax /* correct too early pointer increment */ incl %eax /* increment pointer */ -L(2): subl 4(%esp), %eax /* now compute the length as difference +L(2): subl STR(%esp), %eax /* now compute the length as difference between start and terminating NUL character */ - + LEAVE ret END (strlen) diff --git a/sysdeps/i386/i586/sub_n.S b/sysdeps/i386/i586/sub_n.S index 03c85d9aa6..dbfb5d2865 100644 --- a/sysdeps/i386/i586/sub_n.S +++ b/sysdeps/i386/i586/sub_n.S @@ -1,6 +1,6 @@ /* Pentium __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and store difference in a third limb vector. - Copyright (C) 1992, 94, 95, 96, 97, 98 Free Software Foundation, Inc. + Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 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,28 +18,29 @@ 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) - s2_ptr (sp + 12) - size (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 S2 S1+PTR_SIZE +#define SIZE S2+PTR_SIZE .text ENTRY(__mpn_sub_n) + ENTER + pushl %edi pushl %esi pushl %ebx pushl %ebp - movl 20(%esp),%edi /* res_ptr */ - movl 24(%esp),%esi /* s1_ptr */ - movl 28(%esp),%ebp /* s2_ptr */ - movl 32(%esp),%ecx /* size */ + movl RES(%esp),%edi + movl S1(%esp),%esi + movl S2(%esp),%ebp + movl SIZE(%esp),%ecx movl (%ebp),%ebx @@ -123,5 +124,7 @@ L(end2): popl %ebx popl %esi popl %edi + + LEAVE ret END(__mpn_sub_n) -- cgit v1.2.1