From a5113b141cd85a98b4711607c430e6e01775bd9a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 9 Aug 1996 02:46:09 +0000 Subject: Update. Thu Aug 8 16:17:38 1996 Ulrich Drepper * pwd/getpwent.c: Define BUFLEN from NSS_BUFLEN_PASSWD. * pwd/getpwent_r.c: Likewise. * pwd/getpwnam.c: Likewise. * pwd/getpwnam_r.c: Likewise. * pwd/getpwuid.c: Likewise. * pwd/getpwuid_r.c: Likewise. * grp/getgrent.c: Define BUFLEN from NSS_BUFLEN_GROUP. * grp/getgrent_r.c: Likewise. * grp/getgrgid.c: Likewise. * grp/getgrgid_r.c: Likewise. * grp/getgrnam.c: Likewise. * pwd/fgetpwent_r.c: New file. Reentrant version of fgetpwent. * pwd/fgetpwent.c: Rewrite to use fgetpwent_r. * pwd/Makefile (routines): Add fgetpwent_r. * pwd/pwd.h: Add prototypes for __fgetpwent_r and fgetpwent_r. * grp/fgetgrent_r.c: New file. Reentrant version of fgetgrent. * grp/fgetgrent.c: Rewrite to use fgetgrent_r. * grp/Makefile (routines): Add fgetgrent_r. * grp/grp.h: Add prototypes for __fgetgrent_r and fgetgrent_r. Implement shadow password lookup functions. This is no complete shadow password suite. * shadow/Makefile: New file. * shadow/fgetspent.c: New file. * shadow/fgetspent_r.c: New file. * shadow/getspent.c: New file. * shadow/getspent_r.c: New file. * shadow/getspnam.c: New file. * shadow/getspnam_r.c: New file. * shadow/putspent.c: New file. * shadow/sgetspent.c: New file. * shadow/sgetspent_r.c: New file. * shadow/shadow.h: New file. * shadow/spwd-lookup.c: New file. * shadow/nss_files/files-spwd.c: New file. Thu Aug 8 13:33:45 1996 Ulrich Drepper * sysdeps/unix/sysv/linux/ftime.c: New file. Available system call is only a stub. Reported by Matthias Urlichs. * Makeconfig [!default_cflags]: Change default value from `-g' to `-g -O'. * configure.in: Recognize i686. * sysdeps/i386/i686/Implies: Default on i586 optimized code. Thu Aug 8 12:40:20 1996 Matthias Urlichs * Makeconfig [$(build-omitfp) == yes]: Add to CFLAGS-.so value of CFLAGS-.o, not CFLAGS-o. * sysdeps/unix/sysv/linux/init-first.c (init): Add volatile pointer to ourself. Otherwise `gcc -O3' optimized init away. sure that all tables in binary file are word-aligned. --- sysdeps/alpha/_mcount.S | 11 +++--- sysdeps/alpha/bb_init_func.S | 12 +++---- sysdeps/alpha/bsd-_setjmp.S | 7 ++-- sysdeps/alpha/bsd-setjmp.S | 7 ++-- sysdeps/alpha/divrem.h | 11 +++--- sysdeps/alpha/ffs.S | 4 +-- sysdeps/alpha/memchr.S | 36 +++++++++---------- sysdeps/alpha/setjmp.S | 5 ++- sysdeps/alpha/strlen.S | 82 +++++++++++++++++++++----------------------- 9 files changed, 85 insertions(+), 90 deletions(-) (limited to 'sysdeps/alpha') diff --git a/sysdeps/alpha/_mcount.S b/sysdeps/alpha/_mcount.S index e813ebdd58..6c4af3f233 100644 --- a/sysdeps/alpha/_mcount.S +++ b/sysdeps/alpha/_mcount.S @@ -28,20 +28,17 @@ compiler treats those calls as if they were instructions. In particular, it doesn't save any of the temporary registers (caller saved registers). It is therefore necessary to preserve all caller-saved registers as well - + Upon entering _mcount, register $at holds the return address and ra holds the return address of the function's caller (selfpc and frompc, respectively in gmon.c language...). */ #include -#undef ret /* discard `ret' as defined in sysdep.h */ - .set noat .set noreorder LEAF(_mcount, 0xb0) -weak_alias (_mcount, mcount) .prologue 0 subq sp, 0xb0, sp @@ -69,8 +66,6 @@ weak_alias (_mcount, mcount) stq t5, 0x70(sp) stq t6, 0x78(sp) - lda pv, __mcount - stq t7, 0x80(sp) stq t8, 0x88(sp) stq t9, 0x90(sp) @@ -78,7 +73,7 @@ weak_alias (_mcount, mcount) stq t11, 0xa0(sp) stq v0, 0xa8(sp) - jsr ra, (pv), __mcount + jsr ra, __mcount ldq a0, 0x00(sp) ldq a1, 0x08(sp) @@ -108,3 +103,5 @@ weak_alias (_mcount, mcount) ret zero,($at),1 END(_mcount) + +weak_alias (_mcount, mcount) diff --git a/sysdeps/alpha/bb_init_func.S b/sysdeps/alpha/bb_init_func.S index 49be0b2bfe..dcd4eac231 100644 --- a/sysdeps/alpha/bb_init_func.S +++ b/sysdeps/alpha/bb_init_func.S @@ -40,10 +40,10 @@ ENTRY(__bb_init_func) ldq t0, ZERO_WORD(a0) /* t0 <- blocks->zero_word */ beq t0, init /* not initialized yet -> */ ret - + END(__bb_init_func) -.ent init + .ent init init: .frame sp, 0x38, ra, 0 subq sp, 0x38, sp @@ -61,8 +61,8 @@ init: stq t0, ZERO_WORD(a0) /* blocks->zero_word = 1 */ stq t2, NEXT(a0) /* blocks->next = __bb_head */ stq a0, 0(t1) - bne t2, leave - beq t3, leave /* t3 == GMON_PROF_ON? yes -> */ + bne t2, $leave + beq t3, $leave /* t3 == GMON_PROF_ON? yes -> */ /* also need to initialize destructor: */ stq ra, 0x00(sp) @@ -81,8 +81,8 @@ init: ldq a4, 0x20(sp) ldq a5, 0x28(sp) -leave: ldq pv, 0x30(sp) +$leave: ldq pv, 0x30(sp) addq sp, 0x38, sp ret -.end init + .end init diff --git a/sysdeps/alpha/bsd-_setjmp.S b/sysdeps/alpha/bsd-_setjmp.S index da60442c23..a7bdbb5a61 100644 --- a/sysdeps/alpha/bsd-_setjmp.S +++ b/sysdeps/alpha/bsd-_setjmp.S @@ -1,5 +1,5 @@ /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. Alpha version. -Copyright (C) 1994 Free Software Foundation, Inc. +Copyright (C) 1994, 1996 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 @@ -24,7 +24,8 @@ Cambridge, MA 02139, USA. */ #include ENTRY(_setjmp) - lda $27, __sigsetjmp /* Load address to jump to. */ + ldgp $29,0($27) + .prologue 1 bis $31, $31, $17 /* Pass a second argument of zero. */ - jmp $31, ($27), __sigsetjmp /* Call __sigsetjmp. */ + jmp $31, __sigsetjmp /* Call __sigsetjmp. */ END(_setjmp) diff --git a/sysdeps/alpha/bsd-setjmp.S b/sysdeps/alpha/bsd-setjmp.S index fc73815a84..c0ed691f40 100644 --- a/sysdeps/alpha/bsd-setjmp.S +++ b/sysdeps/alpha/bsd-setjmp.S @@ -1,5 +1,5 @@ /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. Alpha version. -Copyright (C) 1994 Free Software Foundation, Inc. +Copyright (C) 1994, 1996 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 @@ -24,7 +24,8 @@ Cambridge, MA 02139, USA. */ #include ENTRY(setjmp) - lda $27, __sigsetjmp /* Load address to jump to. */ + ldgp $29, 0($27) + .prologue 1 bis $31, 1, $17 /* Pass a second argument of one. */ - jmp $31, ($27), __sigsetjmp /* Call __sigsetjmp. */ + jmp $31, __sigsetjmp /* Call __sigsetjmp. */ END(setjmp) diff --git a/sysdeps/alpha/divrem.h b/sysdeps/alpha/divrem.h index 2951335c49..b5b66ae10b 100644 --- a/sysdeps/alpha/divrem.h +++ b/sysdeps/alpha/divrem.h @@ -115,10 +115,9 @@ FUNC_NAME: br AT, 1f 1: ldgp gp, 0(AT) - lda AT, _mcount mov retaddr, ra - jsr AT, (AT), _mcount + jsr AT, _mcount ldq ra, 0x00(sp) ldq pv, 0x08(sp) @@ -137,7 +136,7 @@ FUNC_NAME: stq tmp0,0x18(sp) bis zero,zero,quotient stq tmp1,0x20(sp) - beq divisor,divbyzero + beq divisor,$divbyzero stq sign,0x28(sp) GETSIGN(dividend,divisor,sign) #if SIGNED @@ -170,7 +169,7 @@ FUNC_NAME: ldq arg1,0x00(sp) SETSIGN(sign,result,tmp0) -done: ldq arg2,0x08(sp) +$done: ldq arg2,0x08(sp) ldq mask,0x10(sp) ldq tmp0,0x18(sp) ldq tmp1,0x20(sp) @@ -178,11 +177,11 @@ done: ldq arg2,0x08(sp) lda sp,FRAME_SIZE(sp) ret zero,(retaddr),0 -divbyzero: +$divbyzero: lda a0,GEN_INTDIV(zero) call_pal PAL_gentrap bis zero,zero,result /* if trap returns, return 0 */ ldq arg1,0x00(sp) - br done + br $done END(FUNC_NAME) diff --git a/sysdeps/alpha/ffs.S b/sysdeps/alpha/ffs.S index e4dd87c9f1..b84a51d326 100644 --- a/sysdeps/alpha/ffs.S +++ b/sysdeps/alpha/ffs.S @@ -34,7 +34,7 @@ ENTRY(ffs) negq a0, t0 # due to the srl instruction and a0, t0, t0 clr v0 - beq a0, done + beq a0, $done # now do binary search for first non-zero bit @@ -61,6 +61,6 @@ ENTRY(ffs) addq v0, 1, t3 cmoveq t2, t3, v0 -done: ret +$done: ret END(ffs) diff --git a/sysdeps/alpha/memchr.S b/sysdeps/alpha/memchr.S index 2d21247174..a47ac96e01 100644 --- a/sysdeps/alpha/memchr.S +++ b/sysdeps/alpha/memchr.S @@ -42,7 +42,7 @@ For correctness consider that: ENTRY(memchr) .prologue 0 - beq a2, not_found + beq a2, $not_found ldq_u t0, 0(a0) # load first quadword (a0 may be misaligned) addq a0, a2, t4 and a1, 0xff, a1 # a1 = 00000000000000ch @@ -57,7 +57,7 @@ ENTRY(memchr) extql t0, a0, t6 or t1, a1, a1 # a1 = chchchchchchchch - beq t3, first_quad + beq t3, $first_quad extqh t5, a0, t5 mov a0, v0 @@ -68,15 +68,15 @@ ENTRY(memchr) # in t0. E.g.: # a2 = 6 # t0 = ????c6c5c4c3c2c1 -last_quad: +$last_quad: negq a2, t5 srl t2, t5, t5 # t5 = mask of a2 bits set xor a1, t0, t0 cmpbge zero, t0, t1 and t1, t5, t1 - beq t1, not_found + beq t1, $not_found -found_it: +$found_it: # now, determine which byte matched: negq t1, t2 and t1, t2, t1 @@ -93,20 +93,20 @@ found_it: addq v0, 1, t2 cmoveq t0, t2, v0 -done: ret +$done: ret # # Deal with the case where a2 > 8 bytes remain to be # searched. a0 may not be aligned. # -first_quad: +$first_quad: andnot a0, 0x7, v0 insqh t2, a0, t1 # t1 = 0000ffffffffffff (a0<0:2> ff bytes) xor t0, a1, t0 or t0, t1, t0 # t0 = ====ffffffffffff cmpbge zero, t0, t1 - bne t1, found_it + bne t1, $found_it /* at least one byte left to process */ @@ -119,41 +119,41 @@ first_quad: subq t4, 1, a2 andnot a2, 0x7, a2 cmpult v0, a2, t1 - beq t1, final + beq t1, $final /* at least two quads remain to be accessed */ subq a2, v0, t3 # t3 <- number of quads to be processed in loop and t3, 8, t3 # odd number of quads? - bne t3, odd_quad_count + bne t3, $odd_quad_count /* at least three quads remain to be accessed */ mov t0, t3 # move prefetched value into correct register .align 3 -unrolled_loop: +$unrolled_loop: ldq t0, 8(v0) # prefetch t0 xor a1, t3, t1 cmpbge zero, t1, t1 - bne t1, found_it + bne t1, $found_it addq v0, 8, v0 -odd_quad_count: +$odd_quad_count: xor a1, t0, t1 ldq t3, 8(v0) # prefetch t3 cmpbge zero, t1, t1 - bne t1, found_it + bne t1, $found_it addq v0, 8, v0 cmpult v0, a2, t5 - bne t5, unrolled_loop + bne t5, $unrolled_loop mov t3, t0 # move prefetched value into t0 -final: subq t4, v0, a2 # a2 <- number of bytes left to do - bne a2, last_quad +$final: subq t4, v0, a2 # a2 <- number of bytes left to do + bne a2, $last_quad -not_found: +$not_found: mov zero, v0 ret diff --git a/sysdeps/alpha/setjmp.S b/sysdeps/alpha/setjmp.S index da71a3292a..59929a0234 100644 --- a/sysdeps/alpha/setjmp.S +++ b/sysdeps/alpha/setjmp.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1994 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1994, 1996 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 @@ -25,9 +25,8 @@ ENTRY (__sigsetjmp) ldgp $29, 0($27) .prologue 1 - lda $27, __sigsetjmp_aux /* Load address to jump to. */ bis $30, $30, $18 /* Pass SP as 3rd arg. */ bis $15, $15, $19 /* Pass FP as 4th arg. */ - jmp $31, ($27), __sigsetjmp_aux /* Call __sigsetjmp_aux. */ + jmp $31, __sigsetjmp_aux /* Call __sigsetjmp_aux. */ END(__sigsetjmp) diff --git a/sysdeps/alpha/strlen.S b/sysdeps/alpha/strlen.S index 15c78cde64..9eab707388 100644 --- a/sysdeps/alpha/strlen.S +++ b/sysdeps/alpha/strlen.S @@ -19,52 +19,50 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* Finds length of a 0-terminated string. Optimized for the Alpha -architecture: + architecture: - memory accessed as aligned quadwords only - - uses bcmpge to compare 8 bytes in parallel - - does binary search to find 0 byte in last - quadword (HAKMEM needed 12 instructions to - do this instead of the 9 instructions that - binary search needs). */ + - uses cmpbge to compare 8 bytes in parallel + - does binary search to find 0 byte in last quadword (HAKMEM + needed 12 instructions to do this instead of the 8 instructions + that the binary search needs). +*/ #include - .set noreorder - .set noat + .set noreorder + .set noat ENTRY(strlen) - ldq_u t0, 0(a0) # load first quadword (a0 may be misaligned) - lda t1, -1(zero) - insqh t1, a0, t1 - andnot a0, 7, v0 - or t1, t0, t0 - cmpbge zero, t0, t1 # t1 <- bitmask: bit i == 1 <==> i-th byte == 0 - bne t1, found - -loop: ldq t0, 8(v0) - addq v0, 8, v0 # addr += 8 - nop # helps dual issue last two insns - cmpbge zero, t0, t1 - beq t1, loop - -found: blbs t1, done # make aligned case fast - negq t1, t2 - and t1, t2, t1 - - and t1, 0x0f, t0 - addq v0, 4, t2 - cmoveq t0, t2, v0 - - and t1, 0x33, t0 - addq v0, 2, t2 - cmoveq t0, t2, v0 - - and t1, 0x55, t0 - addq v0, 1, t2 - cmoveq t0, t2, v0 - -done: subq v0, a0, v0 - ret - - END(strlen) + ldq_u t0, 0(a0) # load first quadword (a0 may be misaligned) + lda t1, -1(zero) + insqh t1, a0, t1 + andnot a0, 7, v0 + or t1, t0, t0 + nop # dual issue the next two on ev5 + cmpbge zero, t0, t1 # t1 <- bitmask: bit i == 1 <==> i-th byte == 0 + bne t1, $found + +$loop: ldq t0, 8(v0) + addq v0, 8, v0 # addr += 8 + cmpbge zero, t0, t1 + beq t1, $loop + +$found: negq t1, t2 # clear all but least set bit + and t1, t2, t1 + + and t1, 0xf0, t2 # binary search for that set bit + and t1, 0xcc, t3 + and t1, 0xaa, t4 + cmovne t2, 4, t2 + cmovne t3, 2, t3 + cmovne t4, 1, t4 + addq t2, t3, t2 + addq v0, t4, v0 + addq v0, t2, v0 + nop # dual issue next two on ev4 and ev5 + + subq v0, a0, v0 + ret + + END(strlen) -- cgit 1.4.1