diff options
Diffstat (limited to 'sysdeps/powerpc')
25 files changed, 656 insertions, 653 deletions
diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile index d2f0eb275c..f2d3271925 100644 --- a/sysdeps/powerpc/Makefile +++ b/sysdeps/powerpc/Makefile @@ -1,5 +1,5 @@ ifeq ($(subdir),math) -libm-support += fenv_const fe_nomask t_sqrt +libm-support += fenv_const fe_nomask endif ifeq ($(subdir),gmon) diff --git a/sysdeps/powerpc/__longjmp.S b/sysdeps/powerpc/__longjmp.S index 875bab62fc..4981821cc3 100644 --- a/sysdeps/powerpc/__longjmp.S +++ b/sysdeps/powerpc/__longjmp.S @@ -1,5 +1,5 @@ /* longjmp for PowerPC. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1999 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 @@ -23,48 +23,48 @@ #include <bits/setjmp.h> ENTRY (__longjmp) - lwz %r1,(JB_GPR1*4)(%r3) - lwz %r2,(JB_GPR2*4)(%r3) - lwz %r0,(JB_LR*4)(%r3) - lwz %r14,((JB_GPRS+0)*4)(%r3) - lfd %f14,((JB_FPRS+0*2)*4)(%r3) - lwz %r15,((JB_GPRS+1)*4)(%r3) - lfd %f15,((JB_FPRS+1*2)*4)(%r3) - lwz %r16,((JB_GPRS+2)*4)(%r3) - lfd %f16,((JB_FPRS+2*2)*4)(%r3) - lwz %r17,((JB_GPRS+3)*4)(%r3) - lfd %f17,((JB_FPRS+3*2)*4)(%r3) - lwz %r18,((JB_GPRS+4)*4)(%r3) - lfd %f18,((JB_FPRS+4*2)*4)(%r3) - lwz %r19,((JB_GPRS+5)*4)(%r3) - lfd %f19,((JB_FPRS+5*2)*4)(%r3) - lwz %r20,((JB_GPRS+6)*4)(%r3) - lfd %f20,((JB_FPRS+6*2)*4)(%r3) - mtlr %r0 - lwz %r21,((JB_GPRS+7)*4)(%r3) - lfd %f21,((JB_FPRS+7*2)*4)(%r3) - lwz %r22,((JB_GPRS+8)*4)(%r3) - lfd %f22,((JB_FPRS+8*2)*4)(%r3) - lwz %r0,(JB_CR*4)(%r3) - lwz %r23,((JB_GPRS+9)*4)(%r3) - lfd %f23,((JB_FPRS+9*2)*4)(%r3) - lwz %r24,((JB_GPRS+10)*4)(%r3) - lfd %f24,((JB_FPRS+10*2)*4)(%r3) - lwz %r25,((JB_GPRS+11)*4)(%r3) - lfd %f25,((JB_FPRS+11*2)*4)(%r3) - mtcrf 0xFF,%r0 - lwz %r26,((JB_GPRS+12)*4)(%r3) - lfd %f26,((JB_FPRS+12*2)*4)(%r3) - lwz %r27,((JB_GPRS+13)*4)(%r3) - lfd %f27,((JB_FPRS+13*2)*4)(%r3) - lwz %r28,((JB_GPRS+14)*4)(%r3) - lfd %f28,((JB_FPRS+14*2)*4)(%r3) - lwz %r29,((JB_GPRS+15)*4)(%r3) - lfd %f29,((JB_FPRS+15*2)*4)(%r3) - lwz %r30,((JB_GPRS+16)*4)(%r3) - lfd %f30,((JB_FPRS+16*2)*4)(%r3) - lwz %r31,((JB_GPRS+17)*4)(%r3) - lfd %f31,((JB_FPRS+17*2)*4)(%r3) - mr %r3,%r4 + lwz r1,(JB_GPR1*4)(r3) + lwz r2,(JB_GPR2*4)(r3) + lwz r0,(JB_LR*4)(r3) + lwz r14,((JB_GPRS+0)*4)(r3) + lfd f14,((JB_FPRS+0*2)*4)(r3) + lwz r15,((JB_GPRS+1)*4)(r3) + lfd f15,((JB_FPRS+1*2)*4)(r3) + lwz r16,((JB_GPRS+2)*4)(r3) + lfd f16,((JB_FPRS+2*2)*4)(r3) + lwz r17,((JB_GPRS+3)*4)(r3) + lfd f17,((JB_FPRS+3*2)*4)(r3) + lwz r18,((JB_GPRS+4)*4)(r3) + lfd f18,((JB_FPRS+4*2)*4)(r3) + lwz r19,((JB_GPRS+5)*4)(r3) + lfd f19,((JB_FPRS+5*2)*4)(r3) + lwz r20,((JB_GPRS+6)*4)(r3) + lfd f20,((JB_FPRS+6*2)*4)(r3) + mtlr r0 + lwz r21,((JB_GPRS+7)*4)(r3) + lfd f21,((JB_FPRS+7*2)*4)(r3) + lwz r22,((JB_GPRS+8)*4)(r3) + lfd f22,((JB_FPRS+8*2)*4)(r3) + lwz r0,(JB_CR*4)(r3) + lwz r23,((JB_GPRS+9)*4)(r3) + lfd f23,((JB_FPRS+9*2)*4)(r3) + lwz r24,((JB_GPRS+10)*4)(r3) + lfd f24,((JB_FPRS+10*2)*4)(r3) + lwz r25,((JB_GPRS+11)*4)(r3) + lfd f25,((JB_FPRS+11*2)*4)(r3) + mtcrf 0xFF,r0 + lwz r26,((JB_GPRS+12)*4)(r3) + lfd f26,((JB_FPRS+12*2)*4)(r3) + lwz r27,((JB_GPRS+13)*4)(r3) + lfd f27,((JB_FPRS+13*2)*4)(r3) + lwz r28,((JB_GPRS+14)*4)(r3) + lfd f28,((JB_FPRS+14*2)*4)(r3) + lwz r29,((JB_GPRS+15)*4)(r3) + lfd f29,((JB_FPRS+15*2)*4)(r3) + lwz r30,((JB_GPRS+16)*4)(r3) + lfd f30,((JB_FPRS+16*2)*4)(r3) + lwz r31,((JB_GPRS+17)*4)(r3) + lfd f31,((JB_FPRS+17*2)*4)(r3) + mr r3,r4 blr END (__longjmp) diff --git a/sysdeps/powerpc/add_n.S b/sysdeps/powerpc/add_n.S index 2bd59ae4a7..88f5b9cf7a 100644 --- a/sysdeps/powerpc/add_n.S +++ b/sysdeps/powerpc/add_n.S @@ -1,5 +1,5 @@ /* Add two limb vectors of equal, non-zero length for PowerPC. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 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 @@ -29,40 +29,40 @@ EALIGN(__mpn_add_n,3,0) /* Set up for loop below. */ - mtcrf 0x01,%r6 - srwi. %r7,%r6,1 - li %r10,0 - mtctr %r7 + mtcrf 0x01,r6 + srwi. r7,r6,1 + li r10,0 + mtctr r7 bt 31,2f /* Clear the carry. */ - addic %r0,%r0,0 + addic r0,r0,0 /* Adjust pointers for loop. */ - addi %r3,%r3,-4 - addi %r4,%r4,-4 - addi %r5,%r5,-4 + addi r3,r3,-4 + addi r4,r4,-4 + addi r5,r5,-4 b 0f -2: lwz %r7,0(%r5) - lwz %r6,0(%r4) - addc %r6,%r6,%r7 - stw %r6,0(%r3) +2: lwz r7,0(r5) + lwz r6,0(r4) + addc r6,r6,r7 + stw r6,0(r3) beq 1f /* The loop. */ /* Align start of loop to an odd word boundary to guarantee that the last two words can be fetched in one access (for 601). */ -0: lwz %r9,4(%r4) - lwz %r8,4(%r5) - lwzu %r6,8(%r4) - lwzu %r7,8(%r5) - adde %r8,%r9,%r8 - stw %r8,4(%r3) - adde %r6,%r6,%r7 - stwu %r6,8(%r3) +0: lwz r9,4(r4) + lwz r8,4(r5) + lwzu r6,8(r4) + lwzu r7,8(r5) + adde r8,r9,r8 + stw r8,4(r3) + adde r6,r6,r7 + stwu r6,8(r3) bdnz 0b /* Return the carry. */ -1: addze %r3,%r10 +1: addze r3,r10 blr END(__mpn_add_n) diff --git a/sysdeps/powerpc/addmul_1.S b/sysdeps/powerpc/addmul_1.S index dc762fcc43..b7d50665e7 100644 --- a/sysdeps/powerpc/addmul_1.S +++ b/sysdeps/powerpc/addmul_1.S @@ -1,5 +1,5 @@ /* Multiply a limb vector by a single limb, for PowerPC. - Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1997, 1999 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 @@ -23,27 +23,27 @@ mp_size_t s1_size, mp_limb_t s2_limb) Calculate res+s1*s2 and put result back in res; return carry. */ ENTRY(__mpn_addmul_1) - mtctr %r5 - - lwz %r0,0(%r4) - mullw %r7,%r0,%r6 - mulhwu %r10,%r0,%r6 - lwz %r9,0(%r3) - addc %r8,%r7,%r9 - addi %r3,%r3,-4 /* adjust res_ptr */ + mtctr r5 + + lwz r0,0(r4) + mullw r7,r0,r6 + mulhwu r10,r0,r6 + lwz r9,0(r3) + addc r8,r7,r9 + addi r3,r3,-4 /* adjust res_ptr */ bdz 1f -0: lwzu %r0,4(%r4) - stwu %r8,4(%r3) - mullw %r8,%r0,%r6 - adde %r7,%r8,%r10 - mulhwu %r10,%r0,%r6 - lwz %r9,4(%r3) - addze %r10,%r10 - addc %r8,%r7,%r9 +0: lwzu r0,4(r4) + stwu r8,4(r3) + mullw r8,r0,r6 + adde r7,r8,r10 + mulhwu r10,r0,r6 + lwz r9,4(r3) + addze r10,r10 + addc r8,r7,r9 bdnz 0b -1: stw %r8,4(%r3) - addze %r3,%r10 +1: stw r8,4(r3) + addze r3,r10 blr END(__mpn_addmul_1) diff --git a/sysdeps/powerpc/bsd-_setjmp.S b/sysdeps/powerpc/bsd-_setjmp.S index ef31f841c4..bb9b6cffce 100644 --- a/sysdeps/powerpc/bsd-_setjmp.S +++ b/sysdeps/powerpc/bsd-_setjmp.S @@ -1,5 +1,5 @@ /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. PowerPC version. - Copyright (C) 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 1999 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,6 +24,6 @@ #include <sysdep.h> ENTRY (_setjmp) - li %r4,0 /* Set second argument to 0. */ + li r4,0 /* Set second argument to 0. */ b JUMPTARGET(__sigsetjmp) END (_setjmp) diff --git a/sysdeps/powerpc/bsd-setjmp.S b/sysdeps/powerpc/bsd-setjmp.S index d26b3fc93e..29e6c7a043 100644 --- a/sysdeps/powerpc/bsd-setjmp.S +++ b/sysdeps/powerpc/bsd-setjmp.S @@ -1,5 +1,5 @@ /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. PowerPC version. - Copyright (C) 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 1994, 1997, 1999 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,7 @@ #include <sysdep.h> ENTRY (__setjmp) - li %r4,1 /* Set second argument to 1. */ + li r4,1 /* Set second argument to 1. */ b JUMPTARGET(__sigsetjmp) END (__setjmp) diff --git a/sysdeps/powerpc/bzero.S b/sysdeps/powerpc/bzero.S index 783a91fdcb..f914123563 100644 --- a/sysdeps/powerpc/bzero.S +++ b/sysdeps/powerpc/bzero.S @@ -1,5 +1,5 @@ /* Optimized bzero `implementation' for PowerPC. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 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 @@ -20,8 +20,8 @@ #include <sysdep.h> ENTRY(__bzero) - mr %r5,%r4 - li %r4,0 + mr r5,r4 + li r4,0 b memset@local END(__bzero) weak_alias (__bzero, bzero) diff --git a/sysdeps/powerpc/dl-start.S b/sysdeps/powerpc/dl-start.S index 7865bb6dc2..42ae370eef 100644 --- a/sysdeps/powerpc/dl-start.S +++ b/sysdeps/powerpc/dl-start.S @@ -1,5 +1,5 @@ /* Machine-dependent ELF startup code. PowerPC version. - Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998, 1999 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 @@ -30,12 +30,12 @@ ENTRY(_start) arguments for the program loader. */ /* Call _dl_start with one parameter pointing at argc */ - mr %r3,%r1 + mr r3,r1 /* (we have to frob the stack pointer a bit to allow room for _dl_start to save the link register). */ - li %r4,0 - addi %r1,%r1,-16 - stw %r4,0(%r1) + li r4,0 + addi r1,r1,-16 + stw r4,0(r1) bl _dl_start@local /* Now, we do our main work of calling initialisation procedures. @@ -46,50 +46,50 @@ ENTRY(_start) /* Put our GOT pointer in r31, */ bl _GLOBAL_OFFSET_TABLE_-4@local - mflr %r31 + mflr r31 /* the address of _start in r30, */ - mr %r30,%r3 + mr r30,r3 /* &_dl_argc in 29, &_dl_argv in 27, and _dl_main_searchlist in 28. */ - lwz %r28,_dl_main_searchlist@got(%r31) - lwz %r29,_dl_argc@got(%r31) - lwz %r27,_dl_argv@got(%r31) + lwz r28,_dl_main_searchlist@got(r31) + lwz r29,_dl_argc@got(r31) + lwz r27,_dl_argv@got(r31) 0: /* Set initfunc = _dl_init_next(_dl_main_searchlist) */ - lwz %r3,0(%r28) + lwz r3,0(r28) bl _dl_init_next@plt /* If initfunc is NULL, we exit the loop; otherwise, */ - cmpwi %r3,0 + cmpwi r3,0 beq 1f /* call initfunc(_dl_argc, _dl_argv, _dl_argv+_dl_argc+1) */ - mtlr %r3 - lwz %r3,0(%r29) - lwz %r4,0(%r27) - slwi %r5,%r3,2 - add %r5,%r4,%r5 - addi %r5,%r5,4 + mtlr r3 + lwz r3,0(r29) + lwz r4,0(r27) + slwi r5,r3,2 + add r5,r4,r5 + addi r5,r5,4 blrl /* and loop. */ b 0b 1: /* Now, to conform to the ELF ABI, we have to: */ /* Pass argc (actually _dl_argc) in r3; */ - lwz %r3,0(%r29) + lwz r3,0(r29) /* pass argv (actually _dl_argv) in r4; */ - lwz %r4,0(%r27) + lwz r4,0(r27) /* pass envp (actually _dl_argv+_dl_argc+1) in r5; */ - slwi %r5,%r3,2 - add %r6,%r4,%r5 - addi %r5,%r6,4 + slwi r5,r3,2 + add r6,r4,r5 + addi r5,r6,4 /* pass the auxilary vector in r6. This is passed to us just after _envp. */ -2: lwzu %r0,4(%r6) - cmpwi %r0,0 +2: lwzu r0,4(r6) + cmpwi r0,0 bne 2b - addi %r6,%r6,4 + addi r6,r6,4 /* Pass a termination function pointer (in this case _dl_fini) in r7. */ - lwz %r7,_dl_fini@got(%r31) + lwz r7,_dl_fini@got(r31) /* Now, call the start function in r30... */ - mtctr %r30 - lwz %r26,_dl_starting_up@got(%r31) + mtctr r30 + lwz r26,_dl_starting_up@got(r31) /* Pass the stack pointer in r1 (so far so good), pointing to a NULL value. (This lets our startup code distinguish between a program linked statically, which linux will call with argc on top of the stack which will hopefully @@ -98,14 +98,14 @@ ENTRY(_start) Take the opportunity to clear LR, so anyone who accidentally returns from _start gets SEGV. Also clear the next few words of the stack. */ - li %r31,0 - stw %r31,0(%r1) - mtlr %r31 - stw %r31,4(%r1) - stw %r31,8(%r1) - stw %r31,12(%r1) + li r31,0 + stw r31,0(r1) + mtlr r31 + stw r31,4(r1) + stw r31,8(r1) + stw r31,12(r1) /* Clear _dl_starting_up. */ - stw %r31,0(%r26) + stw r31,0(r26) /* Go do it! */ bctr END(_start) diff --git a/sysdeps/powerpc/elf/start.S b/sysdeps/powerpc/elf/start.S index a52ac8b64d..63a4979059 100644 --- a/sysdeps/powerpc/elf/start.S +++ b/sysdeps/powerpc/elf/start.S @@ -1,5 +1,5 @@ /* Startup code for programs linked with GNU libc. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 1999 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 @@ -43,17 +43,17 @@ L(start_addresses): .section ".text" ENTRY(_start) /* Save the stack pointer, in case we're statically linked under Linux. */ - mr %r9,%r1 + mr r9,r1 /* Set up an initial stack frame, and clear the LR. */ - clrrwi %r1,%r1,4 - li %r0,0 - stwu %r1,-16(%r1) - mtlr %r0 - stw %r0,0(%r1) + clrrwi r1,r1,4 + li r0,0 + stwu r1,-16(r1) + mtlr r0 + stw r0,0(r1) /* Set r13 to point at the 'small data area', and put the address of start_addresses in r8... */ - lis %r8,L(start_addresses)@ha - lwzu %r13,L(start_addresses)@l(%r8) + lis r8,L(start_addresses)@ha + lwzu r13,L(start_addresses)@l(r8) /* and continue in libc-start, in glibc. */ b JUMPTARGET(__libc_start_main) END(_start) diff --git a/sysdeps/powerpc/fpu/Makefile b/sysdeps/powerpc/fpu/Makefile new file mode 100644 index 0000000000..bf2ed92e7b --- /dev/null +++ b/sysdeps/powerpc/fpu/Makefile @@ -0,0 +1,3 @@ +ifeq ($(subdir),math) +libm-support += fenv_const fe_nomask t_sqrt +endif diff --git a/sysdeps/powerpc/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c index 9416ea60c8..9416ea60c8 100644 --- a/sysdeps/powerpc/e_sqrt.c +++ b/sysdeps/powerpc/fpu/e_sqrt.c diff --git a/sysdeps/powerpc/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c index 01c76d6757..01c76d6757 100644 --- a/sysdeps/powerpc/e_sqrtf.c +++ b/sysdeps/powerpc/fpu/e_sqrtf.c diff --git a/sysdeps/powerpc/lshift.S b/sysdeps/powerpc/lshift.S index b1487a1c17..2d3b996f54 100644 --- a/sysdeps/powerpc/lshift.S +++ b/sysdeps/powerpc/lshift.S @@ -1,5 +1,5 @@ /* Shift a limb left, low level routine. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999 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 @@ -23,68 +23,68 @@ unsigned int cnt) */ EALIGN(__mpn_lshift,3,0) - mtctr %r5 # copy size into CTR - cmplwi %cr0,%r5,16 # is size < 16 - slwi %r0,%r5,2 - add %r7,%r3,%r0 # make r7 point at end of res - add %r4,%r4,%r0 # make r4 point at end of s1 - lwzu %r11,-4(%r4) # load first s1 limb - subfic %r8,%r6,32 - srw %r3,%r11,%r8 # compute function return value - bge %cr0,L(big) # branch if size >= 16 + mtctr r5 # copy size into CTR + cmplwi cr0,r5,16 # is size < 16 + slwi r0,r5,2 + add r7,r3,r0 # make r7 point at end of res + add r4,r4,r0 # make r4 point at end of s1 + lwzu r11,-4(r4) # load first s1 limb + subfic r8,r6,32 + srw r3,r11,r8 # compute function return value + bge cr0,L(big) # branch if size >= 16 bdz L(end1) -0: lwzu %r10,-4(%r4) - slw %r9,%r11,%r6 - srw %r12,%r10,%r8 - or %r9,%r9,%r12 - stwu %r9,-4(%r7) +0: lwzu r10,-4(r4) + slw r9,r11,r6 + srw r12,r10,r8 + or r9,r9,r12 + stwu r9,-4(r7) bdz L(end2) - lwzu %r11,-4(%r4) - slw %r9,%r10,%r6 - srw %r12,%r11,%r8 - or %r9,%r9,%r12 - stwu %r9,-4(%r7) + lwzu r11,-4(r4) + slw r9,r10,r6 + srw r12,r11,r8 + or r9,r9,r12 + stwu r9,-4(r7) bdnz 0b -L(end1):slw %r0,%r11,%r6 - stw %r0,-4(%r7) +L(end1):slw r0,r11,r6 + stw r0,-4(r7) blr /* Guaranteed not to succeed. */ -L(boom): tweq %r0,%r0 +L(boom): tweq r0,r0 /* We imitate a case statement, by using (yuk!) fixed-length code chunks, of size 4*12 bytes. We have to do this (or something) to make this PIC. */ -L(big): mflr %r9 - bltl- %cr0,L(boom) # Never taken, only used to set LR. - slwi %r10,%r6,4 - mflr %r12 - add %r10,%r12,%r10 - slwi %r8,%r6,5 - add %r10,%r8,%r10 - mtctr %r10 - addi %r5,%r5,-1 - mtlr %r9 +L(big): mflr r9 + bltl- cr0,L(boom) # Never taken, only used to set LR. + slwi r10,r6,4 + mflr r12 + add r10,r12,r10 + slwi r8,r6,5 + add r10,r8,r10 + mtctr r10 + addi r5,r5,-1 + mtlr r9 bctr -L(end2):slw %r0,%r10,%r6 - stw %r0,-4(%r7) +L(end2):slw r0,r10,r6 + stw r0,-4(r7) blr #define DO_LSHIFT(n) \ - mtctr %r5; \ -0: lwzu %r10,-4(%r4); \ - slwi %r9,%r11,n; \ - inslwi %r9,%r10,n,32-n; \ - stwu %r9,-4(%r7); \ + mtctr r5; \ +0: lwzu r10,-4(r4); \ + slwi r9,r11,n; \ + inslwi r9,r10,n,32-n; \ + stwu r9,-4(r7); \ bdz- L(end2); \ - lwzu %r11,-4(%r4); \ - slwi %r9,%r10,n; \ - inslwi %r9,%r11,n,32-n; \ - stwu %r9,-4(%r7); \ + lwzu r11,-4(r4); \ + slwi r9,r10,n; \ + inslwi r9,r11,n,32-n; \ + stwu r9,-4(r7); \ bdnz 0b; \ b L(end1) diff --git a/sysdeps/powerpc/memset.S b/sysdeps/powerpc/memset.S index 6ac32ddc99..63c4c14c64 100644 --- a/sysdeps/powerpc/memset.S +++ b/sysdeps/powerpc/memset.S @@ -1,5 +1,5 @@ /* Optimized memset implementation for PowerPC. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 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 @@ -30,170 +30,170 @@ EALIGN(memset,5,1) r7: number of bytes we are setting now (when aligning) */ /* take care of case for size <= 4 */ - cmplwi %cr1,%r5,4 - andi. %r7,%r3,3 - mr %r6,%r3 - ble- %cr1,L(small) + cmplwi cr1,r5,4 + andi. r7,r3,3 + mr r6,r3 + ble- cr1,L(small) /* align to word boundary */ - cmplwi %cr5,%r5,31 - rlwimi %r4,%r4,8,16,23 + cmplwi cr5,r5,31 + rlwimi r4,r4,8,16,23 beq+ L(aligned) # 8th instruction from .align - mtcrf 0x01,%r3 - subfic %r7,%r7,4 - add %r6,%r6,%r7 - sub %r5,%r5,%r7 + mtcrf 0x01,r3 + subfic r7,r7,4 + add r6,r6,r7 + sub r5,r5,r7 bf+ 31,0f - stb %r4,0(%r3) + stb r4,0(r3) bt 30,L(aligned) -0: sth %r4,-2(%r6) # 16th instruction from .align +0: sth r4,-2(r6) # 16th instruction from .align /* take care of case for size < 31 */ L(aligned): - mtcrf 0x01,%r5 - rlwimi %r4,%r4,16,0,15 - ble %cr5,L(medium) + mtcrf 0x01,r5 + rlwimi r4,r4,16,0,15 + ble cr5,L(medium) /* align to cache line boundary... */ - andi. %r7,%r6,0x1C - subfic %r7,%r7,0x20 + andi. r7,r6,0x1C + subfic r7,r7,0x20 beq L(caligned) - mtcrf 0x01,%r7 - add %r6,%r6,%r7 - sub %r5,%r5,%r7 - cmplwi %cr1,%r7,0x10 - mr %r8,%r6 + mtcrf 0x01,r7 + add r6,r6,r7 + sub r5,r5,r7 + cmplwi cr1,r7,0x10 + mr r8,r6 bf 28,1f - stw %r4,-4(%r8) - stwu %r4,-8(%r8) -1: blt %cr1,2f - stw %r4,-4(%r8) # 32nd instruction from .align - stw %r4,-8(%r8) - stw %r4,-12(%r8) - stwu %r4,-16(%r8) + stw r4,-4(r8) + stwu r4,-8(r8) +1: blt cr1,2f + stw r4,-4(r8) # 32nd instruction from .align + stw r4,-8(r8) + stw r4,-12(r8) + stwu r4,-16(r8) 2: bf 29,L(caligned) - stw %r4,-4(%r8) + stw r4,-4(r8) /* now aligned to a cache line. */ L(caligned): - cmplwi %cr1,%r4,0 - clrrwi. %r7,%r5,5 - mtcrf 0x01,%r5 # 40th instruction from .align - beq %cr1,L(zloopstart) # special case for clearing memory using dcbz - srwi %r0,%r7,5 - mtctr %r0 + cmplwi cr1,r4,0 + clrrwi. r7,r5,5 + mtcrf 0x01,r5 # 40th instruction from .align + beq cr1,L(zloopstart) # special case for clearing memory using dcbz + srwi r0,r7,5 + mtctr r0 beq L(medium) # we may not actually get to do a full line - clrlwi. %r5,%r5,27 - add %r6,%r6,%r7 -0: li %r8,-0x40 + clrlwi. r5,r5,27 + add r6,r6,r7 +0: li r8,-0x40 bdz L(cloopdone) # 48th instruction from .align -3: dcbz %r8,%r6 - stw %r4,-4(%r6) - stw %r4,-8(%r6) - stw %r4,-12(%r6) - stw %r4,-16(%r6) +3: dcbz r8,r6 + stw r4,-4(r6) + stw r4,-8(r6) + stw r4,-12(r6) + stw r4,-16(r6) nop # let 601 fetch last 4 instructions of loop - stw %r4,-20(%r6) - stw %r4,-24(%r6) # 56th instruction from .align + stw r4,-20(r6) + stw r4,-24(r6) # 56th instruction from .align nop # let 601 fetch first 8 instructions of loop - stw %r4,-28(%r6) - stwu %r4,-32(%r6) + stw r4,-28(r6) + stwu r4,-32(r6) bdnz 3b L(cloopdone): - stw %r4,-4(%r6) - stw %r4,-8(%r6) - stw %r4,-12(%r6) - stw %r4,-16(%r6) # 64th instruction from .align - stw %r4,-20(%r6) - cmplwi %cr1,%r5,16 - stw %r4,-24(%r6) - stw %r4,-28(%r6) - stwu %r4,-32(%r6) + stw r4,-4(r6) + stw r4,-8(r6) + stw r4,-12(r6) + stw r4,-16(r6) # 64th instruction from .align + stw r4,-20(r6) + cmplwi cr1,r5,16 + stw r4,-24(r6) + stw r4,-28(r6) + stwu r4,-32(r6) beqlr - add %r6,%r6,%r7 + add r6,r6,r7 b L(medium_tail2) # 72nd instruction from .align .align 5 nop /* Clear lines of memory in 128-byte chunks. */ L(zloopstart): - clrlwi %r5,%r5,27 - mtcrf 0x02,%r7 - srwi. %r0,%r7,7 - mtctr %r0 - li %r7,0x20 - li %r8,-0x40 - cmplwi %cr1,%r5,16 # 8 + clrlwi r5,r5,27 + mtcrf 0x02,r7 + srwi. r0,r7,7 + mtctr r0 + li r7,0x20 + li r8,-0x40 + cmplwi cr1,r5,16 # 8 bf 26,0f - dcbz 0,%r6 - addi %r6,%r6,0x20 -0: li %r9,-0x20 + dcbz 0,r6 + addi r6,r6,0x20 +0: li r9,-0x20 bf 25,1f - dcbz 0,%r6 - dcbz %r7,%r6 - addi %r6,%r6,0x40 # 16 -1: cmplwi %cr5,%r5,0 + dcbz 0,r6 + dcbz r7,r6 + addi r6,r6,0x40 # 16 +1: cmplwi cr5,r5,0 beq L(medium) L(zloop): - dcbz 0,%r6 - dcbz %r7,%r6 - addi %r6,%r6,0x80 - dcbz %r8,%r6 - dcbz %r9,%r6 + dcbz 0,r6 + dcbz r7,r6 + addi r6,r6,0x80 + dcbz r8,r6 + dcbz r9,r6 bdnz L(zloop) - beqlr %cr5 + beqlr cr5 b L(medium_tail2) .align 5 L(small): /* Memset of 4 bytes or less. */ - cmplwi %cr5,%r5,1 - cmplwi %cr1,%r5,3 - bltlr %cr5 - stb %r4,0(%r6) - beqlr %cr5 + cmplwi cr5,r5,1 + cmplwi cr1,r5,3 + bltlr cr5 + stb r4,0(r6) + beqlr cr5 nop - stb %r4,1(%r6) - bltlr %cr1 - stb %r4,2(%r6) - beqlr %cr1 + stb r4,1(r6) + bltlr cr1 + stb r4,2(r6) + beqlr cr1 nop - stb %r4,3(%r6) + stb r4,3(r6) blr /* Memset of 0-31 bytes. */ .align 5 L(medium): - cmplwi %cr1,%r5,16 + cmplwi cr1,r5,16 L(medium_tail2): - add %r6,%r6,%r5 + add r6,r6,r5 L(medium_tail): bt- 31,L(medium_31t) bt- 30,L(medium_30t) L(medium_30f): bt- 29,L(medium_29t) L(medium_29f): - bge- %cr1,L(medium_27t) + bge- cr1,L(medium_27t) bflr- 28 - stw %r4,-4(%r6) # 8th instruction from .align - stw %r4,-8(%r6) + stw r4,-4(r6) # 8th instruction from .align + stw r4,-8(r6) blr L(medium_31t): - stbu %r4,-1(%r6) + stbu r4,-1(r6) bf- 30,L(medium_30f) L(medium_30t): - sthu %r4,-2(%r6) + sthu r4,-2(r6) bf- 29,L(medium_29f) L(medium_29t): - stwu %r4,-4(%r6) - blt- %cr1,L(medium_27f) # 16th instruction from .align + stwu r4,-4(r6) + blt- cr1,L(medium_27f) # 16th instruction from .align L(medium_27t): - stw %r4,-4(%r6) - stw %r4,-8(%r6) - stw %r4,-12(%r6) - stwu %r4,-16(%r6) + stw r4,-4(r6) + stw r4,-8(r6) + stw r4,-12(r6) + stwu r4,-16(r6) L(medium_27f): bflr- 28 L(medium_28t): - stw %r4,-4(%r6) - stw %r4,-8(%r6) + stw r4,-4(r6) + stw r4,-8(r6) blr END(memset) diff --git a/sysdeps/powerpc/mul_1.S b/sysdeps/powerpc/mul_1.S index d48bd8fa19..f0d8f079e5 100644 --- a/sysdeps/powerpc/mul_1.S +++ b/sysdeps/powerpc/mul_1.S @@ -1,5 +1,5 @@ /* Multiply a limb vector by a limb, for PowerPC. - Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1997, 1999 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,23 +24,23 @@ Calculate s1*s2 and put result in res_ptr; return carry. */ ENTRY(__mpn_mul_1) - mtctr %r5 + mtctr r5 - lwz %r0,0(%r4) - mullw %r7,%r0,%r6 - mulhwu %r10,%r0,%r6 - addi %r3,%r3,-4 # adjust res_ptr - addic %r5,%r5,0 # clear cy with dummy insn + lwz r0,0(r4) + mullw r7,r0,r6 + mulhwu r10,r0,r6 + addi r3,r3,-4 # adjust res_ptr + addic r5,r5,0 # clear cy with dummy insn bdz 1f -0: lwzu %r0,4(%r4) - stwu %r7,4(%r3) - mullw %r8,%r0,%r6 - adde %r7,%r8,%r10 - mulhwu %r10,%r0,%r6 +0: lwzu r0,4(r4) + stwu r7,4(r3) + mullw r8,r0,r6 + adde r7,r8,r10 + mulhwu r10,r0,r6 bdnz 0b -1: stw %r7,4(%r3) - addze %r3,%r10 +1: stw r7,4(r3) + addze r3,r10 blr END(__mpn_mul_1) diff --git a/sysdeps/powerpc/ppc-mcount.S b/sysdeps/powerpc/ppc-mcount.S index 06f1fcda12..ce5a04eb5a 100644 --- a/sysdeps/powerpc/ppc-mcount.S +++ b/sysdeps/powerpc/ppc-mcount.S @@ -1,5 +1,5 @@ /* PowerPC-specific implementation of profiling support. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 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 @@ -28,9 +28,9 @@ with the address of a data word in r0 (that is different for every routine, initialised to 0, and otherwise unused). The caller has put the address the caller will return to in the usual place on the stack, - 4(%r1). _mcount is responsible for ensuring that when it returns no + 4(r1). _mcount is responsible for ensuring that when it returns no argument-passing registers are disturbed, and that the LR is set back - to (what the caller sees as) 4(%r1). + to (what the caller sees as) 4(r1). This is intended so that the following code can be inserted at the front of any routine without changing the routine: @@ -39,46 +39,46 @@ .align 2 0: .long 0 .previous - mflr %r0 - lis %r11,0b@ha - stw %r0,4(%r1) - addi %r0,%r11,0b@l + mflr r0 + lis r11,0b@ha + stw r0,4(r1) + addi r0,r11,0b@l bl _mcount */ ENTRY(_mcount) - stwu %r1,-48(%r1) + stwu r1,-48(r1) /* We need to save the parameter-passing registers. */ - stw %r3, 12(%r1) - stw %r4, 16(%r1) - stw %r5, 20(%r1) - stw %r6, 24(%r1) - mflr %r4 - lwz %r3, 52(%r1) - mfcr %r5 - stw %r7, 28(%r1) - stw %r8, 32(%r1) - stw %r9, 36(%r1) - stw %r10,40(%r1) - stw %r4, 44(%r1) - stw %r5, 8(%r1) + stw r3, 12(r1) + stw r4, 16(r1) + stw r5, 20(r1) + stw r6, 24(r1) + mflr r4 + lwz r3, 52(r1) + mfcr r5 + stw r7, 28(r1) + stw r8, 32(r1) + stw r9, 36(r1) + stw r10,40(r1) + stw r4, 44(r1) + stw r5, 8(r1) bl JUMPTARGET(__mcount_internal) /* Restore the registers... */ - lwz %r6, 8(%r1) - lwz %r0, 44(%r1) - lwz %r3, 12(%r1) - mtctr %r0 - lwz %r4, 16(%r1) - mtcrf 0xff,%r6 - lwz %r5, 20(%r1) - lwz %r6, 24(%r1) - lwz %r0, 52(%r1) - lwz %r7, 28(%r1) - lwz %r8, 32(%r1) - mtlr %r0 - lwz %r9, 36(%r1) - lwz %r10,40(%r1) + lwz r6, 8(r1) + lwz r0, 44(r1) + lwz r3, 12(r1) + mtctr r0 + lwz r4, 16(r1) + mtcrf 0xff,r6 + lwz r5, 20(r1) + lwz r6, 24(r1) + lwz r0, 52(r1) + lwz r7, 28(r1) + lwz r8, 32(r1) + mtlr r0 + lwz r9, 36(r1) + lwz r10,40(r1) /* ...unwind the stack frame, and return to your usual programming. */ - addi %r1,%r1,48 + addi r1,r1,48 bctr END(_mcount) diff --git a/sysdeps/powerpc/rshift.S b/sysdeps/powerpc/rshift.S index eb1f562bed..c09a2a9c5a 100644 --- a/sysdeps/powerpc/rshift.S +++ b/sysdeps/powerpc/rshift.S @@ -1,5 +1,5 @@ /* Shift a limb right, low level routine. - Copyright (C) 1995, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1997, 1999 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 @@ -26,31 +26,31 @@ cnt r6 */ ENTRY(__mpn_rshift) - mtctr 5 # copy size into CTR - addi 7,3,-4 # move adjusted res_ptr to free return reg - subfic 8,6,32 - lwz 11,0(4) # load first s1 limb - slw 3,11,8 # compute function return value + mtctr r5 # copy size into CTR + addi r7,r3,-4 # move adjusted res_ptr to free return reg + subfic r8,r6,32 + lwz r11,0(r4) # load first s1 limb + slw r3,r11,r8 # compute function return value bdz 1f -0: lwzu 10,4(4) - srw 9,11,6 - slw 12,10,8 - or 9,9,12 - stwu 9,4(7) +0: lwzu r10,4(r4) + srw r9,r11,r6 + slw r12,r10,r8 + or r9,r9,r12 + stwu r9,4(r7) bdz 2f - lwzu 11,4(4) - srw 9,10,6 - slw 12,11,8 - or 9,9,12 - stwu 9,4(7) + lwzu r11,4(r4) + srw r9,r10,r6 + slw r12,r11,r8 + or r9,r9,r12 + stwu r9,4(r7) bdnz 0b -1: srw 0,11,6 - stw 0,4(7) +1: srw r0,r11,r6 + stw r0,4(r7) blr -2: srw 0,10,6 - stw 0,4(7) +2: srw r0,r10,r6 + stw r0,4(r7) blr END(__mpn_rshift) diff --git a/sysdeps/powerpc/setjmp.S b/sysdeps/powerpc/setjmp.S index 32b1b94c30..fca7e9f204 100644 --- a/sysdeps/powerpc/setjmp.S +++ b/sysdeps/powerpc/setjmp.S @@ -1,5 +1,5 @@ /* setjmp for PowerPC. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1999 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 @@ -23,47 +23,47 @@ #include <bits/setjmp.h> ENTRY (__sigsetjmp) - stw %r1,(JB_GPR1*4)(3) - mflr %r0 - stw %r2,(JB_GPR2*4)(3) - stw %r14,((JB_GPRS+0)*4)(3) - stfd %f14,((JB_FPRS+0*2)*4)(3) - stw %r0,(JB_LR*4)(3) - stw %r15,((JB_GPRS+1)*4)(3) - stfd %f15,((JB_FPRS+1*2)*4)(3) - mfcr %r0 - stw %r16,((JB_GPRS+2)*4)(3) - stfd %f16,((JB_FPRS+2*2)*4)(3) - stw %r0,(JB_CR*4)(3) - stw %r17,((JB_GPRS+3)*4)(3) - stfd %f17,((JB_FPRS+3*2)*4)(3) - stw %r18,((JB_GPRS+4)*4)(3) - stfd %f18,((JB_FPRS+4*2)*4)(3) - stw %r19,((JB_GPRS+5)*4)(3) - stfd %f19,((JB_FPRS+5*2)*4)(3) - stw %r20,((JB_GPRS+6)*4)(3) - stfd %f20,((JB_FPRS+6*2)*4)(3) - stw %r21,((JB_GPRS+7)*4)(3) - stfd %f21,((JB_FPRS+7*2)*4)(3) - stw %r22,((JB_GPRS+8)*4)(3) - stfd %f22,((JB_FPRS+8*2)*4)(3) - stw %r23,((JB_GPRS+9)*4)(3) - stfd %f23,((JB_FPRS+9*2)*4)(3) - stw %r24,((JB_GPRS+10)*4)(3) - stfd %f24,((JB_FPRS+10*2)*4)(3) - stw %r25,((JB_GPRS+11)*4)(3) - stfd %f25,((JB_FPRS+11*2)*4)(3) - stw %r26,((JB_GPRS+12)*4)(3) - stfd %f26,((JB_FPRS+12*2)*4)(3) - stw %r27,((JB_GPRS+13)*4)(3) - stfd %f27,((JB_FPRS+13*2)*4)(3) - stw %r28,((JB_GPRS+14)*4)(3) - stfd %f28,((JB_FPRS+14*2)*4)(3) - stw %r29,((JB_GPRS+15)*4)(3) - stfd %f29,((JB_FPRS+15*2)*4)(3) - stw %r30,((JB_GPRS+16)*4)(3) - stfd %f30,((JB_FPRS+16*2)*4)(3) - stw %r31,((JB_GPRS+17)*4)(3) - stfd %f31,((JB_FPRS+17*2)*4)(3) + stw r1,(JB_GPR1*4)(3) + mflr r0 + stw r2,(JB_GPR2*4)(3) + stw r14,((JB_GPRS+0)*4)(3) + stfd f14,((JB_FPRS+0*2)*4)(3) + stw r0,(JB_LR*4)(3) + stw r15,((JB_GPRS+1)*4)(3) + stfd f15,((JB_FPRS+1*2)*4)(3) + mfcr r0 + stw r16,((JB_GPRS+2)*4)(3) + stfd f16,((JB_FPRS+2*2)*4)(3) + stw r0,(JB_CR*4)(3) + stw r17,((JB_GPRS+3)*4)(3) + stfd f17,((JB_FPRS+3*2)*4)(3) + stw r18,((JB_GPRS+4)*4)(3) + stfd f18,((JB_FPRS+4*2)*4)(3) + stw r19,((JB_GPRS+5)*4)(3) + stfd f19,((JB_FPRS+5*2)*4)(3) + stw r20,((JB_GPRS+6)*4)(3) + stfd f20,((JB_FPRS+6*2)*4)(3) + stw r21,((JB_GPRS+7)*4)(3) + stfd f21,((JB_FPRS+7*2)*4)(3) + stw r22,((JB_GPRS+8)*4)(3) + stfd f22,((JB_FPRS+8*2)*4)(3) + stw r23,((JB_GPRS+9)*4)(3) + stfd f23,((JB_FPRS+9*2)*4)(3) + stw r24,((JB_GPRS+10)*4)(3) + stfd f24,((JB_FPRS+10*2)*4)(3) + stw r25,((JB_GPRS+11)*4)(3) + stfd f25,((JB_FPRS+11*2)*4)(3) + stw r26,((JB_GPRS+12)*4)(3) + stfd f26,((JB_FPRS+12*2)*4)(3) + stw r27,((JB_GPRS+13)*4)(3) + stfd f27,((JB_FPRS+13*2)*4)(3) + stw r28,((JB_GPRS+14)*4)(3) + stfd f28,((JB_FPRS+14*2)*4)(3) + stw r29,((JB_GPRS+15)*4)(3) + stfd f29,((JB_FPRS+15*2)*4)(3) + stw r30,((JB_GPRS+16)*4)(3) + stfd f30,((JB_FPRS+16*2)*4)(3) + stw r31,((JB_GPRS+17)*4)(3) + stfd f31,((JB_FPRS+17*2)*4)(3) b JUMPTARGET(__sigjmp_save) END (__sigsetjmp) diff --git a/sysdeps/powerpc/stpcpy.S b/sysdeps/powerpc/stpcpy.S index 58ad5b12b6..e3d7c1e1d4 100644 --- a/sysdeps/powerpc/stpcpy.S +++ b/sysdeps/powerpc/stpcpy.S @@ -1,5 +1,5 @@ /* Optimized stpcpy implementation for PowerPC. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 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 @@ -34,66 +34,66 @@ EALIGN(__stpcpy,4,0) r9: ~(word in src | 0x7f7f7f7f) r10: alternate word from src. */ - or %r0,%r4,%r3 - clrlwi. %r0,%r0,30 - addi %r3,%r3,-4 + or r0,r4,r3 + clrlwi. r0,r0,30 + addi r3,r3,-4 bne L(unaligned) - lis %r7,0xfeff - lis %r8,0x7f7f - lwz %r6,0(%r4) - addi %r7,%r7,-0x101 - addi %r8,%r8,0x7f7f + lis r7,0xfeff + lis r8,0x7f7f + lwz r6,0(r4) + addi r7,r7,-0x101 + addi r8,r8,0x7f7f b 2f -0: lwzu %r10,4(%r4) - stwu %r6,4(%r3) - add %r0,%r7,%r10 - nor %r9,%r8,%r10 - and. %r0,%r0,%r9 +0: lwzu r10,4(r4) + stwu r6,4(r3) + add r0,r7,r10 + nor r9,r8,r10 + and. r0,r0,r9 bne- 1f - lwzu %r6,4(%r4) - stwu %r10,4(%r3) -2: add %r0,%r7,%r6 - nor %r9,%r8,%r6 - and. %r0,%r0,%r9 + lwzu r6,4(r4) + stwu r10,4(r3) +2: add r0,r7,r6 + nor r9,r8,r6 + and. r0,r0,r9 beq+ 0b - mr %r10,%r6 + mr r10,r6 /* We've hit the end of the string. Do the rest byte-by-byte. */ -1: rlwinm. %r0,%r10,8,24,31 - stbu %r0,4(%r3) +1: rlwinm. r0,r10,8,24,31 + stbu r0,4(r3) beqlr- - rlwinm. %r0,%r10,16,24,31 - stbu %r0,1(%r3) + rlwinm. r0,r10,16,24,31 + stbu r0,1(r3) beqlr- - rlwinm. %r0,%r10,24,24,31 - stbu %r0,1(%r3) + rlwinm. r0,r10,24,24,31 + stbu r0,1(r3) beqlr- - stbu %r10,1(%r3) + stbu r10,1(r3) blr /* Oh well. In this case, we just do a byte-by-byte copy. */ .align 4 nop L(unaligned): - lbz %r6,0(%r4) - addi %r3,%r3,3 - cmpwi %r6,0 + lbz r6,0(r4) + addi r3,r3,3 + cmpwi r6,0 beq- 2f -0: lbzu %r10,1(%r4) - stbu %r6,1(%r3) - cmpwi %r10,0 +0: lbzu r10,1(r4) + stbu r6,1(r3) + cmpwi r10,0 beq- 1f nop /* Let 601 load start of loop. */ - lbzu %r6,1(%r4) - stbu %r10,1(%r3) - cmpwi %r6,0 + lbzu r6,1(r4) + stbu r10,1(r3) + cmpwi r6,0 bne+ 0b -2: stbu %r6,1(%r3) +2: stbu r6,1(r3) blr -1: stbu %r10,1(%r3) +1: stbu r10,1(r3) blr END(__stpcpy) diff --git a/sysdeps/powerpc/strchr.S b/sysdeps/powerpc/strchr.S index 156d4d155c..5367a5a4fe 100644 --- a/sysdeps/powerpc/strchr.S +++ b/sysdeps/powerpc/strchr.S @@ -1,5 +1,5 @@ /* Optimized strchr implementation for PowerPC. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 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 @@ -35,76 +35,76 @@ r11: a mask with the bits to ignore set to 0 r12: a temporary */ ENTRY(strchr) - 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 + 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 + 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 L(loopentry) /* The loop. */ -L(loop):lwzu %r5,4(%r8) - and. %r0,%r0,%r9 +L(loop):lwzu r5,4(r8) + and. r0,r0,r9 /* Test for 0. */ - add %r0,%r6,%r5 - nor %r9,%r7,%r5 + add r0,r6,r5 + nor r9,r7,r5 bne L(foundit) - and. %r0,%r0,%r9 + and. r0,r0,r9 /* Start test for the bytes we're looking for. */ - xor %r12,%r4,%r5 + xor r12,r4,r5 L(loopentry): - add %r0,%r6,%r12 - nor %r9,%r7,%r12 + add r0,r6,r12 + nor r9,r7,r12 beq L(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. */ L(missed): - and. %r0,%r0,%r9 - li %r3,0 + 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 + 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 + cntlzw r4,r9 + srwi r4,r4,3 + add r3,r8,r4 blr L(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 + 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 END(strchr) diff --git a/sysdeps/powerpc/strcmp.S b/sysdeps/powerpc/strcmp.S index de8872963a..a4afead1b6 100644 --- a/sysdeps/powerpc/strcmp.S +++ b/sysdeps/powerpc/strcmp.S @@ -1,5 +1,5 @@ /* Optimized strcmp implementation for PowerPC. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 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 @@ -38,78 +38,78 @@ EALIGN(strcmp,4,0) r10: low 2 bits of p2-p1 r11: mask to orc with r5/r6 */ - or %r0,%r4,%r3 - clrlwi. %r0,%r0,30 - lis %r7,0xfeff + or r0,r4,r3 + clrlwi. r0,r0,30 + lis r7,0xfeff bne L(unaligned) - lwz %r5,0(%r3) - lwz %r6,0(%r4) - lis %r8,0x7f7f - addi %r7,%r7,-0x101 - addi %r8,%r8,0x7f7f + lwz r5,0(r3) + lwz r6,0(r4) + lis r8,0x7f7f + addi r7,r7,-0x101 + addi r8,r8,0x7f7f b 1f -0: lwzu %r5,4(%r3) - bne %cr1,L(different) - lwzu %r6,4(%r4) -1: add %r0,%r7,%r5 - nor %r9,%r8,%r5 - and. %r0,%r0,%r9 - cmpw %cr1,%r5,%r6 +0: lwzu r5,4(r3) + bne cr1,L(different) + lwzu r6,4(r4) +1: add r0,r7,r5 + nor r9,r8,r5 + and. r0,r0,r9 + cmpw cr1,r5,r6 beq+ 0b L(endstring): /* OK. We've hit the end of the string. We need to be careful that we don't compare two strings as different because of gunk beyond the end of the strings... */ - and %r0,%r8,%r5 - beq %cr1,L(equal) - add %r0,%r0,%r8 - xor. %r10,%r5,%r6 - andc %r9,%r9,%r0 + and r0,r8,r5 + beq cr1,L(equal) + add r0,r0,r8 + xor. r10,r5,r6 + andc r9,r9,r0 blt- L(highbit) - cntlzw %r10,%r10 - cntlzw %r9,%r9 - addi %r9,%r9,7 - cmpw %cr1,%r9,%r10 - sub %r3,%r5,%r6 - bgelr+ %cr1 + cntlzw r10,r10 + cntlzw r9,r9 + addi r9,r9,7 + cmpw cr1,r9,r10 + sub r3,r5,r6 + bgelr+ cr1 L(equal): - li %r3,0 + li r3,0 blr L(different): - lwz %r5,-4(%r3) - xor. %r10,%r5,%r6 - sub %r3,%r5,%r6 + lwz r5,-4(r3) + xor. r10,r5,r6 + sub r3,r5,r6 bgelr+ L(highbit): - ori %r3,%r6,1 + ori r3,r6,1 blr /* Oh well. In this case, we just do a byte-by-byte comparison. */ .align 4 L(unaligned): - lbz %r5,0(%r3) - lbz %r6,0(%r4) + lbz r5,0(r3) + lbz r6,0(r4) b 1f -0: lbzu %r5,1(%r3) +0: lbzu r5,1(r3) bne- 4f - lbzu %r6,1(%r4) -1: cmpwi %cr1,%r5,0 - beq- %cr1,3f - cmpw %r5,%r6 + lbzu r6,1(r4) +1: cmpwi cr1,r5,0 + beq- cr1,3f + cmpw r5,r6 bne- 3f - lbzu %r5,1(%r3) - lbzu %r6,1(%r4) - cmpwi %cr1,%r5,0 - cmpw %r5,%r6 - bne+ %cr1,0b -3: sub %r3,%r5,%r6 + lbzu r5,1(r3) + lbzu r6,1(r4) + cmpwi cr1,r5,0 + cmpw r5,r6 + bne+ cr1,0b +3: sub r3,r5,r6 blr -4: lbz %r5,-1(%r3) - sub %r3,%r5,%r6 +4: lbz r5,-1(r3) + sub r3,r5,r6 blr END(strcmp) diff --git a/sysdeps/powerpc/strcpy.S b/sysdeps/powerpc/strcpy.S index 3c0cce7844..0a1d89c8fc 100644 --- a/sysdeps/powerpc/strcpy.S +++ b/sysdeps/powerpc/strcpy.S @@ -1,5 +1,5 @@ /* Optimized strcpy implementation for PowerPC. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 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 @@ -35,66 +35,66 @@ EALIGN(strcpy,4,0) r9: ~(word in src | 0x7f7f7f7f) r10: alternate word from src. */ - or %r0,%r4,%r3 - clrlwi. %r0,%r0,30 - addi %r5,%r3,-4 + or r0,r4,r3 + clrlwi. r0,r0,30 + addi r5,r3,-4 bne L(unaligned) - lis %r7,0xfeff - lis %r8,0x7f7f - lwz %r6,0(%r4) - addi %r7,%r7,-0x101 - addi %r8,%r8,0x7f7f + lis r7,0xfeff + lis r8,0x7f7f + lwz r6,0(r4) + addi r7,r7,-0x101 + addi r8,r8,0x7f7f b 2f -0: lwzu %r10,4(%r4) - stwu %r6,4(%r5) - add %r0,%r7,%r10 - nor %r9,%r8,%r10 - and. %r0,%r0,%r9 +0: lwzu r10,4(r4) + stwu r6,4(r5) + add r0,r7,r10 + nor r9,r8,r10 + and. r0,r0,r9 bne- 1f - lwzu %r6,4(%r4) - stwu %r10,4(%r5) -2: add %r0,%r7,%r6 - nor %r9,%r8,%r6 - and. %r0,%r0,%r9 + lwzu r6,4(r4) + stwu r10,4(r5) +2: add r0,r7,r6 + nor r9,r8,r6 + and. r0,r0,r9 beq+ 0b - mr %r10,%r6 + mr r10,r6 /* We've hit the end of the string. Do the rest byte-by-byte. */ -1: rlwinm. %r0,%r10,8,24,31 - stb %r0,4(%r5) +1: rlwinm. r0,r10,8,24,31 + stb r0,4(r5) beqlr- - rlwinm. %r0,%r10,16,24,31 - stb %r0,5(%r5) + rlwinm. r0,r10,16,24,31 + stb r0,5(r5) beqlr- - rlwinm. %r0,%r10,24,24,31 - stb %r0,6(%r5) + rlwinm. r0,r10,24,24,31 + stb r0,6(r5) beqlr- - stb %r10,7(%r5) + stb r10,7(r5) blr /* Oh well. In this case, we just do a byte-by-byte copy. */ .align 4 nop L(unaligned): - lbz %r6,0(%r4) - addi %r5,%r3,-1 - cmpwi %r6,0 + lbz r6,0(r4) + addi r5,r3,-1 + cmpwi r6,0 beq- 2f -0: lbzu %r10,1(%r4) - stbu %r6,1(%r5) - cmpwi %r10,0 +0: lbzu r10,1(r4) + stbu r6,1(r5) + cmpwi r10,0 beq- 1f nop /* Let 601 load start of loop. */ - lbzu %r6,1(%r4) - stbu %r10,1(%r5) - cmpwi %r6,0 + lbzu r6,1(r4) + stbu r10,1(r5) + cmpwi r6,0 bne+ 0b -2: stb %r6,1(%r5) +2: stb r6,1(r5) blr -1: stb %r10,1(%r5) +1: stb r10,1(r5) blr END(strcpy) diff --git a/sysdeps/powerpc/strlen.S b/sysdeps/powerpc/strlen.S index dc6660b8fc..b847ee4df3 100644 --- a/sysdeps/powerpc/strlen.S +++ b/sysdeps/powerpc/strlen.S @@ -1,5 +1,5 @@ /* Optimized strlen implementation for PowerPC. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 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 @@ -77,68 +77,68 @@ ENTRY(strlen) start at a word boundary. r8 holds the 'current' word. r9-12 are temporaries. r0 is used as a temporary and for discarded results. */ - clrrwi %r4,%r3,2 - lis %r7,0x7f7f - rlwinm %r5,%r3,3,27,28 - lwz %r8,0(%r4) - li %r9,-1 - addi %r7,%r7,0x7f7f + clrrwi r4,r3,2 + lis r7,0x7f7f + rlwinm r5,r3,3,27,28 + lwz r8,0(r4) + li r9,-1 + addi r7,r7,0x7f7f /* That's the setup done, now do the first pair of words. We make an exception and use method (2) on the first two words, to reduce overhead. */ - srw %r9,%r9,%r5 - and %r0,%r7,%r8 - or %r10,%r7,%r8 - add %r0,%r0,%r7 - nor %r0,%r10,%r0 - and. %r8,%r0,%r9 - mtcrf 0x01,%r3 + srw r9,r9,r5 + and r0,r7,r8 + or r10,r7,r8 + add r0,r0,r7 + nor r0,r10,r0 + and. r8,r0,r9 + mtcrf 0x01,r3 bne L(done0) - lis %r6,0xfeff - addi %r6,%r6,-0x101 + lis r6,0xfeff + addi r6,r6,-0x101 /* Are we now aligned to a doubleword boundary? */ bt 29,L(loop) /* Handle second word of pair. */ - lwzu %r8,4(%r4) - and %r0,%r7,%r8 - or %r10,%r7,%r8 - add %r0,%r0,%r7 - nor. %r8,%r10,%r0 + lwzu r8,4(r4) + and r0,r7,r8 + or r10,r7,r8 + add r0,r0,r7 + nor. r8,r10,r0 bne L(done0) /* The loop. */ L(loop): - lwz %r8,4(%r4) - lwzu %r9,8(%r4) - add %r0,%r6,%r8 - nor %r10,%r7,%r8 - and. %r0,%r0,%r10 - add %r11,%r6,%r9 - nor %r12,%r7,%r9 + lwz r8,4(r4) + lwzu r9,8(r4) + add r0,r6,r8 + nor r10,r7,r8 + and. r0,r0,r10 + add r11,r6,r9 + nor r12,r7,r9 bne L(done1) - and. %r0,%r11,%r12 + and. r0,r11,r12 beq L(loop) - and %r0,%r7,%r9 - add %r0,%r0,%r7 - andc %r8,%r12,%r0 + and r0,r7,r9 + add r0,r0,r7 + andc r8,r12,r0 b L(done0) L(done1): - and %r0,%r7,%r8 - subi %r4,%r4,4 - add %r0,%r0,%r7 - andc %r8,%r10,%r0 + and r0,r7,r8 + subi r4,r4,4 + add r0,r0,r7 + andc r8,r10,r0 /* When we get to here, r4 points to the first word in the string that contains a zero byte, and the most significant set bit in r8 is in that byte. */ L(done0): - cntlzw %r11,%r8 - subf %r0,%r3,%r4 - srwi %r11,%r11,3 - add %r3,%r0,%r11 + cntlzw r11,r8 + subf r0,r3,r4 + srwi r11,r11,3 + add r3,r0,r11 blr END(strlen) diff --git a/sysdeps/powerpc/sub_n.S b/sysdeps/powerpc/sub_n.S index 7af577d835..d839a5f858 100644 --- a/sysdeps/powerpc/sub_n.S +++ b/sysdeps/powerpc/sub_n.S @@ -1,5 +1,5 @@ /* Subtract two limb vectors of equal, non-zero length for PowerPC. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1999 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 @@ -29,40 +29,40 @@ EALIGN(__mpn_sub_n,3,1) /* Set up for loop below. */ - mtcrf 0x01,%r6 - srwi. %r7,%r6,1 - mtctr %r7 + mtcrf 0x01,r6 + srwi. r7,r6,1 + mtctr r7 bt 31,2f /* Set the carry (clear the borrow). */ - subfc %r0,%r0,%r0 + subfc r0,r0,r0 /* Adjust pointers for loop. */ - addi %r3,%r3,-4 - addi %r4,%r4,-4 - addi %r5,%r5,-4 + addi r3,r3,-4 + addi r4,r4,-4 + addi r5,r5,-4 b 0f -2: lwz %r7,0(%r5) - lwz %r6,0(%r4) - subfc %r6,%r7,%r6 - stw %r6,0(%r3) +2: lwz r7,0(r5) + lwz r6,0(r4) + subfc r6,r7,r6 + stw r6,0(r3) beq 1f /* Align start of loop to an odd word boundary to guarantee that the last two words can be fetched in one access (for 601). This turns out to be important. */ 0: - lwz %r9,4(%r4) - lwz %r8,4(%r5) - lwzu %r6,8(%r4) - lwzu %r7,8(%r5) - subfe %r8,%r8,%r9 - stw %r8,4(%r3) - subfe %r6,%r7,%r6 - stwu %r6,8(%r3) + lwz r9,4(r4) + lwz r8,4(r5) + lwzu r6,8(r4) + lwzu r7,8(r5) + subfe r8,r8,r9 + stw r8,4(r3) + subfe r6,r7,r6 + stwu r6,8(r3) bdnz 0b /* Return the borrow. */ -1: subfe %r3,%r3,%r3 - neg %r3,%r3 +1: subfe r3,r3,r3 + neg r3,r3 blr END(__mpn_sub_n) diff --git a/sysdeps/powerpc/submul_1.S b/sysdeps/powerpc/submul_1.S index 80da8ec8c1..d9472dddbe 100644 --- a/sysdeps/powerpc/submul_1.S +++ b/sysdeps/powerpc/submul_1.S @@ -1,5 +1,5 @@ /* Multiply a limb vector by a single limb, for PowerPC. - Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1997, 1999 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,29 +24,29 @@ Calculate res-s1*s2 and put result back in res; return carry. */ ENTRY(__mpn_submul_1) - mtctr %r5 - - lwz %r0,0(%r4) - mullw %r7,%r0,%r6 - mulhwu %r10,%r0,%r6 - lwz %r9,0(%r3) - subf %r8,%r7,%r9 - addc %r7,%r7,%r8 # invert cy (r7 is junk) - addi %r3,%r3,-4 # adjust res_ptr + mtctr r5 + + lwz r0,0(r4) + mullw r7,r0,r6 + mulhwu r10,r0,r6 + lwz r9,0(r3) + subf r8,r7,r9 + addc r7,r7,r8 # invert cy (r7 is junk) + addi r3,r3,-4 # adjust res_ptr bdz 1f -0: lwzu %r0,4(%r4) - stwu %r8,4(%r3) - mullw %r8,%r0,%r6 - adde %r7,%r8,%r10 - mulhwu %r10,%r0,%r6 - lwz %r9,4(%r3) - addze %r10,%r10 - subf %r8,%r7,%r9 - addc %r7,%r7,%r8 # invert cy (r7 is junk) +0: lwzu r0,4(r4) + stwu r8,4(r3) + mullw r8,r0,r6 + adde r7,r8,r10 + mulhwu r10,r0,r6 + lwz r9,4(r3) + addze r10,r10 + subf r8,r7,r9 + addc r7,r7,r8 # invert cy (r7 is junk) bdnz 0b -1: stw %r8,4(%r3) - addze %r3,%r10 +1: stw r8,4(r3) + addze r3,r10 blr END(__mpn_submul_1) |