diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
commit | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch) | |
tree | 2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /sysdeps/powerpc/powerpc32/fpu | |
parent | 7d58530341304d403a6626d7f7a1913165fe2f32 (diff) | |
download | glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.bz2 glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip |
2.5-18.1
Diffstat (limited to 'sysdeps/powerpc/powerpc32/fpu')
26 files changed, 506 insertions, 396 deletions
diff --git a/sysdeps/powerpc/powerpc32/fpu/Dist b/sysdeps/powerpc/powerpc32/fpu/Dist deleted file mode 100644 index 375e57172e..0000000000 --- a/sysdeps/powerpc/powerpc32/fpu/Dist +++ /dev/null @@ -1,2 +0,0 @@ -fprrest.S -fprsave.S diff --git a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S index a2415b9542..404f403855 100644 --- a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S +++ b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S @@ -1,5 +1,5 @@ /* longjmp for PowerPC. - Copyright (C) 1995-99, 2000, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-99, 2000, 2003-2005, 2006 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 @@ -14,16 +14,15 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> #define _ASM -#define _SETJMP_H #ifdef __NO_VMX__ # include <novmxsetjmp.h> #else -# include <bits/setjmp.h> +# include <jmpbuf-offsets.h> #endif #include <bp-sym.h> #include <bp-asm.h> @@ -34,15 +33,25 @@ ENTRY (BP_SYM (__longjmp)) #ifndef __NO_VMX__ # ifdef PIC mflr r6 + cfi_register (lr,r6) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r5 + addis r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r5 +# endif # ifdef SHARED lwz r5,_rtld_global_ro@got(r5) mtlr r6 + cfi_same_value (lr) lwz r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5) # else - lwz r5,_rtld_global_ro@got(r5) + lwz r5,_dl_hwcap@got(r5) mtlr r6 + cfi_same_value (lr) lwz r5,0(r5) # endif # else @@ -105,7 +114,11 @@ aligned_restore_vmx: lvx v31,0,r6 L(no_vmx): #endif +#ifdef PTR_DEMANGLE + lwz r24,(JB_GPR1*4)(r3) +#else lwz r1,(JB_GPR1*4)(r3) +#endif lwz r0,(JB_LR*4)(r3) lwz r14,((JB_GPRS+0)*4)(r3) lfd fp14,((JB_FPRS+0*2)*4)(r3) @@ -121,6 +134,10 @@ L(no_vmx): lfd fp19,((JB_FPRS+5*2)*4)(r3) lwz r20,((JB_GPRS+6)*4)(r3) lfd fp20,((JB_FPRS+6*2)*4)(r3) +#ifdef PTR_DEMANGLE + PTR_DEMANGLE3 (r1, r24, r25) + PTR_DEMANGLE2 (r0, r25) +#endif mtlr r0 lwz r21,((JB_GPRS+7)*4)(r3) lfd fp21,((JB_FPRS+7*2)*4)(r3) diff --git a/sysdeps/powerpc/powerpc32/fpu/fprrest.S b/sysdeps/powerpc/powerpc32/fpu/fprrest.S index 42317809eb..2f6c6deb2e 100644 --- a/sysdeps/powerpc/powerpc32/fpu/fprrest.S +++ b/sysdeps/powerpc/powerpc32/fpu/fprrest.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2006 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 @@ -13,8 +13,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ /* Floating Point Registers (FPRs) restore routine @@ -92,3 +92,4 @@ C_TEXT(_restfpr_29): lwz r0,8(r1) #get return address from frame lfd fp30,-16(r1) #restore f30 lfd fp31,-8(r1) #restore f31 blr #return +END (_restfpr_all) diff --git a/sysdeps/powerpc/powerpc32/fpu/fprsave.S b/sysdeps/powerpc/powerpc32/fpu/fprsave.S index d7bc1ab7dc..c05178775d 100644 --- a/sysdeps/powerpc/powerpc32/fpu/fprsave.S +++ b/sysdeps/powerpc/powerpc32/fpu/fprsave.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2006 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 @@ -13,8 +13,8 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ /* Floating Point Registers (FPRs) save routine @@ -27,67 +27,86 @@ ENTRY(_savefpr_all) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_14) C_TEXT(_savef14): C_TEXT(_savefpr_14): stfd fp14,-144(r1) + cfi_offset(fp14,-144) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef15) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_15) C_TEXT(_savef15): C_TEXT(_savefpr_15): stfd fp15,-136(r1) + cfi_offset(fp15,-136) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef16) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_16) C_TEXT(_savef16): C_TEXT(_savefpr_16): stfd fp16,-128(r1) + cfi_offset(fp16,-128) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef17) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_17) C_TEXT(_savef17): C_TEXT(_savefpr_17): stfd fp17,-120(r1) + cfi_offset(fp17,-120) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef18) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_18) C_TEXT(_savef18): C_TEXT(_savefpr_18): stfd fp18,-112(r1) + cfi_offset(fp18,-112) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef19) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_19) C_TEXT(_savef19): C_TEXT(_savefpr_19): stfd fp19,-104(r1) + cfi_offset(fp19,-104) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef20) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_20) C_TEXT(_savef20): C_TEXT(_savefpr_20): stfd fp20,-96(r1) + cfi_offset(fp20,-96) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef21) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_21) C_TEXT(_savef21): C_TEXT(_savefpr_21): stfd fp21,-88(r1) + cfi_offset(fp21,-88) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef22) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_22) C_TEXT(_savef22): C_TEXT(_savefpr_22): stfd fp22,-80(r1) + cfi_offset(fp22,-80) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef23) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_23) C_TEXT(_savef23): C_TEXT(_savefpr_23): stfd fp23,-72(r1) + cfi_offset(fp23,-72) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef24) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_24) C_TEXT(_savef24): C_TEXT(_savefpr_24): stfd fp24,-64(r1) + cfi_offset(fp24,-64) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef25) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_25) C_TEXT(_savef25): C_TEXT(_savefpr_25): stfd fp25,-56(r1) + cfi_offset(fp25,-56) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef26) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_26) C_TEXT(_savef26): C_TEXT(_savefpr_26): stfd fp26,-48(r1) + cfi_offset(fp26,-48) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef27) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_27) C_TEXT(_savef27): C_TEXT(_savefpr_27): stfd fp27,-40(r1) + cfi_offset(fp27,-40) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef28) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_28) C_TEXT(_savef28): C_TEXT(_savefpr_28): stfd fp28,-32(r1) + cfi_offset(fp28,-32) ASM_GLOBAL_DIRECTIVE C_TEXT(_savef29) ASM_GLOBAL_DIRECTIVE C_TEXT(_savefpr_29) C_TEXT(_savef29): C_TEXT(_savefpr_29): stfd fp29,-24(r1) #save f29 stfd fp30,-16(r1) #save f30 stfd fp31,-8(r1) #save f31 + cfi_offset(fp29,-24) + cfi_offset(fp30,-16) + cfi_offset(fp31,-8) stw r0,8(r1) #save LR in callers frame blr #return +END (_savefpr_all) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S index d211314bbf..bc74d302fb 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S @@ -1,5 +1,5 @@ /* ceil function. PowerPC32 version. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 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 @@ -14,46 +14,39 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> +#include <math_ldbl_opt.h> - .section .rodata - .align 3 - .type TWO52.0,@object - .size TWO52.0,8 -TWO52.0: - .long 0x43300000 - .long 0 - .type NEGZERO.0,@object - .size NEGZERO.0,8 -NEGZERO.0: - .long 0x80000000 - .long 0 - - .section .rodata.cst8,"aM",@progbits,8 - .align 3 + .section .rodata.cst4,"aM",@progbits,4 + .align 2 .LC0: /* 2**52 */ - .long 0x43300000 - .long 0 -.LC1: /* -0.0 */ - .long 0x80000000 - .long 0 + .long 0x59800000 .section ".text" ENTRY (__ceil) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 + cfi_register(lr,r11) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) + lfs fp13,0(r9) +# endif mtlr r11 - lfd fp13,0(r9) + cfi_same_value (lr) #else lis r9,.LC0@ha - lfd fp13,.LC0@l(r9) + lfs fp13,.LC0@l(r9) #endif fabs fp0,fp1 fsub fp12,fp13,fp13 /* generate 0.0 */ @@ -64,27 +57,18 @@ ENTRY (__ceil) ble- cr6,.L4 fadd fp1,fp1,fp13 /* x+= TWO52; */ fsub fp1,fp1,fp13 /* x-= TWO52; */ -.L9: + fabs fp1,fp1 /* if (x == 0.0) */ + /* x = 0.0; */ mtfsf 0x01,fp11 /* restore previous rounding mode. */ blr .L4: bge- cr6,.L9 /* if (x < 0.0) */ fsub fp1,fp1,fp13 /* x-= TWO52; */ fadd fp1,fp1,fp13 /* x+= TWO52; */ - fcmpu cr5,fp1,fp12 /* if (x > 0.0) */ + fnabs fp1,fp1 /* if (x == 0.0) */ + /* x = -0.0; */ +.L9: mtfsf 0x01,fp11 /* restore previous rounding mode. */ - bnelr+ cr5 -#ifdef SHARED - mflr r11 - bl _GLOBAL_OFFSET_TABLE_@local-4 - mflr r10 - lwz r9,.LC1@got(10) - mtlr r11 - lfd fp1,0(r9) -#else - lis r9,.LC1@ha - lfd fp1,.LC1@l(r9) -#endif blr END (__ceil) @@ -94,3 +78,6 @@ weak_alias (__ceil, ceil) weak_alias (__ceil, ceill) strong_alias (__ceil, __ceill) #endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __ceil, ceill, GLIBC_2_0) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S index 4439dc2338..47a75ec0c3 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S @@ -1,5 +1,5 @@ /* float ceil function. PowerPC32 version. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 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 @@ -14,46 +14,38 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> - .section .rodata - .align 3 - .type TWO52.0,@object - .size TWO52.0,8 -TWO52.0: - .long 0x43300000 - .long 0 - .type NEGZERO.0,@object - .size NEGZERO.0,8 -NEGZERO.0: - .long 0x80000000 - .long 0 - - .section .rodata.cst8,"aM",@progbits,8 - .align 3 + .section .rodata.cst4,"aM",@progbits,4 + .align 2 .LC0: /* 2**23 */ - .long 0x41600000 - .long 0 -.LC1: /* -0.0 */ - .long 0x80000000 - .long 0 + .long 0x4b000000 .section ".text" ENTRY (__ceilf) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 + cfi_register(lr,r11) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) + lfs fp13,0(r9) +# endif mtlr r11 - lfd fp13,0(r9) + cfi_same_value (lr) #else lis r9,.LC0@ha - lfd fp13,.LC0@l(r9) + lfs fp13,.LC0@l(r9) #endif fabs fp0,fp1 fsubs fp12,fp13,fp13 /* generate 0.0 */ @@ -64,27 +56,18 @@ ENTRY (__ceilf) ble- cr6,.L4 fadds fp1,fp1,fp13 /* x+= TWO23; */ fsubs fp1,fp1,fp13 /* x-= TWO23; */ -.L9: + fabs fp1,fp1 /* if (x == 0.0) */ + /* x = 0.0; */ mtfsf 0x01,fp11 /* restore previous rounding mode. */ blr .L4: bge- cr6,.L9 /* if (x < 0.0) */ fsubs fp1,fp1,fp13 /* x-= TWO23; */ fadds fp1,fp1,fp13 /* x+= TWO23; */ - fcmpu cr5,fp1,fp12 /* if (x > 0.0) */ + fnabs fp1,fp1 /* if (x == 0.0) */ + /* x = -0.0; */ +.L9: mtfsf 0x01,fp11 /* restore previous rounding mode. */ - bnelr+ cr5 -#ifdef SHARED - mflr r11 - bl _GLOBAL_OFFSET_TABLE_@local-4 - mflr r10 - lwz r9,.LC1@got(10) - mtlr r11 - lfd fp1,0(r9) -#else - lis r9,.LC1@ha - lfd fp1,.LC1@l(r9) -#endif blr END (__ceilf) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S index 933435da3d..dd68b0869c 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_copysign.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_copysign.S @@ -1,5 +1,5 @@ /* Copy a sign bit between floating-point values. - Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2000, 2006 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 @@ -14,23 +14,26 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ /* This has been coded in assembler because GCC makes such a mess of it when it's coded in C. */ #include <sysdep.h> +#include <math_ldbl_opt.h> ENTRY(__copysign) /* double [f1] copysign (double [f1] x, double [f2] y); copysign(x,y) returns a value with the magnitude of x and with the sign bit of y. */ stwu r1,-16(r1) + cfi_adjust_cfa_offset (16) stfd fp2,8(r1) lwz r3,8(r1) cmpwi r3,0 addi r1,r1,16 + cfi_adjust_cfa_offset (-16) blt L(0) fabs fp1,fp1 blr @@ -38,13 +41,20 @@ L(0): fnabs fp1,fp1 blr END (__copysign) -weak_alias(__copysign,copysign) +weak_alias (__copysign,copysign) /* It turns out that it's safe to use this code even for single-precision. */ -weak_alias(__copysign,copysignf) +weak_alias (__copysign,copysignf) strong_alias(__copysign,__copysignf) #ifdef NO_LONG_DOUBLE -weak_alias(__copysign,copysignl) +weak_alias (__copysign,copysignl) strong_alias(__copysign,__copysignl) #endif +#ifdef IS_IN_libm +# if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __copysign, copysignl, GLIBC_2_0) +# endif +#elif LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) +compat_symbol (libc, __copysign, copysignl, GLIBC_2_0) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S b/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S new file mode 100644 index 0000000000..64b6a45437 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S @@ -0,0 +1,50 @@ +/* Copy a sign bit between floating-point values. + IBM extended format long double version. + Copyright (C) 2006 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <math_ldbl_opt.h> + +ENTRY(__copysignl) +/* long double [f1,f2] copysign (long double [f1,f2] x, long double [f3,f4] y); + copysign(x,y) returns a value with the magnitude of x and + with the sign bit of y. */ + stwu r1,-16(r1) + cfi_adjust_cfa_offset (16) + stfd fp3,8(r1) + fmr fp0,fp1 + fabs fp1,fp1 + fcmpu cr7,fp0,fp1 + lwz r3,8(r1) + cmpwi cr6,r3,0 + addi r1,r1,16 + cfi_adjust_cfa_offset (-16) + beq cr7,L(0) + fneg fp2,fp2 +L(0): bgelr cr6 + fneg fp1,fp1 + fneg fp2,fp2 + blr +END (__copysignl) + +#ifdef IS_IN_libm +long_double_symbol (libm, __copysignl, copysignl) +#else +long_double_symbol (libc, __copysignl, copysignl) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fabs.S b/sysdeps/powerpc/powerpc32/fpu/s_fabs.S new file mode 100644 index 0000000000..53d21301ee --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/s_fabs.S @@ -0,0 +1,5 @@ +#include <math_ldbl_opt.h> +#include <sysdeps/powerpc/fpu/s_fabs.S> +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __fabs, fabsl, GLIBC_2_0) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fabsl.S b/sysdeps/powerpc/powerpc32/fpu/s_fabsl.S new file mode 100644 index 0000000000..3655e5b2f3 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/s_fabsl.S @@ -0,0 +1,36 @@ +/* Copy a sign bit between floating-point values. + IBM extended format long double version. + Copyright (C) 2004, 2006 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <sysdep.h> +#include <math_ldbl_opt.h> + +ENTRY(__fabsl) +/* long double [f1,f2] fabs (long double [f1,f2] x); + fabs(x,y) returns a value with the magnitude of x and + with the sign bit of y. */ + fmr fp0,fp1 + fabs fp1,fp1 + fcmpu cr1,fp0,fp1 + beqlr cr1 + fneg fp2,fp2 + blr +END (__fabsl) + +long_double_symbol (libm, __fabsl, fabsl) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fdim.c b/sysdeps/powerpc/powerpc32/fpu/s_fdim.c new file mode 100644 index 0000000000..e34b51ee54 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/s_fdim.c @@ -0,0 +1,5 @@ +#include <math_ldbl_opt.h> +#include <sysdeps/powerpc/fpu/s_fdim.c> +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __fdim, fdiml, GLIBC_2_1); +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floor.S b/sysdeps/powerpc/powerpc32/fpu/s_floor.S index 143f907b18..a29e4791ea 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_floor.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_floor.S @@ -1,5 +1,5 @@ /* Floor function. PowerPC32 version. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 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 @@ -14,38 +14,39 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> +#include <math_ldbl_opt.h> - .section .rodata - .align 3 - .type TWO52.0,@object - .size TWO52.0,8 -TWO52.0: - .long 0x43300000 - .long 0 - - .section .rodata.cst8,"aM",@progbits,8 - .align 3 + .section .rodata.cst4,"aM",@progbits,4 + .align 2 .LC0: /* 2**52 */ - .long 0x43300000 - .long 0 + .long 0x59800000 .section ".text" ENTRY (__floor) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 + cfi_register(lr,r11) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) + lfs fp13,0(r9) +# endif mtlr r11 - lfd fp13,0(r9) + cfi_same_value (lr) #else lis r9,.LC0@ha - lfd fp13,.LC0@l(r9) + lfs fp13,.LC0@l(r9) #endif fabs fp0,fp1 fsub fp12,fp13,fp13 /* generate 0.0 */ @@ -56,15 +57,16 @@ ENTRY (__floor) ble- cr6,.L4 fadd fp1,fp1,fp13 /* x+= TWO52; */ fsub fp1,fp1,fp13 /* x-= TWO52; */ - fcmpu cr5,fp1,fp12 /* if (x > 0.0) */ + fabs fp1,fp1 /* if (x == 0.0) */ + /* x = 0.0; */ mtfsf 0x01,fp11 /* restore previous rounding mode. */ - bnelr+ cr5 - fmr fp1,fp12 /* x must be +0.0 for the 0.0 case. */ blr .L4: bge- cr6,.L9 /* if (x < 0.0) */ fsub fp1,fp1,fp13 /* x-= TWO52; */ fadd fp1,fp1,fp13 /* x+= TWO52; */ + fnabs fp1,fp1 /* if (x == 0.0) */ + /* x = -0.0; */ .L9: mtfsf 0x01,fp11 /* restore previous rounding mode. */ blr @@ -76,3 +78,6 @@ weak_alias (__floor, floor) weak_alias (__floor, floorl) strong_alias (__floor, __floorl) #endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __floor, floorl, GLIBC_2_0) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/fpu/s_floorf.S index 154bc30ff7..99fbdc5f86 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_floorf.S @@ -1,5 +1,5 @@ /* float Floor function. PowerPC32 version. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 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 @@ -14,38 +14,38 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> - .section .rodata - .align 3 - .type TWO23.0,@object - .size TWO23.0,8 -TWO23.0: - .long 0x41600000 - .long 0 - - .section .rodata.cst8,"aM",@progbits,8 - .align 3 + .section .rodata.cst4,"aM",@progbits,4 + .align 2 .LC0: /* 2**23 */ - .long 0x41600000 - .long 0 + .long 0x4b000000 .section ".text" ENTRY (__floorf) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 + cfi_register(lr,r11) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) + lfs fp13,0(r9) +# endif mtlr r11 - lfd fp13,0(r9) + cfi_same_value (lr) #else lis r9,.LC0@ha - lfd fp13,.LC0@l(r9) + lfs fp13,.LC0@l(r9) #endif fabs fp0,fp1 fsubs fp12,fp13,fp13 /* generate 0.0 */ @@ -56,15 +56,16 @@ ENTRY (__floorf) ble- cr6,.L4 fadds fp1,fp1,fp13 /* x+= TWO23; */ fsubs fp1,fp1,fp13 /* x-= TWO23; */ - fcmpu cr5,fp1,fp12 /* if (x > 0.0) */ + fabs fp1,fp1 /* if (x == 0.0) */ + /* x = 0.0; */ mtfsf 0x01,fp11 /* restore previous rounding mode. */ - bnelr+ cr5 - fmr fp1,fp12 /* x must be +0.0 for the 0.0 case. */ blr .L4: bge- cr6,.L9 /* if (x < 0.0) */ fsubs fp1,fp1,fp13 /* x-= TWO23; */ fadds fp1,fp1,fp13 /* x+= TWO23; */ + fnabs fp1,fp1 /* if (x == 0.0) */ + /* x = -0.0; */ .L9: mtfsf 0x01,fp11 /* restore previous rounding mode. */ blr diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fmax.S b/sysdeps/powerpc/powerpc32/fpu/s_fmax.S new file mode 100644 index 0000000000..69735761ab --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/s_fmax.S @@ -0,0 +1,5 @@ +#include <math_ldbl_opt.h> +#include <sysdeps/powerpc/fpu/s_fmax.S> +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __fmax, fmaxl, GLIBC_2_1) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_fmin.S b/sysdeps/powerpc/powerpc32/fpu/s_fmin.S new file mode 100644 index 0000000000..6d4a0a946c --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/s_fmin.S @@ -0,0 +1,5 @@ +#include <math_ldbl_opt.h> +#include <sysdeps/powerpc/fpu/s_fmin.S> +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __fmin, fminl, GLIBC_2_1) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_isnan.c b/sysdeps/powerpc/powerpc32/fpu/s_isnan.c new file mode 100644 index 0000000000..397717ba9c --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/s_isnan.c @@ -0,0 +1,7 @@ +#include <sysdeps/powerpc/fpu/s_isnan.c> +#ifndef IS_IN_libm +# if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0) +compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0); +compat_symbol (libc, isnan, isnanl, GLIBC_2_0); +# endif +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_llrint.c b/sysdeps/powerpc/powerpc32/fpu/s_llrint.c index 7fdc296b0b..cb96be7c9b 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_llrint.c +++ b/sysdeps/powerpc/powerpc32/fpu/s_llrint.c @@ -1,5 +1,5 @@ /* Round a double value to a long long in the current rounding mode. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2006 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 @@ -17,7 +17,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include "math.h" +#include <math.h> +#include <math_ldbl_opt.h> long long int __llrint (double x) @@ -29,3 +30,6 @@ weak_alias (__llrint, llrint) strong_alias (__llrint, __llrintl) weak_alias (__llrint, llrintl) #endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __llrint, llrintl, GLIBC_2_1); +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lrint.S b/sysdeps/powerpc/powerpc32/fpu/s_lrint.S index 57d56c48cd..da0a1e505a 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_lrint.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_lrint.S @@ -1,5 +1,5 @@ /* Round double to long int. PowerPC32 version. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 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 @@ -18,15 +18,18 @@ 02111-1307 USA. */ #include <sysdep.h> +#include <math_ldbl_opt.h> /* long int[r3] __lrint (double x[fp1]) */ -ENTRY (__lrint) +ENTRY (__lrint) + stwu r1,-16(r1) fctiw fp13,fp1 - stfd fp13,-8(r1) + stfd fp13,8(r1) nop /* Insure the following load is in a different dispatch group */ nop /* to avoid pipe stall on POWER4&5. */ nop - lwz r3,-4(r1) + lwz r3,12(r1) + addi r1,r1,16 blr END (__lrint) @@ -39,3 +42,6 @@ weak_alias (__lrint, lrintf) strong_alias (__lrint, __lrintl) weak_alias (__lrint, lrintl) #endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __lrint, lrintl, GLIBC_2_1) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lround.S b/sysdeps/powerpc/powerpc32/fpu/s_lround.S index dcb97e373b..9c534ec2be 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_lround.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_lround.S @@ -1,5 +1,5 @@ /* lround function. PowerPC32 version. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 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 @@ -14,32 +14,18 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> - - .section .rodata - .align 3 - .type NEGZERO.0,@object - .size NEGZERO.0,8 -NEGZERO.0: - .long 0x00000000 - .long 0 - .type POINTFIVE.0,@object - .size POINTFIVE.0,8 -POINTFIVE.0: - .long 0x3fe00000 - .long 0 +#include <math_ldbl_opt.h> .section .rodata.cst8,"aM",@progbits,8 - .align 3 + .align 2 .LC0: /* 0.0 */ .long 0x00000000 - .long 0 .LC1: /* 0.5 */ - .long 0x3fe00000 - .long 0 + .long 0x3f000000 .section ".text" @@ -54,41 +40,51 @@ POINTFIVE.0: to the integer value. */ ENTRY (__lround) + stwu r1,-16(r1) + cfi_adjust_cfa_offset (16) #ifdef SHARED mflr r11 + cfi_register(lr,r11) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + addi r9,r9,.LC0-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) +# endif mtlr r11 - lfd fp12,0(r9) + cfi_same_value (lr) + lfs fp12,0(r9) #else lis r9,.LC0@ha - lfd fp12,.LC0@l(r9) + lfs fp12,.LC0@l(r9) #endif #ifdef SHARED - lwz r9,.LC1@got(10) - lfd fp10,0(r9) + lfs fp10,.LC1-.LC0(r9) #else lis r9,.LC1@ha - lfd fp10,.LC1@l(r9) + lfs fp10,.LC1@l(r9) #endif fcmpu cr6,fp1,fp12 /* if (x > 0.0) */ ble- cr6,.L4 fadd fp1,fp1,fp10 /* x+= 0.5; */ .L9: fctiwz fp2,fp1 /* Convert To Integer DW lround toward 0. */ - stfd fp2,-8(r1) - nop /* Insure the following load is in a different dispatch group */ - nop /* to avoid pipe stall on POWER4&5. */ + stfd fp2,8(r1) + nop /* Ensure the following load is in a different dispatch */ + nop /* group to avoid pipe stall on POWER4&5. */ nop - lwz r3,-4(r1) + lwz r3,12(r1) + addi r1,r1,16 blr .L4: fsub fp1,fp1,fp10 /* x-= 0.5; */ b .L9 END (__lround) -strong_alias (__lround, __lround) weak_alias (__lround, lround) strong_alias (__lround, __lroundf) @@ -98,3 +94,6 @@ weak_alias (__lround, lroundf) weak_alias (__lround, lroundl) strong_alias (__lround, __lroundl) #endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __lround, lroundl, GLIBC_2_1) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rint.S b/sysdeps/powerpc/powerpc32/fpu/s_rint.S index dee25f204f..c8dca313ae 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_rint.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_rint.S @@ -1,5 +1,5 @@ /* Round to int floating-point values. PowerPC32 version. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 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 @@ -14,40 +14,41 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ /* This has been coded in assembler because GCC makes such a mess of it when it's coded in C. */ #include <sysdep.h> +#include <math_ldbl_opt.h> - .section .rodata - .align 3 - .type TWO52.0,@object - .size TWO52.0,8 -TWO52.0: - .long 0x43300000 - .long 0 - - .section .rodata.cst8,"aM",@progbits,8 - .align 3 + .section .rodata.cst4,"aM",@progbits,4 + .align 2 .LC0: /* 2**52 */ - .long 0x43300000 - .long 0 + .long 0x59800000 .section ".text" ENTRY (__rint) #ifdef SHARED mflr r11 + cfi_register(lr,r11) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) + lfs fp13,0(r9) +# endif mtlr r11 - lfd fp13,0(r9) + cfi_same_value (lr) #else lis r9,.LC0@ha - lfd fp13,.LC0@l(r9) + lfs fp13,.LC0@l(r9) #endif fabs fp0,fp1 fsub fp12,fp13,fp13 /* generate 0.0 */ @@ -57,13 +58,14 @@ ENTRY (__rint) bng- cr6,.L4 fadd fp1,fp1,fp13 /* x+= TWO52; */ fsub fp1,fp1,fp13 /* x-= TWO52; */ - blr + fabs fp1,fp1 /* if (x == 0.0) */ + blr /* x = 0.0; */ .L4: bnllr- cr6 /* if (x < 0.0) */ - fsub fp1,fp13,fp1 /* x = TWO52 - x; */ - fsub fp0,fp1,fp13 /* x = - (x - TWO52); */ - fneg fp1,fp0 - blr + fsub fp1,fp1,fp13 /* x-= TWO52; */ + fadd fp1,fp1,fp13 /* x+= TWO52; */ + fnabs fp1,fp1 /* if (x == 0.0) */ + blr /* x = -0.0; */ END (__rint) weak_alias (__rint, rint) @@ -72,3 +74,6 @@ weak_alias (__rint, rint) weak_alias (__rint, rintl) strong_alias (__rint, __rintl) #endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __rint, rintl, GLIBC_2_0) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S b/sysdeps/powerpc/powerpc32/fpu/s_rintf.S index cebf6423af..7771cb2bc8 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_rintf.S @@ -1,5 +1,5 @@ /* Round float to int floating-point values. PowerPC32 version. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 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 @@ -14,38 +14,37 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> - - .section .rodata - .align 3 - .type TWO23.0,@object - .size TWO23.0,8 -TWO23.0: - .long 0x41600000 - .long 0 - - .section .rodata.cst8,"aM",@progbits,8 - .align 3 + .section .rodata.cst4,"aM",@progbits,4 + .align 2 .LC0: /* 2**23 */ - .long 0x41600000 - .long 0 + .long 0x4b000000 .section ".text" ENTRY (__rintf) #ifdef SHARED mflr r11 + cfi_register(lr,r11) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) + lfs fp13,0(r9) +# endif mtlr r11 - lfd fp13,0(r9) + cfi_same_value (lr) #else lis r9,.LC0@ha - lfd fp13,.LC0@l(r9) + lfs fp13,.LC0@l(r9) #endif fabs fp0,fp1 fsubs fp12,fp13,fp13 /* generate 0.0 */ @@ -55,13 +54,14 @@ ENTRY (__rintf) bng- cr6,.L4 fadds fp1,fp1,fp13 /* x+= TWO23; */ fsubs fp1,fp1,fp13 /* x-= TWO23; */ - blr + fabs fp1,fp1 /* if (x == 0.0) */ + blr /* x = 0.0; */ .L4: bnllr- cr6 /* if (x < 0.0) */ - fsubs fp1,fp13,fp1 /* x = TWO23 - x; */ - fsubs fp0,fp1,fp13 /* x = - (x - TWO23); */ - fneg fp1,fp0 - blr + fsubs fp1,fp1,fp13 /* x-= TWO23; */ + fadds fp1,fp1,fp13 /* x+= TWO23; */ + fnabs fp1,fp1 /* if (x == 0.0) */ + blr /* x = -0.0; */ END (__rintf) weak_alias (__rintf, rintf) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_round.S b/sysdeps/powerpc/powerpc32/fpu/s_round.S index 13fc74f001..590c87ad8c 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_round.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_round.S @@ -1,5 +1,5 @@ /* round function. PowerPC32 version. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 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 @@ -14,40 +14,18 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> - - .section .rodata - .align 3 - .type TWO52.0,@object - .size TWO52.0,8 -TWO52.0: - .long 0x43300000 - .long 0 - .type POINTFIVE.0,@object - .size POINTFIVE.0,8 -POINTFIVE.0: - .long 0x3fe00000 - .long 0 - .type NEGZERO.0,@object - .size NEGZERO.0,8 -NEGZERO.0: - .long 0x80000000 - .long 0 +#include <math_ldbl_opt.h> .section .rodata.cst8,"aM",@progbits,8 - .align 3 + .align 2 .LC0: /* 2**52 */ - .long 0x43300000 - .long 0 + .long 0x59800000 .LC1: /* 0.5 */ - .long 0x3fe00000 - .long 0 -.LC2: /* -0.0 */ - .long 0x80000000 - .long 0 + .long 0x3f000000 /* double [fp1] round (double x [fp1]) IEEE 1003.1 round function. IEEE specifies "round to the nearest @@ -59,18 +37,28 @@ NEGZERO.0: "Round toward Zero" mode and round by adding +-0.5 before rounding to the integer value. */ + .section ".text" ENTRY (__round) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 + cfi_register(lr,r11) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + addi r9,r9,.LC0-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) +# endif mtlr r11 - lfd fp13,0(r9) + cfi_same_value (lr) + lfs fp13,0(r9) #else lis r9,.LC0@ha - lfd fp13,.LC0@l(r9) + lfs fp13,.LC0@l(r9) #endif fabs fp0,fp1 fsub fp12,fp13,fp13 /* generate 0.0 */ @@ -79,17 +67,17 @@ ENTRY (__round) bnllr- cr7 mtfsfi 7,1 /* Set rounding mode toward 0. */ #ifdef SHARED - lwz r9,.LC1@got(10) - lfd fp10,0(r9) + lfs fp10,.LC1-.LC0(r9) #else lis r9,.LC1@ha - lfd fp10,.LC1@l(r9) + lfs fp10,.LC1@l(r9) #endif ble- cr6,.L4 fadd fp1,fp1,fp10 /* x+= 0.5; */ fadd fp1,fp1,fp13 /* x+= TWO52; */ fsub fp1,fp1,fp13 /* x-= TWO52; */ -.L9: + fabs fp1,fp1 /* if (x == 0.0) */ + /* x = 0.0; */ mtfsf 0x01,fp11 /* restore previous rounding mode. */ blr .L4: @@ -97,16 +85,10 @@ ENTRY (__round) bge- cr6,.L9 /* if (x < 0.0) */ fsub fp1,fp9,fp13 /* x-= TWO52; */ fadd fp1,fp1,fp13 /* x+= TWO52; */ - fcmpu cr5,fp1,fp12 /* if (x > 0.0) */ + fnabs fp1,fp1 /* if (x == 0.0) */ + /* x = -0.0; */ +.L9: mtfsf 0x01,fp11 /* restore previous rounding mode. */ - bnelr+ cr5 -#ifdef SHARED - lwz r9,.LC2@got(10) - lfd fp1,0(r9) -#else - lis r9,.LC2@ha - lfd fp1,.LC2@l(r9) -#endif blr END (__round) @@ -116,3 +98,6 @@ weak_alias (__round, round) weak_alias (__round, roundl) strong_alias (__round, __roundl) #endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __round, roundl, GLIBC_2_1) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S index ea8aaf3add..7e99bca315 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S @@ -1,5 +1,5 @@ /* roundf function. PowerPC32 version. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 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 @@ -14,40 +14,17 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> - .section .rodata - .align 3 - .type TWO23.0,@object - .size TWO23.0,8 -TWO23.0: - .long 0x43300000 - .long 0 - .type POINTFIVE.0,@object - .size POINTFIVE.0,8 -POINTFIVE.0: - .long 0x3fe00000 - .long 0 - .type NEGZERO.0,@object - .size NEGZERO.0,8 -NEGZERO.0: - .long 0x80000000 - .long 0 - .section .rodata.cst8,"aM",@progbits,8 - .align 3 + .align 2 .LC0: /* 2**23 */ - .long 0x41600000 - .long 0 + .long 0x4b000000 .LC1: /* 0.5 */ - .long 0x3fe00000 - .long 0 -.LC2: /* -0.0 */ - .long 0x80000000 - .long 0 + .long 0x3f000000 /* float [fp1] roundf (float x [fp1]) IEEE 1003.1 round function. IEEE specifies "round to the nearest @@ -59,18 +36,28 @@ NEGZERO.0: "Round toward Zero" mode and round by adding +-0.5 before rounding to the integer value. */ + .section ".text" ENTRY (__roundf ) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 + cfi_register(lr,r11) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + addi r9,r9,.LC0-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) +# endif mtlr r11 - lfd fp13,0(r9) + cfi_same_value (lr) + lfs fp13,0(r9) #else lis r9,.LC0@ha - lfd fp13,.LC0@l(r9) + lfs fp13,.LC0@l(r9) #endif fabs fp0,fp1 fsubs fp12,fp13,fp13 /* generate 0.0 */ @@ -79,17 +66,17 @@ ENTRY (__roundf ) bnllr- cr7 mtfsfi 7,1 /* Set rounding mode toward 0. */ #ifdef SHARED - lwz r9,.LC1@got(10) - lfd fp10,0(r9) + lfs fp10,.LC1-.LC0(r9) #else lis r9,.LC1@ha - lfd fp10,.LC1@l(r9) + lfs fp10,.LC1@l(r9) #endif ble- cr6,.L4 fadds fp1,fp1,fp10 /* x+= 0.5; */ fadds fp1,fp1,fp13 /* x+= TWO23; */ fsubs fp1,fp1,fp13 /* x-= TWO23; */ -.L9: + fabs fp1,fp1 /* if (x == 0.0) */ + /* x = 0.0; */ mtfsf 0x01,fp11 /* restore previous rounding mode. */ blr .L4: @@ -97,16 +84,10 @@ ENTRY (__roundf ) bge- cr6,.L9 /* if (x < 0.0) */ fsubs fp1,fp9,fp13 /* x-= TWO23; */ fadds fp1,fp1,fp13 /* x+= TWO23; */ - fcmpu cr5,fp1,fp12 /* if (x > 0.0) */ + fnabs fp1,fp1 /* if (x == 0.0) */ + /* x = -0.0; */ +.L9: mtfsf 0x01,fp11 /* restore previous rounding mode. */ - bnelr+ cr5 -#ifdef SHARED - lwz r9,.LC2@got(10) - lfd fp1,0(r9) -#else - lis r9,.LC2@ha - lfd fp1,.LC2@l(r9) -#endif blr END (__roundf) diff --git a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S index a4be651f8c..5bc0856b9f 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S @@ -1,5 +1,5 @@ /* trunc function. PowerPC32 version. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 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 @@ -14,32 +14,16 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> +#include <math_ldbl_opt.h> - .section .rodata - .align 3 - .type TWO52.0,@object - .size TWO52.0,8 -TWO52.0: - .long 0x43300000 - .long 0 - .type NEGZERO.0,@object - .size NEGZERO.0,8 -NEGZERO.0: - .long 0x80000000 - .long 0 - - .section .rodata.cst8,"aM",@progbits,8 - .align 3 + .section .rodata.cst4,"aM",@progbits,4 + .align 2 .LC0: /* 2**52 */ - .long 0x43300000 - .long 0 -.LC1: /* -0.0 */ - .long 0x80000000 - .long 0 + .long 0x59800000 /* double [fp1] trunc (double x [fp1]) IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer @@ -48,18 +32,28 @@ NEGZERO.0: We set "round toward Zero" mode and trunc by adding +-2**52 then subtracting +-2**52. */ + .section ".text" ENTRY (__trunc) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 + cfi_register(lr,r11) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) + lfs fp13,0(r9) +# endif mtlr r11 - lfd fp13,0(r9) + cfi_same_value (lr) #else lis r9,.LC0@ha - lfd fp13,.LC0@l(r9) + lfs fp13,.LC0@l(r9) #endif fabs fp0,fp1 fsub fp12,fp13,fp13 /* generate 0.0 */ @@ -70,23 +64,18 @@ ENTRY (__trunc) ble- cr6,.L4 fadd fp1,fp1,fp13 /* x+= TWO52; */ fsub fp1,fp1,fp13 /* x-= TWO52; */ -.L9: - mtfsf 0x01,fp11 /* restore previous truncing mode. */ + fabs fp1,fp1 /* if (x == 0.0) */ + /* x = 0.0; */ + mtfsf 0x01,fp11 /* restore previous rounding mode. */ blr .L4: bge- cr6,.L9 /* if (x < 0.0) */ fsub fp1,fp1,fp13 /* x-= TWO52; */ fadd fp1,fp1,fp13 /* x+= TWO52; */ - fcmpu cr5,fp1,fp12 /* if (x > 0.0) */ + fnabs fp1,fp1 /* if (x == 0.0) */ + /* x = -0.0; */ +.L9: mtfsf 0x01,fp11 /* restore previous rounding mode. */ - bnelr+ cr5 -#ifdef SHARED - lwz r9,.LC1@got(10) - lfd fp1,0(r9) -#else - lis r9,.LC1@ha - lfd fp1,.LC1@l(r9) -#endif blr END (__trunc) @@ -96,3 +85,6 @@ weak_alias (__trunc, trunc) weak_alias (__trunc, truncl) strong_alias (__trunc, __truncl) #endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __trunc, truncl, GLIBC_2_1) +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S index 9a8dae931b..e2e3bd6740 100644 --- a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S +++ b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S @@ -1,5 +1,5 @@ /* truncf function. PowerPC32 version. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 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 @@ -14,32 +14,15 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> - .section .rodata - .align 3 - .type TWO23.0,@object - .size TWO23.0,8 -TWO23.0: - .long 0x41600000 - .long 0 - .type NEGZERO.0,@object - .size NEGZERO.0,8 -NEGZERO.0: - .long 0x80000000 - .long 0 - - .section .rodata.cst8,"aM",@progbits,8 - .align 3 + .section .rodata.cst4,"aM",@progbits,4 + .align 2 .LC0: /* 2**23 */ - .long 0x41600000 - .long 0 -.LC1: /* -0.0 */ - .long 0x80000000 - .long 0 + .long 0x4b000000 /* float [fp1] truncf (float x [fp1]) IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer @@ -48,18 +31,28 @@ NEGZERO.0: We set "round toward Zero" mode and trunc by adding +-2**23 then subtracting +-2**23. */ + .section ".text" ENTRY (__truncf) mffs fp11 /* Save current FPU rounding mode. */ #ifdef SHARED mflr r11 + cfi_register(lr,r11) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + lfs fp13,.LC0-1b@l(r9) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r10 lwz r9,.LC0@got(10) + lfs fp13,0(r9) +# endif mtlr r11 - lfd fp13,0(r9) + cfi_same_value (lr) #else lis r9,.LC0@ha - lfd fp13,.LC0@l(r9) + lfs fp13,.LC0@l(r9) #endif fabs fp0,fp1 fsubs fp12,fp13,fp13 /* generate 0.0 */ @@ -70,23 +63,18 @@ ENTRY (__truncf) ble- cr6,.L4 fadds fp1,fp1,fp13 /* x+= TWO23; */ fsubs fp1,fp1,fp13 /* x-= TWO23; */ -.L9: - mtfsf 0x01,fp11 /* restore previous truncing mode. */ + fabs fp1,fp1 /* if (x == 0.0) */ + /* x = 0.0; */ + mtfsf 0x01,fp11 /* restore previous rounding mode. */ blr .L4: bge- cr6,.L9 /* if (x < 0.0) */ fsubs fp1,fp1,fp13 /* x-= TWO23; */ fadds fp1,fp1,fp13 /* x+= TWO23; */ - fcmpu cr5,fp1,fp12 /* if (x > 0.0) */ + fnabs fp1,fp1 /* if (x == 0.0) */ + /* x = -0.0; */ +.L9: mtfsf 0x01,fp11 /* restore previous rounding mode. */ - bnelr+ cr5 -#ifdef SHARED - lwz r9,.LC1@got(10) - lfd fp1,0(r9) -#else - lis r9,.LC1@ha - lfd fp1,.LC1@l(r9) -#endif blr END (__truncf) diff --git a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S index 77ee05f487..851480d2ef 100644 --- a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S +++ b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S @@ -1,5 +1,5 @@ /* setjmp for PowerPC. - Copyright (C) 1995-99, 2000, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-2000, 2003-2005, 2006 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 @@ -14,16 +14,15 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + Software Foundation, Inc., 1 Franklin Street, Fifth Floor, Boston MA + 02110-1301 USA. */ #include <sysdep.h> #define _ASM -#define _SETJMP_H #ifdef __NO_VMX__ # include <novmxsetjmp.h> #else -# include <bits/setjmp.h> +# include <jmpbuf-offsets.h> #endif #include <bp-sym.h> #include <bp-asm.h> @@ -32,10 +31,19 @@ ENTRY (BP_SYM (__sigsetjmp)) CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE) +#ifdef PTR_MANGLE + mr r5,r1 + PTR_MANGLE(r5, r6) + stw r5,(JB_GPR1*4)(3) +#else stw r1,(JB_GPR1*4)(3) +#endif mflr r0 stw r14,((JB_GPRS+0)*4)(3) stfd fp14,((JB_FPRS+0*2)*4)(3) +#ifdef PTR_MANGLE + PTR_MANGLE2 (r0, r6) +#endif stw r0,(JB_LR*4)(3) stw r15,((JB_GPRS+1)*4)(3) stfd fp15,((JB_FPRS+1*2)*4)(3) @@ -74,23 +82,31 @@ ENTRY (BP_SYM (__sigsetjmp)) stw r31,((JB_GPRS+17)*4)(3) stfd fp31,((JB_FPRS+17*2)*4)(3) #ifndef __NO_VMX__ -#ifdef PIC +# ifdef PIC mflr r6 + cfi_register(lr,r6) +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r5 + addis r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r5 -#ifdef SHARED +# endif + mtlr r6 + cfi_same_value (lr) +# ifdef SHARED lwz r5,_rtld_global_ro@got(r5) - mtlr r6 lwz r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r5) -#else - lwz r5,_rtld_global_ro@got(r5) - mtlr r6 +# else + lwz r5,_dl_hwcap@got(r5) lwz r5,0(r5) -#endif -#else - lis r5,_dl_hwcap@ha - lwz r5,_dl_hwcap@l(r5) -#endif +# endif +# else + lis r6,_dl_hwcap@ha + lwz r5,_dl_hwcap@l(r6) +# endif andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16) beq L(no_vmx) la r5,((JB_VRS)*4)(3) @@ -164,5 +180,5 @@ L(aligned_save_vmx): stvx 31,0,r6 L(no_vmx): #endif - b JUMPTARGET (BP_SYM (__sigjmp_save)) + b BP_SYM (__sigjmp_save@local) END (BP_SYM (__sigsetjmp)) |