diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2011-12-22 19:27:39 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2011-12-22 19:27:39 +0000 |
commit | 8a031172c235ab0def5763dd5f3a00f9ff10c053 (patch) | |
tree | 11ba9c29e8edc754174f18e6db425971144769c9 /libc/sysdeps/powerpc/powerpc32 | |
parent | a179b968417641981213cfe422c741141d8394e4 (diff) | |
download | eglibc2-8a031172c235ab0def5763dd5f3a00f9ff10c053.tar.gz |
Merge changes between r16068 and r16332 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@16333 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps/powerpc/powerpc32')
31 files changed, 401 insertions, 130 deletions
diff --git a/libc/sysdeps/powerpc/powerpc32/a2/memcpy.S b/libc/sysdeps/powerpc/powerpc32/a2/memcpy.S index 472f7a393..f4c3c1841 100644 --- a/libc/sysdeps/powerpc/powerpc32/a2/memcpy.S +++ b/libc/sysdeps/powerpc/powerpc32/a2/memcpy.S @@ -1,5 +1,5 @@ /* Optimized memcpy implementation for PowerPC A2. - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010, 2011 Free Software Foundation, Inc. Contributed by Michael Brutman <brutman@us.ibm.com>. This file is part of the GNU C Library. @@ -113,11 +113,9 @@ L(dst_aligned): mflr r0 /* Establishes GOT addressability so we can load __cache_line_size from static. This value was set from the aux vector during startup. */ - bcl 20,31,1f -1: - mflr r9 - addis r9,r9,__cache_line_size-1b@ha - lwz r9,__cache_line_size-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,__cache_line_size-got_label@ha + lwz r9,__cache_line_size-got_label@l(r9) mtlr r0 #else /* Load __cache_line_size from static. This value was set from the diff --git a/libc/sysdeps/powerpc/powerpc32/dl-start.S b/libc/sysdeps/powerpc/powerpc32/dl-start.S index ae41f47ed..c2fcc3746 100644 --- a/libc/sysdeps/powerpc/powerpc32/dl-start.S +++ b/libc/sysdeps/powerpc/powerpc32/dl-start.S @@ -1,5 +1,6 @@ /* Machine-dependent ELF startup code. PowerPC version. - Copyright (C) 1995-2000, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1995-2000, 2002, 2004, 2005, 2006, 2011 + 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 @@ -47,10 +48,9 @@ _dl_start_user: passed by value!). */ /* Put our GOT pointer in r31, */ - bcl 20,31,1f -1: mflr r31 - addis r31,r31,_GLOBAL_OFFSET_TABLE_-1b@ha - addi r31,r31,_GLOBAL_OFFSET_TABLE_-1b@l + SETUP_GOT_ACCESS(r31,got_label) + addis r31,r31,_GLOBAL_OFFSET_TABLE_-got_label@ha + addi r31,r31,_GLOBAL_OFFSET_TABLE_-got_label@l /* the address of _start in r30, */ mr r30,r3 /* &_dl_argc in 29, &_dl_argv in 27, and _dl_loaded in 28. */ diff --git a/libc/sysdeps/powerpc/powerpc32/elf/start.S b/libc/sysdeps/powerpc/powerpc32/elf/start.S index dc89a5e10..a26ba430f 100644 --- a/libc/sysdeps/powerpc/powerpc32/elf/start.S +++ b/libc/sysdeps/powerpc/powerpc32/elf/start.S @@ -1,5 +1,5 @@ /* Startup code for programs linked with GNU libc. - Copyright (C) 1998,1999,2000,2001,2002,2003,2009 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2009, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -59,10 +59,8 @@ ENTRY(_start) /* Set up an initial stack frame, and clear the LR. */ clrrwi r1,r1,4 #ifdef PIC - bcl 20,31,L(branch) -L(branch): + SETUP_GOT_ACCESS(r13,got_label) li r0,0 - mflr r13 #else li r0,0 #endif @@ -73,10 +71,10 @@ L(branch): start_addresses in r8. Also load the GOT pointer so that new PLT calls work, like the one to __libc_start_main. */ #ifdef PIC - addis r30,r13,_GLOBAL_OFFSET_TABLE_-L(branch)@ha - addis r8,r13,L(start_addresses)-L(branch)@ha - addi r30,r30,_GLOBAL_OFFSET_TABLE_-L(branch)@l - lwzu r13,L(start_addresses)-L(branch)@l(r8) + addis r30,r13,_GLOBAL_OFFSET_TABLE_-got_label@ha + addis r8,r13,L(start_addresses)-got_label@ha + addi r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@l + lwzu r13, L(start_addresses)-got_label@l(r8) #else lis r8,L(start_addresses)@ha lwzu r13,L(start_addresses)@l(r8) diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S index e1ac064a5..b509ef3b3 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S @@ -1,5 +1,6 @@ /* longjmp for PowerPC. - Copyright (C) 1995-99, 2000, 2003-2006, 2009 Free Software Foundation, Inc. + Copyright (C) 1995-99, 2000, 2003-2006, 2009, 2011 + 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,10 +35,9 @@ ENTRY (BP_SYM (__longjmp)) # ifdef PIC mflr r6 cfi_register (lr,r6) - bcl 20,31,1f -1: mflr r5 - addis r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha - addi r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l + SETUP_GOT_ACCESS(r5,got_label) + addis r5,r5,_GLOBAL_OFFSET_TABLE_-got_label@ha + addi r5,r5,_GLOBAL_OFFSET_TABLE_-got_label@l # ifdef SHARED lwz r5,_rtld_global_ro@got(r5) mtlr r6 diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S index 80e72ca2b..a231448d3 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S @@ -1,5 +1,5 @@ /* ceil function. PowerPC32 version. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2011 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 @@ -31,10 +31,9 @@ ENTRY (__ceil) #ifdef SHARED mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp13,.LC0-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + lfs fp13,.LC0-got_label@l(r9) mtlr r11 cfi_same_value (lr) #else diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S index ce6d71e4f..bfd5c61e6 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S @@ -1,5 +1,5 @@ /* float ceil function. PowerPC32 version. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2011 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,10 +30,9 @@ ENTRY (__ceilf) #ifdef SHARED mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp13,.LC0-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + lfs fp13,.LC0-got_label@l(r9) mtlr r11 cfi_same_value (lr) #else diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S index 0dd0dbe6c..73971acb4 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S @@ -1,5 +1,5 @@ /* Floor function. PowerPC32 version. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2011 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 @@ -31,10 +31,9 @@ ENTRY (__floor) #ifdef SHARED mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp13,.LC0-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + lfs fp13,.LC0-got_label@l(r9) mtlr r11 cfi_same_value (lr) #else diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S index 98a47458b..562349e17 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S @@ -1,5 +1,5 @@ /* float Floor function. PowerPC32 version. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2011 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,10 +30,9 @@ ENTRY (__floorf) #ifdef SHARED mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp13,.LC0-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + lfs fp13,.LC0-got_label@l(r9) mtlr r11 cfi_same_value (lr) #else diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S index 3bf1ffaea..b29ee9d28 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S @@ -1,5 +1,5 @@ /* lround function. PowerPC32 version. - Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2007, 2008, 2011 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 @@ -45,10 +45,9 @@ ENTRY (__lround) #ifdef SHARED mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp10,.LC0-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + lfs fp10,.LC0-got_label@l(r9) mtlr r11 cfi_same_value (lr) #else diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S new file mode 100644 index 000000000..0102aa331 --- /dev/null +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S @@ -0,0 +1,80 @@ +/* Round to int floating-point values. PowerPC32 version. + Copyright (C) 2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011 + + 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., 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> + + +/* double [fp1] nearbyint(double [fp1] x) */ + + .section .rodata.cst4,"aM",@progbits,4 + .align 2 +.LC0: /* 2**52 */ + .long 0x59800000 /* TWO52: 2**52 */ + + .section ".text" +ENTRY (__nearbyint) +#ifdef SHARED + mflr r11 + cfi_register(lr,r11) + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + lfs fp13,.LC0-1b@l(r9) + mtlr r11 + cfi_same_value (lr) +#else + lis r9,.LC0@ha + lfs fp13,.LC0@l(r9) +#endif + fabs fp0,fp1 + fsub fp12,fp13,fp13 /* generate 0.0 */ + fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52 */ + bgelr cr7 + fcmpu cr7,fp1,fp12 /* if (x > 0.0 */ + ble cr7,L(lessthanzero) + mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ + fadd fp0,fp1,fp13 /* x += TWO52 */ + fsub fp1,fp0,fp13 /* x -= TWO52 */ + fabs fp1,fp1 /* if (x == 0.0 */ + mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */ + blr +L(lessthanzero): + bgelr cr7 + mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ + fsub fp0,fp13,fp1 /* x -= TWO52 */ + fsub fp0,fp0,fp13 /* x += TWO52 */ + fneg fp1,fp0 /* if (x == 0.0) */ + mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */ + blr +END (__nearbyint) + +weak_alias (__nearbyint, nearbyint) + +#ifdef NO_LONG_DOUBLE +weak_alias (__nearbyint, nearbyintl) +strong_alias (__nearbyint, __nearbyintl) +#endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) +compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_0) +#endif diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S new file mode 100644 index 000000000..519022806 --- /dev/null +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S @@ -0,0 +1,70 @@ +/* Round to int floating-point values. PowerPC32 version. + Copyright (C) 2011 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Adhemerval Zanella <azanella@br.ibm.com>, 2011 + + 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., 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> + + +/* float [fp1] nearbyintf(float [fp1] x) */ + + .section .rodata.cst4,"aM",@progbits,4 + .align 2 +.LC0: + .long 0x4B000000 /* TWO23: 2**23 */ + + .section ".text" +ENTRY (__nearbyintf) +#ifdef SHARED + mflr r11 + cfi_register(lr,r11) + bcl 20,31,1f +1: mflr r9 + addis r9,r9,.LC0-1b@ha + lfs fp13,.LC0-1b@l(r9) + mtlr r11 + cfi_same_value (lr) +#else + lis r9,.LC0@ha + lfs fp13,.LC0@l(r9) +#endif + fabs fp0,fp1 + fsub fp12,fp13,fp13 /* generate 0.0 */ + fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23 */ + bgelr cr7 + fcmpu cr7,fp1,fp12 /* if (x > 0.0 */ + ble cr7,L(lessthanzero) + mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ + fadds fp0,fp1,fp13 /* x += TWO23 */ + fsubs fp1,fp0,fp13 /* x -= TWO23 */ + mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */ + blr +L(lessthanzero): + bgelr cr7 + mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */ + fsubs fp0,fp13,fp1 /* x -= TWO23 */ + fsubs fp0,fp0,fp13 /* x += TWO23 */ + fneg fp1,fp0 /* if (x == 0.0) */ + mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */ + blr +END (__nearbyintf) + +weak_alias (__nearbyintf, nearbyintf) diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S index 93133718a..17cd0bd90 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S @@ -1,5 +1,5 @@ /* Round to int floating-point values. PowerPC32 version. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2011 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 @@ -33,10 +33,9 @@ ENTRY (__rint) #ifdef SHARED mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp13,.LC0-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + lfs fp13,.LC0-got_label@l(r9) mtlr r11 cfi_same_value (lr) #else diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S index 1e0fbb1f0..d5115bc25 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S @@ -1,5 +1,5 @@ /* Round float to int floating-point values. PowerPC32 version. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2011 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,10 +29,9 @@ ENTRY (__rintf) #ifdef SHARED mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp13,.LC0-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + lfs fp13,.LC0-got_label@l(r9) mtlr r11 cfi_same_value (lr) #else diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_round.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_round.S index 48b346e65..dcb8dbedc 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/s_round.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_round.S @@ -1,5 +1,5 @@ /* round function. PowerPC32 version. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2011 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,10 +43,9 @@ ENTRY (__round) #ifdef SHARED mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - addi r9,r9,.LC0-1b@l + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + addi r9,r9,.LC0-got_label@l mtlr r11 cfi_same_value (lr) lfs fp13,0(r9) diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S index 88125aad0..0da925124 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S @@ -1,5 +1,5 @@ /* roundf function. PowerPC32 version. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2011 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 @@ -42,10 +42,9 @@ ENTRY (__roundf ) #ifdef SHARED mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - addi r9,r9,.LC0-1b@l + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + addi r9,r9,.LC0-got_label@l mtlr r11 cfi_same_value (lr) lfs fp13,0(r9) diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S index c3c021716..b731cb7c8 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S @@ -1,5 +1,5 @@ /* trunc function. PowerPC32 version. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2011 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,10 +38,9 @@ ENTRY (__trunc) #ifdef SHARED mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp13,.LC0-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + lfs fp13,.LC0-got_label@l(r9) mtlr r11 cfi_same_value (lr) #else diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S b/libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S index eddef070c..e14ec1b5d 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S @@ -1,5 +1,5 @@ /* truncf function. PowerPC32 version. - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2011 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 @@ -37,10 +37,9 @@ ENTRY (__truncf) #ifdef SHARED mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfs fp13,.LC0-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + lfs fp13,.LC0-got_label@l(r9) mtlr r11 cfi_same_value (lr) #else diff --git a/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S b/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S index 131e7a332..90e20ba57 100644 --- a/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S +++ b/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S @@ -1,5 +1,5 @@ /* setjmp for PowerPC. - Copyright (C) 1995-2000, 2003-2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1995-2000, 2003-2005, 2006, 2011 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 @@ -85,10 +85,9 @@ ENTRY (BP_SYM (__sigsetjmp)) # ifdef PIC mflr r6 cfi_register(lr,r6) - bcl 20,31,1f -1: mflr r5 - addis r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha - addi r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l + SETUP_GOT_ACCESS(r5,got_label) + addis r5,r5,_GLOBAL_OFFSET_TABLE_-got_label@ha + addi r5,r5,_GLOBAL_OFFSET_TABLE_-got_label@l mtlr r6 cfi_same_value (lr) # ifdef SHARED diff --git a/libc/sysdeps/powerpc/powerpc32/memset.S b/libc/sysdeps/powerpc/powerpc32/memset.S index b4ce218e2..9803e7efd 100644 --- a/libc/sysdeps/powerpc/powerpc32/memset.S +++ b/libc/sysdeps/powerpc/powerpc32/memset.S @@ -1,5 +1,6 @@ /* Optimized memset implementation for PowerPC. - Copyright (C) 1997, 1999, 2000, 2003, 2007 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2000, 2003, 2007, 2011 + 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 @@ -256,10 +257,9 @@ L(checklinesize): beq L(medium) /* Establishes GOT addressability so we can load __cache_line_size from static. This value was set from the aux vector during startup. */ - bcl 20,31,1f -1: mflr rGOT - addis rGOT,rGOT,__cache_line_size-1b@ha - lwz rCLS,__cache_line_size-1b@l(rGOT) + SETUP_GOT_ACCESS(rGOT,got_label) + addis rGOT,rGOT,__cache_line_size-got_label@ha + lwz rCLS,__cache_line_size-got_label@l(rGOT) mtlr rTMP #else /* Load __cache_line_size from static. This value was set from the diff --git a/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S b/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S index b03e041d8..591fcfb3c 100644 --- a/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S +++ b/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S @@ -1,5 +1,5 @@ /* llround function. PowerPC32 on PowerPC64 version. - Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2007, 2008, 2011 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 @@ -53,10 +53,9 @@ ENTRY (__llround) #ifdef SHARED mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - addi r9,r9,.LC0-1b@l + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + addi r9,r9,.LC0-got_label@l mtlr r11 cfi_same_value (lr) lfd fp9,0(r9) diff --git a/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S b/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S index c03dfa37f..e04968e6f 100644 --- a/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S +++ b/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S @@ -63,11 +63,9 @@ EALIGN (__sqrt, 5, 0) cfi_offset(lr,20-16) cfi_offset(r30,8-16) #ifdef SHARED - bcl 20,31,.LCF1 -.LCF1: - mflr r30 - addis r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@ha - addi r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@l + SETUP_GOT_ACCESS(r30,got_label) + addis r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@ha + addi r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@l lwz r9,_LIB_VERSION@got(30) lwz r0,0(r9) #else diff --git a/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S b/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S index 050323da5..356d3edac 100644 --- a/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S +++ b/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S @@ -63,11 +63,9 @@ EALIGN (__sqrtf, 5, 0) cfi_offset(lr,20-16) cfi_offset(r30,8-16) #ifdef SHARED - bcl 20,31,.LCF1 -.LCF1: - mflr r30 - addis r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@ha - addi r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@l + SETUP_GOT_ACCESS(r30,got_label) + addis r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@ha + addi r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@l lwz r9,_LIB_VERSION@got(30) lwz r0,0(r9) #else diff --git a/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S b/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S index 1c0f70dc5..f89b651e4 100644 --- a/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S +++ b/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S @@ -63,11 +63,9 @@ EALIGN (__sqrt, 5, 0) cfi_offset(lr,20-16) cfi_offset(r30,8-16) #ifdef SHARED - bcl 20,31,.LCF1 -.LCF1: - mflr r30 - addis r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@ha - addi r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@l + SETUP_GOT_ACCESS(r30,got_label) + addis r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@ha + addi r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@l lwz r9,_LIB_VERSION@got(30) lwz r0,0(r9) #else diff --git a/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S b/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S index e638cc102..e9dde1676 100644 --- a/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S +++ b/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S @@ -63,11 +63,9 @@ EALIGN (__sqrtf, 5, 0) cfi_offset(lr,20-16) cfi_offset(r30,8-16) #ifdef SHARED - bcl 20,31,.LCF1 -.LCF1: - mflr r30 - addis r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@ha - addi r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@l + SETUP_GOT_ACCESS(r30,got_label) + addis r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@ha + addi r30,r30,_GLOBAL_OFFSET_TABLE_-got_label@l lwz r9,_LIB_VERSION@got(30) lwz r0,0(r9) #else diff --git a/libc/sysdeps/powerpc/powerpc32/power7/Makefile b/libc/sysdeps/powerpc/powerpc32/power7/Makefile new file mode 100644 index 000000000..5e8f4a28b --- /dev/null +++ b/libc/sysdeps/powerpc/powerpc32/power7/Makefile @@ -0,0 +1,4 @@ +ifeq ($(subdir),string) +CFLAGS-strncase.c += -funroll-loops +CFLAGS-strncase_l.c += -funroll-loops +endif diff --git a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S index 5b0d950c7..40e6679d1 100644 --- a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S +++ b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S @@ -1,5 +1,5 @@ /* finite(). PowerPC32/POWER7 version. - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010, 2011 Free Software Foundation, Inc. Contributed by Luis Machado <luisgpm@br.ibm.com>. This file is part of the GNU C Library. @@ -35,10 +35,9 @@ ENTRY (__finite) mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfd fp0,.LC0-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + lfd fp0,.LC0-got_label@l(r9) mtlr r11 cfi_same_value (lr) diff --git a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S index 297953491..a026583a1 100644 --- a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S +++ b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S @@ -1,5 +1,5 @@ /* isinf(). PowerPC32/POWER7 version. - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010, 2011 Free Software Foundation, Inc. Contributed by Luis Machado <luisgpm@br.ibm.com>. This file is part of the GNU C Library. @@ -35,10 +35,9 @@ ENTRY (__isinf) mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfd fp0,.LC0-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + lfd fp0,.LC0-got_label@l(r9) mtlr r11 cfi_same_value (lr) diff --git a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S index 852539f24..123260bbb 100644 --- a/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S +++ b/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S @@ -1,5 +1,5 @@ /* isnan(). PowerPC32/POWER7 version. - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010, 2011 Free Software Foundation, Inc. Contributed by Luis Machado <luisgpm@br.ibm.com>. This file is part of the GNU C Library. @@ -35,10 +35,9 @@ ENTRY (__isnan) mflr r11 cfi_register(lr,r11) - bcl 20,31,1f -1: mflr r9 - addis r9,r9,.LC0-1b@ha - lfd fp0,.LC0-1b@l(r9) + SETUP_GOT_ACCESS(r9,got_label) + addis r9,r9,.LC0-got_label@ha + lfd fp0,.LC0-got_label@l(r9) mtlr r11 cfi_same_value (lr) diff --git a/libc/sysdeps/powerpc/powerpc32/power7/strcasecmp.S b/libc/sysdeps/powerpc/powerpc32/power7/strcasecmp.S new file mode 100644 index 000000000..5d84fce47 --- /dev/null +++ b/libc/sysdeps/powerpc/powerpc32/power7/strcasecmp.S @@ -0,0 +1,132 @@ +/* Optimized strcasecmp implementation for PowerPC32. + Copyright (C) 2011 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 <bp-sym.h> +#include <bp-asm.h> +#include <locale-defines.h> + +/* int [r3] strcasecmp (const char *s1 [r3], const char *s2 [r4] ) + + or if defined USE_IN_EXTENDED_LOCALE_MODEL: + + int [r3] strcasecmp_l (const char *s1 [r3], const char *s2 [r4], + __locale_t loc [r5]) */ + +#ifndef STRCMP +# define __STRCMP __strcasecmp +# define STRCMP strcasecmp +#endif + +ENTRY (BP_SYM (__STRCMP)) + +#define rRTN r3 /* Return value */ +#define rSTR1 r5 /* 1st string */ +#define rSTR2 r4 /* 2nd string */ +#define rLOCARG r5 /* 3rd argument: locale_t */ +#define rCHAR1 r6 /* Byte readed from 1st string */ +#define rCHAR2 r7 /* Byte readed from 2nd string */ +#define rADDR1 r8 /* Address of tolower(rCHAR1) */ +#define rADDR2 r12 /* Address of tolower(rCHAR2) */ +#define rLWR1 r8 /* Byte tolower(rCHAR1) */ +#define rLWR2 r12 /* Byte tolower(rCHAR2) */ +#define rTMP r0 +#define rGOT r9 /* Address of the Global Offset Table */ +#define rLOC r11 /* Default locale address */ + + cmpw cr7, r3, r4 +#ifndef USE_IN_EXTENDED_LOCALE_MODEL +# ifdef SHARED + mflr rTMP + bcl 20,31,.L1 +.L1: mflr rGOT + addis rGOT, rGOT, _GLOBAL_OFFSET_TABLE_-.L1@ha + addi rGOT, rGOT, _GLOBAL_OFFSET_TABLE_-.L1@l + lwz rLOC, __libc_tsd_LOCALE@got@tprel(rGOT) + add rLOC, rLOC, __libc_tsd_LOCALE@tls + lwz rLOC, 0(rLOC) + mtlr rTMP +# else + lis rTMP,_GLOBAL_OFFSET_TABLE_@ha + la rLOC,_GLOBAL_OFFSET_TABLE_@l(rTMP) + lwz rLOC, __libc_tsd_LOCALE@got@tprel(rGOT) + add rLOC, rLOC, __libc_tsd_LOCALE@tls + lwz rLOC, 0(rLOC) +# endif /* SHARED */ +#else + mr rLOC, rLOCARG +#endif + mr rSTR1, rRTN + lwz rLOC, LOCALE_CTYPE_TOLOWER(rLOC) + li rRTN, 0 + beqlr cr7 + + /* Unrolling loop for POWER: loads are done with 'lbz' plus + offset and string descriptors are only updated in the end + of loop unrolling. */ + +L(loop): + lbz rCHAR1, 0(rSTR1) /* Load char from s1 */ + lbz rCHAR2, 0(rSTR2) /* Load char from s2 */ + sldi rADDR1, rCHAR1, 2 /* Calculate address for tolower(*s1) */ + sldi rADDR2, rCHAR2, 2 /* Calculate address for tolower(*s2) */ + lwzx rLWR1, rLOC, rADDR1 /* Load tolower(*s1) */ + lwzx rLWR2, rLOC, rADDR2 /* Load tolower(*s2) */ + cmpwi cr7, rCHAR1, 0 /* *s1 == '\0' ? */ + subf. r3, rLWR2, rLWR1 + bnelr + beqlr cr7 + lbz rCHAR1, 1(rSTR1) + lbz rCHAR2, 1(rSTR2) + sldi rADDR1, rCHAR1, 2 + sldi rADDR2, rCHAR2, 2 + lwzx rLWR1, rLOC, rADDR1 + lwzx rLWR2, rLOC, rADDR2 + cmpwi cr7, rCHAR1, 0 + subf. r3, rLWR2, rLWR1 + bnelr + beqlr cr7 + lbz rCHAR1, 2(rSTR1) + lbz rCHAR2, 2(rSTR2) + sldi rADDR1, rCHAR1, 2 + sldi rADDR2, rCHAR2, 2 + lwzx rLWR1, rLOC, rADDR1 + lwzx rLWR2, rLOC, rADDR2 + cmpwi cr7, rCHAR1, 0 + subf. r3, rLWR2, rLWR1 + bnelr + beqlr cr7 + lbz rCHAR1, 3(rSTR1) + lbz rCHAR2, 3(rSTR2) + /* Increment both string descriptors */ + addi rSTR1, rSTR1, 4 + addi rSTR2, rSTR2, 4 + sldi rADDR1, rCHAR1, 2 + sldi rADDR2, rCHAR2, 2 + lwzx rLWR1, rLOC, rADDR1 + lwzx rLWR2, rLOC, rADDR2 + cmpwi cr7, rCHAR1, 0 + subf. r3, rLWR2, rLWR1 + bnelr + bne cr7,L(loop) + blr +END (BP_SYM (__STRCMP)) + +weak_alias (BP_SYM (__STRCMP), BP_SYM (STRCMP)) +libc_hidden_builtin_def (__STRCMP) diff --git a/libc/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S b/libc/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S new file mode 100644 index 000000000..c13c4ebcb --- /dev/null +++ b/libc/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S @@ -0,0 +1,5 @@ +#define USE_IN_EXTENDED_LOCALE_MODEL +#define STRCMP strcasecmp_l +#define __STRCMP __strcasecmp_l + +#include "strcasecmp.S" diff --git a/libc/sysdeps/powerpc/powerpc32/sysdep.h b/libc/sysdeps/powerpc/powerpc32/sysdep.h index 88cfe71e0..c824c0a85 100644 --- a/libc/sysdeps/powerpc/powerpc32/sysdep.h +++ b/libc/sysdeps/powerpc/powerpc32/sysdep.h @@ -1,5 +1,6 @@ /* Assembly macros for 32-bit PowerPC. - Copyright (C) 1999, 2001, 2002, 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 1999, 2001, 2002, 2003, 2006, 2011 + 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 @@ -46,6 +47,13 @@ cfi_startproc; \ CALL_MCOUNT +/* helper macro for accessing the 32-bit powerpc GOT. */ + +#define SETUP_GOT_ACCESS(regname,GOT_LABEL) \ + bcl 20,31,GOT_LABEL ; \ +GOT_LABEL: ; \ + mflr (regname) + #define EALIGN_W_0 /* No words to insert. */ #define EALIGN_W_1 nop #define EALIGN_W_2 nop;nop |