diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-08-29 21:01:47 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-08-29 21:01:47 +0000 |
commit | 800d775e426b9c0af63f711b79b09bf540c97456 (patch) | |
tree | ff7858571c81f2e6077c5e35b465494052984876 /sysdeps/powerpc/strchr.s | |
parent | 39e16978c3b4ac8eaf2201fac56316623910d9da (diff) | |
download | glibc-800d775e426b9c0af63f711b79b09bf540c97456.zip glibc-800d775e426b9c0af63f711b79b09bf540c97456.tar.gz glibc-800d775e426b9c0af63f711b79b09bf540c97456.tar.bz2 |
Update.cvs/libc-ud-970829
1997-08-29 21:45 Ulrich Drepper <drepper@cygnus.com>
* sunrpc/auth_des.c: New file. Copied from former secure_rpc add-on.
* sunrpc/authdes_prot.c: New file. Likewise.
* sunrpc/des.h: New file. Likewise.
* sunrpc/des_crypt.c: New file. Likewise.
* sunrpc/des_soft.c: New file. Likewise.
* sunrpc/key_call.c: New file. Likewise.
* sunrpc/key_prot.c: New file. Likewise.
* sunrpc/netname.c: New file. Likewise.
* sunrpc/openchild.c: New file. Likewise.
* sunrpc/rtime.c: New file. Likewise.
* sunrpc/svc_auth.c: New file. Likewise.
* sunrpc/svcauth_des.c: New file. Likewise.
* sunrpc/xcrypt.c: New file. Likewise.
* sunrpc/rpc/auth.h: New file. Likewise.
* sunrpc/rpc/auth_des.h: New file. Likewise.
* sunrpc/rpc/des_crypt.h: New file. Likewise.
* sunrpc/rpc/key_prot.h: New file. Likewise.
* sunrpc/rpcsvc/key_prot.x: New file. Likewise.
* sysdeps/generic/svc_auth.h: Removed.
* sysdeps/generic/rpc/auth.h: Removed.
* sysdeps/generic/rpc/auth_des.h: Removed.
* sysdeps/stub/des_impl.c: New file. Stub version for DES.
* sunrpc/Makefile (rpcsvc): Add keyprot.x.
(headers): Add des_crypt.h and key_prot.h.
(routines): Add auth_des, authdes_prot, des_crypt, des_impl, des_soft,
key_call, key_prot, netname, openchild, rtime, svcauth_des, xcrypt.
(distribute): Add des.h.
* db2/Makefile: Add all headers and other files to distribute.
(others): Add db_printlog.
* sysdeps/mach/hurd/Dist: Add net/* headers.
* sysdeps/mach/hurd/mips/Dist: New file.
* sysdeps/powerpc/Dist: Add fe_nomask.c and t_sqrt.c.
* sysdeps/sparc/Dist: Add sys/trap.h.
* sysdeps/sparc/sparc32/Dist: Remove sys/trap.h.
* sysdeps/sparc/sparc32/sparcv8/Dist: New file.
* sysdeps/unix/sysv/linux/mips/Dist: Add sgidefs.h.
* sysdeps/unix/sysv/linux/sparc/Dist: Add sys/trap.h.
* sysdeps/unix/sysv/linux/sparc/sparc32/Dist: Remove sys/trap.h.
Add previously missing assembler files for PPC.
* sysdeps/powerpc/add_n.s: New file.
* sysdeps/powerpc/addmul_1.s: New file.
* sysdeps/powerpc/lshift.s: New file.
* sysdeps/powerpc/memset.s: New file.
* sysdeps/powerpc/mul_1.s: New file.
* sysdeps/powerpc/rshift.s: New file.
* sysdeps/powerpc/strchr.s: New file.
* sysdeps/powerpc/strcmp.s: New file.
* sysdeps/powerpc/sub_n.s: New file.
* sysdeps/powerpc/submul_1.s: New file.
1997-08-28 18:42 Thorsten Kukuk <kukuk@uni-paderborn.de>
* nis/nis_server.c: Rewritten to fix a lot of bugs.
1997-08-28 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* md5-crypt/Makefile (LDFLAGS-md5crypt.so, libmd5crypt-map): New
variables.
in NLSPATH environment variable. Patch by HJ Lu <hjl@gnu.ai.mit.edu>.
Diffstat (limited to 'sysdeps/powerpc/strchr.s')
-rw-r--r-- | sysdeps/powerpc/strchr.s | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/sysdeps/powerpc/strchr.s b/sysdeps/powerpc/strchr.s new file mode 100644 index 0000000..c1df66f --- /dev/null +++ b/sysdeps/powerpc/strchr.s @@ -0,0 +1,118 @@ + # Optimized strchr implementation for PowerPC. + # Copyright (C) 1997 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 it under the terms of the GNU Library General Public License as + # published by the Free Software Foundation; either version 2 of the + # License, or (at your option) any later version. + # + # The GNU C Library is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # Library General Public License for more details. + # + # You should have received a copy of the GNU Library General Public + # License along with the GNU C Library; see the file COPYING.LIB. If not, + # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + # Boston, MA 02111-1307, USA. + + # See strlen.s for comments on how this works. + + .section ".text" + .align 2 + .globl strchr + .type strchr,@function +strchr: + # char * [r3] strchr (const char *s [r3] , int c [r4] ) + + # r0: a temporary + # r3: our return result. + # r4: byte we're looking for, spread over the whole word + # r5: the current word + # r6: the constant 0xfefefeff (-0x01010101) + # r7: the constant 0x7f7f7f7f + # r8: pointer to the current word. + # r9: a temporary + # r10: the number of bits we should ignore in the first word + # r11: a mask with the bits to ignore set to 0 + # r12: a temporary + + rlwimi %r4,%r4,8,16,23 + li %r11,-1 + rlwimi %r4,%r4,16,0,15 + lis %r6,0xfeff + lis %r7,0x7f7f + clrrwi %r8,%r3,2 + addi %r7,%r7,0x7f7f + addi %r6,%r6,0xfffffeff + rlwinm %r10,%r3,3,27,28 + # Test the first (partial?) word. + lwz %r5,0(%r8) + srw %r11,%r11,%r10 + orc %r5,%r5,%r11 + add %r0,%r6,%r5 + nor %r9,%r7,%r5 + and. %r0,%r0,%r9 + xor %r12,%r4,%r5 + orc %r12,%r12,%r11 + b loopentry + + # The loop. + +loop: lwzu %r5,4(%r8) + and. %r0,%r0,%r9 + # Test for 0 + add %r0,%r6,%r5 + nor %r9,%r7,%r5 + bne foundit + and. %r0,%r0,%r9 + # Start test for the bytes we're looking for + xor %r12,%r4,%r5 +loopentry: + add %r0,%r6,%r12 + nor %r9,%r7,%r12 + beq loop + # There is a zero byte in the word, but may also be a matching byte (either + # before or after the zero byte). In fact, we may be looking for a + # zero byte, in which case we return a match. We guess that this hasn't + # happened, though. +missed: + and. %r0,%r0,%r9 + li %r3,0 + beqlr + # It did happen. Decide which one was first... + # I'm not sure if this is actually faster than a sequence of + # rotates, compares, and branches (we use it anyway because it's shorter). + and %r6,%r7,%r5 + or %r11,%r7,%r5 + and %r0,%r7,%r12 + or %r10,%r7,%r12 + add %r6,%r6,%r7 + add %r0,%r0,%r7 + nor %r5,%r11,%r6 + nor %r9,%r10,%r0 + cmplw %r5,%r9 + bgtlr + cntlzw %r4,%r9 + srwi %r4,%r4,3 + add %r3,%r8,%r4 + blr + +foundit: + and %r0,%r7,%r12 + or %r10,%r7,%r12 + add %r0,%r0,%r7 + nor %r9,%r10,%r0 + cntlzw %r4,%r9 + subi %r8,%r8,4 + srwi %r4,%r4,3 + add %r3,%r8,%r4 + blr + +0: + .size strchr,0b-strchr + + .globl index + .weak index + .set index,strchr |