This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch, ibm/2.12/master, updated. glibc-2.12.1-67-ga70a592
- From: rsa at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 11 Jan 2012 21:33:31 -0000
- Subject: GNU C Library master sources branch, ibm/2.12/master, updated. glibc-2.12.1-67-ga70a592
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, ibm/2.12/master has been updated
via a70a5926335d6c6d3e51e3766bb573b4971cb3d2 (commit)
via eea213be41a4f37ff42bd3e905f2323091d234e0 (commit)
via 0a08973fdfd081e959b3c42f8f95d27badb46423 (commit)
via 81552be4dfba9fc0a253a072b88cdd1062172d3e (commit)
via b20eec6a2b7056d4a1737a92574cab6d15225796 (commit)
via a960be3fad233bd721f64dfe62d3f0ee798d26e3 (commit)
via e73988fd47a8ab815e4a4427683ac1098c8ff31f (commit)
via be802bc67041210b441ecdd9ebdd33e4e8c177cc (commit)
via 994f2519e9c8ad7fd368aa97ff5d219ac0597de9 (commit)
via 69573077ca04c05fb12e177747711d7ef197a9c8 (commit)
via bb365f5895571160988214f760734129a7f3bf5d (commit)
from 91f0a13b84a8a4ff14219ea2691a6fa684902856 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a70a5926335d6c6d3e51e3766bb573b4971cb3d2
commit a70a5926335d6c6d3e51e3766bb573b4971cb3d2
Author: Ryan S. Arnold <rsa@linux.vnet.ibm.com>
Date: Wed Jan 11 14:42:27 2012 -0600
Correct ordering of entries and spurious whitespace on the end of a line.
diff --git a/ChangeLog b/ChangeLog
index 203d087..7da5eda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,23 @@
* io/Makefile: Added have_pipe2 object.
* io/have_pipe2.c: Declaring __have_pipe2 variable.
+2011-12-06 Andreas Schwab <schwab@linux-m68k.org>
+
+ [BZ #13472]
+ * sysdeps/powerpc/fpu/e_hypot.c (twoM600): Correct value.
+
+2011-11-18 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * math/libm-test.inc: Added more nerabyint tests.
+ * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: New file: nearbyint
+ optimized for PPC32.
+ * sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: New file: nearbyintf
+ optimized for PPC32.
+ * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: New file: nearbyint
+ optimized for PPC64.
+ * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: New file: nearbyintf
+ optimized for PPC64.
+
2011-11-16 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/Makefile: Added locale-defines.sym generation.
@@ -22,28 +39,6 @@
* sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S: New file: strcasecmp_l
optimization for PPC64.
-2011-11-18 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
-
- * math/libm-test.inc: Added more nerabyint tests.
- * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: New file: nearbyint
- optimized for PPC32.
- * sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: New file: nearbyintf
- optimized for PPC32.
- * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: New file: nearbyint
- optimized for PPC64.
- * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: New file: nearbyintf
- optimized for PPC64.
-
-2011-10-22 Andreas Schwab <schwab@linux-m68k.org>
-
- * sysdeps/ieee754/ldbl-128ibm/s_atanl.c: Include <math.h> before
- "math_private.h".
-
-2011-12-06 Andreas Schwab <schwab@linux-m68k.org>
-
- [BZ #13472]
- * sysdeps/powerpc/fpu/e_hypot.c (twoM600): Correct value.
-
2011-11-07 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/fpu/math_private.h: Using inline assembly version
@@ -55,6 +50,11 @@
* sysdeps/powerpc/powerpc64/fpu/e_sqrt.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c: Likewise.
+2011-10-22 Andreas Schwab <schwab@linux-m68k.org>
+
+ * sysdeps/ieee754/ldbl-128ibm/s_atanl.c: Include <math.h> before
+ "math_private.h".
+
2011-10-12 Ulrich Drepper <drepper@gmail.com>
Add integration with gcc's -ffinite-math-only and optimize wrapper
@@ -78,28 +78,6 @@
* sysdeps/powerpc/fpu/k_rem_pio2f.c (__fp_kernel_rem_pio2f): Use
__floorf, __truncf instead of floorf, truncf.
-2011-03-28 Andreas Schwab <schwab@linux-m68k.org>
-
- * sysdeps/powerpc/powerpc32/power4/strncmp.S: Don't read past
- differing bytes.
- * sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
- * sysdeps/powerpc/powerpc32/power7/strncmp.S: Likewise.
- * sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
-
-2011-07-28 Will Schmidt <will_schmidt@vnet.ibm.com>
-
- * sysdeps/powerpc/powerpc32/power7/memcpy.S: Optimize the
- aligned copy for power7 with vector-scalar instructions.
-
- * sysdeps/powerpc/powerpc64/power7/memcpy.S: Optimize the
- aligned copy for power7 with vector-scalar instructions.
-
-2011-05-18 Ryan S. Arnold <rsa@us.ibm.com>
-
- * sysdeps/powerpc/powerpc64/Makefile (no-special-regs): Add -mno-vsx
- and -mno-altivec to prevent the compiler from using Altivec and/or
- VSX instructions when the corresponding registers are not available.
-
2011-08-18 David Flaherty <flaherty@linux.vnet.ibm.com>
* sysdeps/ieee754/ldbl-128ibm/s_fmal.c: New file which checks
@@ -138,6 +116,14 @@
* sysdeps/powerpc/fpu/s_float_bitwise.h: new file: bitwise operation over
floats optimized for POWER7.
+2011-07-28 Will Schmidt <will_schmidt@vnet.ibm.com>
+
+ * sysdeps/powerpc/powerpc32/power7/memcpy.S: Optimize the
+ aligned copy for power7 with vector-scalar instructions.
+
+ * sysdeps/powerpc/powerpc64/power7/memcpy.S: Optimize the
+ aligned copy for power7 with vector-scalar instructions.
+
2011-06-30 Ryan S. Arnold <rsa@linux.vnet.ibm.com>
* nptl/sysdeps/unix/sysv/linux/aio_misc.h
@@ -146,15 +132,6 @@
PTHREAD_STACK_MIN. This is too small if large amounts of TLS are in
use. Removing this call effectively sets stacksize to 'default'.
-2011-03-15 Alan Modra <amodra@gmail.com>
-
- * elf/dl-reloc.c (_dl_try_allocate_static_tls <TLS_DTV_AT_TP>): Handle
- l_tls_firstbyte_offset non-zero. Save padding offset in
- l_tls_firstbyte_offset for later use. Add debug print.
- * elf/dl-close.c (_dl_close_worker <TLS_DTV_AT_TP>): Correct code
- freeing static tls block. Add debug print.
- * elf/fl-tls.c (_dl_determine_tlsoffset): Add debug print.
-
2011-05-25 Ryan S. Arnold <rsa@us.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/dl-librecon.h
@@ -163,13 +140,28 @@
LD_AT_PLATFORM="".
(EXTRA_UNSECURE_ENVVARS): Add LD_AT_PLATFORM to the list.
-2011-02-11 Jakub Jelinek <jakub@redhat.com>
+2011-05-18 Ryan S. Arnold <rsa@us.ibm.com>
- * stdio-common/printf-parsemb.c (__parse_one_specmb): Handle
- arginfo fn returning -1.
+ * sysdeps/powerpc/powerpc64/Makefile (no-special-regs): Add -mno-vsx
+ and -mno-altivec to prevent the compiler from using Altivec and/or
+ VSX instructions when the corresponding registers are not available.
- * stdio-common/_i18n_number.h (_i18n_number_rewrite): Ensure decimal
- and thousands string is zero terminated.
+2011-03-28 Andreas Schwab <schwab@linux-m68k.org>
+
+ * sysdeps/powerpc/powerpc32/power4/strncmp.S: Don't read past
+ differing bytes.
+ * sysdeps/powerpc/powerpc64/power4/strncmp.S: Likewise.
+ * sysdeps/powerpc/powerpc32/power7/strncmp.S: Likewise.
+ * sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
+
+2011-03-15 Alan Modra <amodra@gmail.com>
+
+ * elf/dl-reloc.c (_dl_try_allocate_static_tls <TLS_DTV_AT_TP>): Handle
+ l_tls_firstbyte_offset non-zero. Save padding offset in
+ l_tls_firstbyte_offset for later use. Add debug print.
+ * elf/dl-close.c (_dl_close_worker <TLS_DTV_AT_TP>): Correct code
+ freeing static tls block. Add debug print.
+ * elf/fl-tls.c (_dl_determine_tlsoffset): Add debug print.
2011-02-16 Ryan S. Arnold <rsa@us.ibm.com>
@@ -187,6 +179,14 @@
insns in _dl_start to prevent a TOC reference before relocs are
resolved.
+2011-02-11 Jakub Jelinek <jakub@redhat.com>
+
+ * stdio-common/printf-parsemb.c (__parse_one_specmb): Handle
+ arginfo fn returning -1.
+
+ * stdio-common/_i18n_number.h (_i18n_number_rewrite): Ensure decimal
+ and thousands string is zero terminated.
+
2010-11-10 Luis Machado <luisgpm@br.ibm.com>
* sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c (__ieee754_sqrtl): Force
@@ -197,11 +197,6 @@
* sysdeps/powerpc/powerpc32/power7/mempcpy.S: New file.
* sysdeps/powerpc/powerpc64/power7/mempcpy.S: New file.
-2009-11-06 Petr Baudis <pasky@suse.cz>
-
- * include/sys/uio.h: Change __vector to __iovec to avoid clash
- with altivec.
-
2010-10-26 Ryan S. Arnold <rsa@us.ibm.com>
* config.h.in: Added HAVE_PPC64_PT_GNU_STACK which is set during a
@@ -603,4 +598,10 @@
added check. Only act on the data if no current modification
happened.
+2009-11-06 Petr Baudis <pasky@suse.cz>
+
+ * include/sys/uio.h: Change __vector to __iovec to avoid clash
+ with altivec.
+
+
See ChangeLog.17 for earlier changes.
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=eea213be41a4f37ff42bd3e905f2323091d234e0
commit eea213be41a4f37ff42bd3e905f2323091d234e0
Merge: 0a08973 81552be
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Wed Jan 11 14:37:16 2012 -0600
Merge Adhemerval Zanella's pipe2 fix into ibm/2.12/master.
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0a08973fdfd081e959b3c42f8f95d27badb46423
commit 0a08973fdfd081e959b3c42f8f95d27badb46423
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Thu Jan 5 21:36:23 2012 -0500
Fix for AIO stack size (backported from 'master' branch)
diff --git a/nptl/Versions b/nptl/Versions
index f74941f..333d4fa 100644
--- a/nptl/Versions
+++ b/nptl/Versions
@@ -254,6 +254,6 @@ libpthread {
GLIBC_PRIVATE {
__pthread_initialize_minimal;
__pthread_clock_gettime; __pthread_clock_settime;
- __pthread_unwind;
+ __pthread_unwind; __pthread_get_minstack;
}
}
diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 851bab2..628e7d7 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -408,7 +408,7 @@ __pthread_initialize_minimal_internal (void)
/* Make sure it meets the minimum size that allocate_stack
(allocatestack.c) will demand, which depends on the page size. */
- const uintptr_t pagesz = __sysconf (_SC_PAGESIZE);
+ const uintptr_t pagesz = GLRO(dl_pagesize);
const size_t minstack = pagesz + __static_tls_size + MINIMAL_REST_STACK;
if (limit.rlim_cur < minstack)
limit.rlim_cur = minstack;
@@ -450,3 +450,13 @@ __pthread_initialize_minimal_internal (void)
}
strong_alias (__pthread_initialize_minimal_internal,
__pthread_initialize_minimal)
+
+
+size_t
+__pthread_get_minstack (const pthread_attr_t *attr)
+{
+ struct pthread_attr *iattr = (struct pthread_attr *) attr;
+
+ return (GLRO(dl_pagesize) + __static_tls_size + PTHREAD_STACK_MIN
+ + iattr->guardsize);
+}
diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h
index 43ca44c..eb553a0 100644
--- a/nptl/pthreadP.h
+++ b/nptl/pthreadP.h
@@ -397,6 +397,7 @@ weak_function;
extern void __pthread_init_static_tls (struct link_map *) attribute_hidden;
+extern size_t __pthread_get_minstack (const pthread_attr_t *attr);
/* Namespace save aliases. */
extern int __pthread_getschedparam (pthread_t thread_id, int *policy,
diff --git a/nptl/sysdeps/unix/sysv/linux/aio_misc.h b/nptl/sysdeps/unix/sysv/linux/aio_misc.h
index 2bf7c17..3910b13 100644
--- a/nptl/sysdeps/unix/sysv/linux/aio_misc.h
+++ b/nptl/sysdeps/unix/sysv/linux/aio_misc.h
@@ -1,4 +1,4 @@
-/* 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.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
@@ -46,8 +46,8 @@ __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
pthread_attr_init (&attr);
pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
- /* Don't set the stacksize to PTHREAD_STACK_MIN. Let it default, otherwise
- the stack may be too small if TLS is in use. */
+ /* The helper thread needs only very little resources. */
+ (void) pthread_attr_setstacksize (&attr, __pthread_get_minstack (&attr));
/* Block all signals in the helper thread. To do this thoroughly we
temporarily have to block all signals here. */
diff --git a/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/nptl/sysdeps/unix/sysv/linux/timer_routines.c
index b159316..d75f45b 100644
--- a/nptl/sysdeps/unix/sysv/linux/timer_routines.c
+++ b/nptl/sysdeps/unix/sysv/linux/timer_routines.c
@@ -165,7 +165,7 @@ __start_helper_thread (void)
and should go away automatically when canceled. */
pthread_attr_t attr;
(void) pthread_attr_init (&attr);
- (void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
+ (void) pthread_attr_setstacksize (&attr, __pthread_get_minstack (&attr));
/* Block all signals in the helper thread but SIGSETXID. To do this
thoroughly we temporarily have to block all signals here. The
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=81552be4dfba9fc0a253a072b88cdd1062172d3e
commit 81552be4dfba9fc0a253a072b88cdd1062172d3e
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Thu Dec 29 20:42:16 2011 -0500
Add have_pipe2.
diff --git a/ChangeLog b/ChangeLog
index c70747e..203d087 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-12-28 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * include/unistd.h: Defining __have_pipe2 as external variable.
+ * io/Makefile: Added have_pipe2 object.
+ * io/have_pipe2.c: Declaring __have_pipe2 variable.
+
2011-11-16 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/Makefile: Added locale-defines.sym generation.
diff --git a/include/unistd.h b/include/unistd.h
index 0ad2983..6b7aa79 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -171,10 +171,7 @@ extern int __libc_pause (void);
extern int __pause_nocancel (void) attribute_hidden;
extern int __have_sock_cloexec;
-/* At lot of other functionality became available at the same time as
- SOCK_CLOEXEC. Avoid defining separate variables for all of them
- unless it is really necessary. */
-#define __have_pipe2 __have_sock_cloexec
+extern int __have_pipe2;
extern int __getlogin_r_loginuid (char *name, size_t namesize)
attribute_hidden;
diff --git a/io/Makefile b/io/Makefile
index caaa51b..de33202 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -54,7 +54,7 @@ routines := \
sendfile sendfile64 \
utimensat futimens
-aux := have_o_cloexec
+aux := have_o_cloexec have_pipe2
# These routines will be omitted from the libc shared object.
# Instead the static object files will be included in a special archive
diff --git a/io/have_pipe2.c b/io/have_pipe2.c
new file mode 100644
index 0000000..f08efa8
--- /dev/null
+++ b/io/have_pipe2.c
@@ -0,0 +1,24 @@
+/* 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 <unistd.h>
+#include <kernel-features.h>
+
+#ifndef __ASSUME_PIPE2
+int __have_pipe2;
+#endif
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=b20eec6a2b7056d4a1737a92574cab6d15225796
commit b20eec6a2b7056d4a1737a92574cab6d15225796
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Thu Dec 29 19:43:33 2011 -0500
PowerPC - Optimization for str[n]casecmp functions
This patch provides throughput boost for the strcasecmp function
(25% on ppc32 and 40% on ppc64) and strncasecmp (15% on both ppc32
and ppc64) for POWER7. The optimization is done by manually
(strcasecmp) or automatically (strncasecmp) unrolling the test loop
to avoid CPU stalls caused by a test followed by a load.
diff --git a/ChangeLog b/ChangeLog
index ce94df9..c70747e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2011-11-16 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * sysdeps/powerpc/Makefile: Added locale-defines.sym generation.
+ * sysdeps/powerpc/locale-defines.sym: Locale definitions for strcasecmp
+ optimized code.
+ * sysdeps/powerpc/powerpc32/power7/Makefile: New file: added unroll-loop
+ option for strncasecmp/strncasecmp_l compilation.
+ * sysdeps/powerpc/powerpc32/power7/strcasecmp.S: New file: strcasecmp
+ optimization for PPC32.
+ * sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S: New file: strcasecmp_l
+ optimization for PPC32.
+ * sysdeps/powerpc/powerpc64/power7/Makefile: Added unroll-loop option for
+ strncasecmp/strncasecmp_l compilation.
+ * sysdeps/powerpc/powerpc64/power7/strcasecmp.S: New file: strcasecmp
+ optimization for PPC64.
+ * sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S: New file: strcasecmp_l
+ optimization for PPC64.
+
2011-11-18 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* math/libm-test.inc: Added more nerabyint tests.
diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
index e43ca70..23a9a16 100644
--- a/sysdeps/powerpc/Makefile
+++ b/sysdeps/powerpc/Makefile
@@ -23,4 +23,6 @@ endif
ifeq ($(subdir),csu)
# get offset to rtld_global._dl_hwcap
gen-as-const-headers += rtld-global-offsets.sym
+# get offset to __locale_struct.__ctype_tolower
+gen-as-const-headers += locale-defines.sym
endif
diff --git a/sysdeps/powerpc/locale-defines.sym b/sysdeps/powerpc/locale-defines.sym
new file mode 100644
index 0000000..af64b92
--- /dev/null
+++ b/sysdeps/powerpc/locale-defines.sym
@@ -0,0 +1,5 @@
+#include <locale/localeinfo.h>
+
+--
+
+LOCALE_CTYPE_TOLOWER offsetof (struct __locale_struct, __ctype_tolower)
diff --git a/sysdeps/powerpc/powerpc32/power7/Makefile b/sysdeps/powerpc/powerpc32/power7/Makefile
new file mode 100644
index 0000000..5e8f4a2
--- /dev/null
+++ b/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/sysdeps/powerpc/powerpc32/power7/strcasecmp.S b/sysdeps/powerpc/powerpc32/power7/strcasecmp.S
new file mode 100644
index 0000000..5d84fce
--- /dev/null
+++ b/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/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S b/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S
new file mode 100644
index 0000000..c13c4eb
--- /dev/null
+++ b/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/sysdeps/powerpc/powerpc64/power7/Makefile b/sysdeps/powerpc/powerpc64/power7/Makefile
index b0f4520..40aacfa 100644
--- a/sysdeps/powerpc/powerpc64/power7/Makefile
+++ b/sysdeps/powerpc/powerpc64/power7/Makefile
@@ -3,3 +3,8 @@ ifeq ($(subdir),elf)
# optimization may require a TOC reference before relocations are resolved.
CFLAGS-rtld.c += -mno-vsx
endif
+
+ifeq ($(subdir),string)
+CFLAGS-strncase.c += -funroll-loops
+CFLAGS-strncase_l.c += -funroll-loops
+endif
diff --git a/sysdeps/powerpc/powerpc64/power7/strcasecmp.S b/sysdeps/powerpc/powerpc64/power7/strcasecmp.S
new file mode 100644
index 0000000..1477b2e
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/power7/strcasecmp.S
@@ -0,0 +1,125 @@
+/* Optimized strcasecmp implementation for PowerPC64.
+ 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))
+ CALL_MCOUNT 2
+
+#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 /* Word tolower(rCHAR1) */
+#define rLWR2 r12 /* Word tolower(rCHAR2) */
+#define rTMP r9
+#define rLOC r11 /* Default locale address */
+
+ cmpd cr7, r3, r4
+#ifndef USE_IN_EXTENDED_LOCALE_MODEL
+ ld rTMP, __libc_tsd_LOCALE@got@tprel(r2)
+ add rLOC, rTMP, __libc_tsd_LOCALE@tls
+ ld rLOC, 0(rLOC)
+#else
+ mr rLOC, rLOCARG
+#endif
+ ld rLOC, LOCALE_CTYPE_TOLOWER(rLOC)
+ mr rSTR1, rRTN
+ 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. */
+
+ lbz rCHAR1, 0(rSTR1) /* Load char from s1 */
+ lbz rCHAR2, 0(rSTR2) /* Load char from s2 */
+L(loop):
+ cmpdi rCHAR1, 0 /* *s1 == '\0' ? */
+ 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) */
+ cmpw cr1, rLWR1, rLWR2 /* r = tolower(*s1) == tolower(*s2) ? */
+ crorc 4*cr1+eq,eq,4*cr1+eq /* (*s1 != '\0') || (r == 1) */
+ beq cr1, L(done)
+ lbz rCHAR1, 1(rSTR1)
+ lbz rCHAR2, 1(rSTR2)
+ cmpdi rCHAR1, 0
+ sldi rADDR1, rCHAR1, 2
+ sldi rADDR2, rCHAR2, 2
+ lwzx rLWR1, rLOC, rADDR1
+ lwzx rLWR2, rLOC, rADDR2
+ cmpw cr1, rLWR1, rLWR2
+ crorc 4*cr1+eq,eq,4*cr1+eq
+ beq cr1, L(done)
+ lbz rCHAR1, 2(rSTR1)
+ lbz rCHAR2, 2(rSTR2)
+ cmpdi rCHAR1, 0
+ sldi rADDR1, rCHAR1, 2
+ sldi rADDR2, rCHAR2, 2
+ lwzx rLWR1, rLOC, rADDR1
+ lwzx rLWR2, rLOC, rADDR2
+ cmpw cr1, rLWR1, rLWR2
+ crorc 4*cr1+eq,eq,4*cr1+eq
+ beq cr1, L(done)
+ lbz rCHAR1, 3(rSTR1)
+ lbz rCHAR2, 3(rSTR2)
+ cmpdi rCHAR1, 0
+ /* 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
+ cmpw cr1, rLWR1, rLWR2
+ crorc 4*cr1+eq,eq,4*cr1+eq
+ beq cr1,L(done)
+ lbz rCHAR1, 0(rSTR1) /* Load char from s1 */
+ lbz rCHAR2, 0(rSTR2) /* Load char from s2 */
+ b L(loop)
+L(done):
+ subf r0, rLWR2, rLWR1
+ extsw rRTN, r0
+ blr
+END (BP_SYM (__STRCMP))
+
+weak_alias (BP_SYM (__STRCMP), BP_SYM (STRCMP))
+libc_hidden_builtin_def (__STRCMP)
diff --git a/sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S b/sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S
new file mode 100644
index 0000000..c13c4eb
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/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"
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a960be3fad233bd721f64dfe62d3f0ee798d26e3
commit a960be3fad233bd721f64dfe62d3f0ee798d26e3
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Thu Dec 29 19:41:37 2011 -0500
PowerPC - Optimization for nearbyint[f]
This patch provides throughput boost for the nearbyint[f] functions
for POWER. For POWER7, it improves performance for nearbyintf from
5 (ppc32) to 6 times (ppc64) and for nearbyint from 2.5 up to 5
times. For POWER6 it improves nearbyintf up to 2x (ppc64) and
nearbyint up to 4x.
diff --git a/ChangeLog b/ChangeLog
index a4b9cb0..ce94df9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-11-18 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * math/libm-test.inc: Added more nerabyint tests.
+ * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: New file: nearbyint
+ optimized for PPC32.
+ * sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: New file: nearbyintf
+ optimized for PPC32.
+ * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: New file: nearbyint
+ optimized for PPC64.
+ * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: New file: nearbyintf
+ optimized for PPC64.
+
2011-10-22 Andreas Schwab <schwab@linux-m68k.org>
* sysdeps/ieee754/ldbl-128ibm/s_atanl.c: Include <math.h> before
diff --git a/math/libm-test.inc b/math/libm-test.inc
index c6ed7a3..54dbdf1 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -4607,6 +4607,10 @@ nearbyint_test (void)
TEST_f_f (nearbyint, minus_infty, minus_infty);
TEST_f_f (nearbyint, nan_value, nan_value);
+ /* Subnormal values */
+ TEST_f_f (nearbyint, -8.98847e+307, -8.98847e+307);
+ TEST_f_f (nearbyint, -4.45015e-308, minus_zero);
+
/* Default rounding mode is round to nearest. */
TEST_f_f (nearbyint, 0.5, 0.0);
TEST_f_f (nearbyint, 1.5, 2.0);
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S b/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S
new file mode 100644
index 0000000..0102aa3
--- /dev/null
+++ b/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/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S b/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S
new file mode 100644
index 0000000..5190228
--- /dev/null
+++ b/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/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S b/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
new file mode 100644
index 0000000..436160f
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
@@ -0,0 +1,68 @@
+/* Round to int floating-point values. PowerPC64 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., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 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 ".toc","aw"
+.LC0: /* 2**52 */
+ .tc FD_43300000_0[TC],0x4330000000000000
+ .section ".text"
+
+EALIGN (__nearbyint, 4, 0)
+ CALL_MCOUNT 0
+ fabs fp0,fp1
+ lfd fp13,.LC0@toc(2)
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
+ bgelr cr7
+ fsub fp12,fp13,fp13 /* generate 0.0 */
+ fcmpu cr7,fp1,fp12 /* if (x > 0.0) */
+ ble cr7, L(lessthanzero)
+ mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
+ fadd fp1,fp1,fp13 /* x+= TWO52 */
+ fsub fp1,fp1,fp13 /* x-= TWO52 */
+ fabs fp1,fp1 /* if (x == 0.0) */
+ mtfsb0 4*cr1+eq /* Clear any FE_INEXACT exception */
+ blr /* x = 0.0; */
+L(lessthanzero):
+ bgelr cr7 /* if (x < 0.0) */
+ mtfsb0 4*cr7+lt
+ fsub fp1,fp1,fp13 /* x -= TWO52 */
+ fadd fp1,fp1,fp13 /* x += TWO52 */
+ fnabs fp1,fp1 /* if (x == 0.0) */
+ mtfsb0 4*cr1+eq
+ blr /* x = -0.0; */
+END (__nearbyint)
+
+weak_alias (__nearbyint, nearbyint)
+
+#ifdef NO_LONG_DOUBLE
+weak_alias (__nearbyint, nearbyint)
+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/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S b/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
new file mode 100644
index 0000000..c337e79
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
@@ -0,0 +1,59 @@
+/* Round to int floating-point values. PowerPC64 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., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 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]) */
+
+ .section ".toc","aw"
+.LC0: /* 2**23 */
+ .tc FD_4b000000_0[TC],0x4b00000000000000
+ .section ".text"
+
+EALIGN (__nearbyintf, 4, 0)
+ CALL_MCOUNT 0
+ fabs fp0,fp1
+ lfs fp13,.LC0@toc(2)
+ fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
+ bgelr cr7
+ fsubs fp12,fp13,fp13 /* generate 0.0 */
+ fcmpu cr7,fp1,fp12 /* if (x > 0.0) */
+ ble cr7, L(lessthanzero)
+ mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
+ fadds fp1,fp1,fp13 /* x += TWO23 */
+ fsubs fp1,fp1,fp13 /* x -= TWO23 */
+ fabs fp1,fp1 /* if (x == 0.0) */
+ mtfsb0 4*cr1+eq /* Clear pending FE_INEXACT exception */
+ blr /* x = 0.0; */
+L(lessthanzero):
+ bgelr cr7 /* if (x < 0.0) */
+ mtfsb0 4*cr7+lt /* Disable FE_INEXACT exception */
+ fsubs fp1,fp1,fp13 /* x -= TWO23 */
+ fadds fp1,fp1,fp13 /* x += TWO23 */
+ fnabs fp1,fp1 /* if (x == 0.0) */
+ mtfsb0 4*cr1+eq /* Clear pending FE_INEXACT exception */
+ blr /* x = -0.0; */
+END (__nearbyintf)
+
+weak_alias (__nearbyintf, nearbyintf)
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e73988fd47a8ab815e4a4427683ac1098c8ff31f
commit e73988fd47a8ab815e4a4427683ac1098c8ff31f
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Thu Dec 29 19:39:22 2011 -0500
Fix compilation due to __nan defines
Backport of commit #ee2aafe08e68c88412b7dcfa4b1e0d11789348f8
diff --git a/ChangeLog b/ChangeLog
index ae5f924..a4b9cb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-10-22 Andreas Schwab <schwab@linux-m68k.org>
+
+ * sysdeps/ieee754/ldbl-128ibm/s_atanl.c: Include <math.h> before
+ "math_private.h".
+
2011-12-06 Andreas Schwab <schwab@linux-m68k.org>
[BZ #13472]
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
index b6195f1..8c8c6d7 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
@@ -58,7 +58,7 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
+#include <math.h>
#include "math_private.h"
#include <math_ldbl_opt.h>
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=be802bc67041210b441ecdd9ebdd33e4e8c177cc
commit be802bc67041210b441ecdd9ebdd33e4e8c177cc
Author: Andreas Schwab <schwab@redhat.com>
Date: Thu Dec 29 19:38:42 2011 -0500
Fix a wrong constant in powerpc hypot implementation
Backport of commit #850fb039cec802072f70ed9763927881bbbf639c
diff --git a/ChangeLog b/ChangeLog
index e7bb0fc..ae5f924 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-12-06 Andreas Schwab <schwab@linux-m68k.org>
+
+ [BZ #13472]
+ * sysdeps/powerpc/fpu/e_hypot.c (twoM600): Correct value.
+
2011-11-07 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/fpu/math_private.h: Using inline assembly version
diff --git a/sysdeps/powerpc/fpu/e_hypot.c b/sysdeps/powerpc/fpu/e_hypot.c
index a8d67d8..3731c58 100644
--- a/sysdeps/powerpc/fpu/e_hypot.c
+++ b/sysdeps/powerpc/fpu/e_hypot.c
@@ -26,7 +26,7 @@ static const double two500 = 3.2733906078961419e+150;
static const double two600 = 4.149515568880993e+180;
static const double two1022 = 4.49423283715579e+307;
static const double twoM500 = 3.054936363499605e-151;
-static const double twoM600 = 4.616489308892868e-128;
+static const double twoM600 = 2.4099198651028841e-181;
static const double pdnum = 2.225073858507201e-308;
/* __ieee754_hypot(x,y)
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=994f2519e9c8ad7fd368aa97ff5d219ac0597de9
commit 994f2519e9c8ad7fd368aa97ff5d219ac0597de9
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Thu Dec 29 19:37:51 2011 -0500
PowerPC: Arithmetic function optimizations for POWER
This patch creates inline assembly functions that use intrinsic PPC
floating point instructions when the platform supports them but rely on
the internal GLIBC functions when the instructions are not implemented
(for instance, on POWER4).
diff --git a/ChangeLog b/ChangeLog
index 91397b5..e7bb0fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-11-07 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * sysdeps/powerpc/fpu/math_private.h: Using inline assembly version
+ of math functions ceil, trunc, floor, round, and sqrt, when
+ avaliable on the platform.
+ * sysdeps/powerpc/fpu/e_sqrt.c: Undefine __ieee754_sqrt to avoid
+ name clash.
+ * sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/e_sqrt.c: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c: Likewise.
+
2011-10-12 Ulrich Drepper <drepper@gmail.com>
Add integration with gcc's -ffinite-math-only and optimize wrapper
diff --git a/sysdeps/powerpc/fpu/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c
index f9ded25..d59bd08 100644
--- a/sysdeps/powerpc/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/fpu/e_sqrt.c
@@ -154,6 +154,7 @@ __slow_ieee754_sqrt (double x)
return f_wash (x);
}
+#undef __ieee754_sqrt
double
__ieee754_sqrt (double x)
{
diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c
index 965faee..9c6b860 100644
--- a/sysdeps/powerpc/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/fpu/e_sqrtf.c
@@ -130,7 +130,7 @@ __slow_ieee754_sqrtf (float x)
return f_washf (x);
}
-
+#undef __ieee754_sqrtf
float
__ieee754_sqrtf (float x)
{
diff --git a/sysdeps/powerpc/fpu/math_private.h b/sysdeps/powerpc/fpu/math_private.h
index 90021c6..c4dd217 100644
--- a/sysdeps/powerpc/fpu/math_private.h
+++ b/sysdeps/powerpc/fpu/math_private.h
@@ -1,5 +1,5 @@
/* Private inline math functions for powerpc.
- Copyright (C) 2006
+ Copyright (C) 2006, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -25,12 +25,145 @@
#include <ldsodefs.h>
#include <dl-procinfo.h>
+#include <math/math_private.h>
+
# if __WORDSIZE == 64 || defined _ARCH_PWR4
# define __CPU_HAS_FSQRT 1
+
+#ifndef __ieee754_sqrt
+# define __ieee754_sqrt(x) \
+ ({ double __z; \
+ __asm __volatile ( \
+ " fsqrt %0,%1\n" \
+ : "=f" (__z) \
+ : "f"(x)); \
+ __z; })
+#endif
+#ifndef __ieee754_sqrtf
+# define __ieee754_sqrtf(x) \
+ ({ float __z; \
+ __asm __volatile ( \
+ " fsqrts %0,%1\n" \
+ : "=f" (__z) \
+ : "f"(x)); \
+ __z; })
+#endif
+
# else
# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
+# endif // __WORDSIZE == 64 || defined _ARCH_PWR4
+
+
+#if defined _ARCH_PWR5X
+
+# ifndef __round
+# define __round(x) \
+ ({ double __z; \
+ __asm __volatile ( \
+ " frin %0,%1\n" \
+ : "=f" (__z) \
+ : "f" (x)); \
+ __z; })
+# endif
+# ifndef __roundf
+# define __roundf(x) \
+ ({ float __z; \
+ __asm __volatile ( \
+ " frin %0,%1\n" \
+ " frsp %0,%0\n" \
+ : "=f" (__z) \
+ : "f" (x)); \
+ __z; })
+# endif
+
+# ifndef __trunc
+# define __trunc(x) \
+ ({ double __z; \
+ __asm __volatile ( \
+ " friz %0,%1\n" \
+ : "=f" (__z) \
+ : "f" (x)); \
+ __z; })
+# endif
+# ifndef __truncf
+# define __truncf(x) \
+ ({ float __z; \
+ __asm __volatile ( \
+ " friz %0,%1\n" \
+ " frsp %0,%0\n" \
+ : "=f" (__z) \
+ : "f" (x)); \
+ __z; })
+# endif
+
+# ifndef __ceil
+# define __ceil(x) \
+ ({ double __z; \
+ __asm __volatile ( \
+ " frip %0,%1\n" \
+ : "=f" (__z) \
+ : "f" (x)); \
+ __z; })
+# endif
+# ifndef __ceilf
+# define __ceilf(x) \
+ ({ float __z; \
+ __asm __volatile ( \
+ " frip %0,%1\n" \
+ " frsp %0,%0\n" \
+ : "=f" (__z) \
+ : "f" (x)); \
+ __z; })
# endif
+# ifndef __floor
+# define __floor(x) \
+ ({ double __z; \
+ __asm __volatile ( \
+ " frim %0,%1\n" \
+ : "=f" (__z) \
+ : "f" (x)); \
+ __z; })
+# endif
+# ifndef __floorf
+# define __floorf(x) \
+ ({ float __z; \
+ __asm __volatile ( \
+ " frim %0,%1\n" \
+ " frsp %0,%0\n" \
+ : "=f" (__z) \
+ : "f" (x)); \
+ __z; })
+# endif
+
+#endif /* defined _ARCH_PWR5X */
+
+
+#if defined _ARCH_PWR6
+
+# ifndef __copysign
+# define __copysign(x, y) \
+ ({ double __z; \
+ __asm __volatile ( \
+ " fcpsgn %0,%1,%2\n" \
+ : "=f" (__z) \
+ : "f" (y), "f" (x)); \
+ __z; })
+# endif
+# ifndef __copysignf
+# define __copysignf(x, y) \
+ ({ float __z; \
+ __asm __volatile ( \
+ " fcpsgn %0,%1,%2\n" \
+ " frsp %0,%0\n" \
+ : "=f" (__z) \
+ : "f" (y), "f" (x)); \
+ __z; })
+# endif
+
+#endif /* defined _ARCH_PWR6 */
+
+
# ifndef __LIBC_INTERNAL_MATH_INLINES
extern double __slow_ieee754_sqrt (double);
__inline double
@@ -78,6 +211,4 @@ __ieee754_sqrtf (float __x)
}
#endif /* __LIBC_INTERNAL_MATH_INLINES */
-#include <math/math_private.h>
-
#endif /* _PPC_MATH_PRIVATE_H_ */
diff --git a/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
index 314abba..66d04ce 100644
--- a/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
@@ -20,6 +20,7 @@
#include <math.h>
#include <math_private.h>
+#undef __ieee754_sqrt
double
__ieee754_sqrt (double x)
{
diff --git a/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
index 7157214..847a2e4 100644
--- a/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
@@ -20,6 +20,7 @@
#include <math.h>
#include <math_private.h>
+#undef __ieee754_sqrtf
float
__ieee754_sqrtf (float x)
{
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=69573077ca04c05fb12e177747711d7ef197a9c8
commit 69573077ca04c05fb12e177747711d7ef197a9c8
Author: Ulrich Drepper <drepper@gmail.com>
Date: Thu Dec 29 19:37:22 2011 -0500
Optimize libm
libm is now somewhat integrated with gcc's -ffinite-math-only option
and lots of the wrapper functions have been optimized.
Backport of commit #0ac5ae2335292908f39031b1ea9fe8edce433c0f
diff --git a/ChangeLog b/ChangeLog
index 64557bd..91397b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-10-12 Ulrich Drepper <drepper@gmail.com>
+
+ Add integration with gcc's -ffinite-math-only and optimize wrapper
+ functions in libm.
+ * sysdeps/powerpc/fpu/e_hypot.c: Add __*_finite alias.
+ * sysdeps/powerpc/fpu/e_hypotf.c: Likewise.
+ * sysdeps/powerpc/fpu/e_sqrt.c: Likewise.
+ * sysdeps/powerpc/fpu/e_sqrtf.c: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/e_sqrt.c: Likewise.
+ * sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c: Likewise.
+ * sysdeps/ieee754/dbl-64/halfulp.c: Likewise.
+
2011-09-15 Andreas Schwab <schwab@redhat.com>
* sysdeps/powerpc/fpu/e_hypot.c (__ieee754_hypot): Use
diff --git a/sysdeps/ieee754/dbl-64/halfulp.c b/sysdeps/ieee754/dbl-64/halfulp.c
index 478a4ba..42b21fb 100644
--- a/sysdeps/ieee754/dbl-64/halfulp.c
+++ b/sysdeps/ieee754/dbl-64/halfulp.c
@@ -1,7 +1,7 @@
/*
* IBM Accurate Mathematical Library
* written by International Business Machines Corp.
- * Copyright (C) 2001, 2005 Free Software Foundation
+ * Copyright (C) 2001, 2005, 2011 Free Software Foundation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
@@ -40,13 +40,11 @@
#include "dla.h"
#include "math_private.h"
-double __ieee754_sqrt(double x);
-
static const int4 tab54[32] = {
262143, 11585, 1782, 511, 210, 107, 63, 42,
30, 22, 17, 14, 12, 10, 9, 7,
- 7, 6, 5, 5, 5, 4, 4, 4,
- 3, 3, 3, 3, 3, 3, 3, 3 };
+ 7, 6, 5, 5, 5, 4, 4, 4,
+ 3, 3, 3, 3, 3, 3, 3, 3 };
double __halfulp(double x, double y)
@@ -64,12 +62,12 @@ double __halfulp(double x, double y)
z = (double) k;
return (z*y == -1075.0)?0: -10.0;
}
- /* if y > 0 */
+ /* if y > 0 */
v.x = y;
if (v.i[LOW_HALF] != 0) return -10.0;
v.x=x;
- /* case where x = 2**n for some integer n */
+ /* case where x = 2**n for some integer n */
if (((v.i[HIGH_HALF]&0x000fffff)|v.i[LOW_HALF]) == 0) {
k=(v.i[HIGH_HALF]>>20)-1023;
return (((double) k)*y == -1075.0)?0:-10.0;
@@ -90,7 +88,7 @@ double __halfulp(double x, double y)
k = -k;
if (k>5) return -10.0;
- /* now treat x */
+ /* now treat x */
while (k>0) {
z = __ieee754_sqrt(x);
EMULV(z,z,u,uu,j1,j2,j3,j4,j5);
@@ -111,11 +109,11 @@ double __halfulp(double x, double y)
m = (k&0x000fffff)|0x00100000;
m = m>>(20-l); /* m is the odd integer of x */
- /* now check whether the length of m**n is at most 54 bits */
+ /* now check whether the length of m**n is at most 54 bits */
if (m > tab54[n-3]) return -10.0;
- /* yes, it is - now compute x**n by simple multiplications */
+ /* yes, it is - now compute x**n by simple multiplications */
u = x;
for (k=1;k<n;k++) u = u*x;
diff --git a/sysdeps/powerpc/fpu/e_hypot.c b/sysdeps/powerpc/fpu/e_hypot.c
index afbcc18..a8d67d8 100644
--- a/sysdeps/powerpc/fpu/e_hypot.c
+++ b/sysdeps/powerpc/fpu/e_hypot.c
@@ -115,3 +115,4 @@ __ieee754_hypot (double x, double y)
}
return __ieee754_sqrt (x * x + y * y);
}
+strong_alias (__ieee754_hypot, __hypot_finite)
diff --git a/sysdeps/powerpc/fpu/e_hypotf.c b/sysdeps/powerpc/fpu/e_hypotf.c
index 02ad773..915738c 100644
--- a/sysdeps/powerpc/fpu/e_hypotf.c
+++ b/sysdeps/powerpc/fpu/e_hypotf.c
@@ -116,3 +116,4 @@ __ieee754_hypotf (float x, float y)
}
return __ieee754_sqrtf (x * x + y * y);
}
+strong_alias (__ieee754_hypotf, __hypotf_finite)
diff --git a/sysdeps/powerpc/fpu/e_sqrt.c b/sysdeps/powerpc/fpu/e_sqrt.c
index e95b786..f9ded25 100644
--- a/sysdeps/powerpc/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/fpu/e_sqrt.c
@@ -1,5 +1,5 @@
/* Double-precision floating point square root.
- Copyright (C) 1997, 2002, 2003, 2004, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2002-2004, 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
@@ -46,21 +46,15 @@ extern const float __t_sqrt[1024];
generated guesses (which mostly runs on the integer unit, while the
Newton-Raphson is running on the FPU). */
-#ifdef __STDC__
double
__slow_ieee754_sqrt (double x)
-#else
-double
-__slow_ieee754_sqrt (x)
- double x;
-#endif
{
const float inf = a_inf.value;
if (x > 0)
{
/* schedule the EXTRACT_WORDS to get separation between the store
- and the load. */
+ and the load. */
ieee_double_shape_type ew_u;
ieee_double_shape_type iw_u;
ew_u.value = (x);
@@ -147,7 +141,7 @@ __slow_ieee754_sqrt (x)
else if (x < 0)
{
/* For some reason, some PowerPC32 processors don't implement
- FE_INVALID_SQRT. */
+ FE_INVALID_SQRT. */
#ifdef FE_INVALID_SQRT
feraiseexcept (FE_INVALID_SQRT);
@@ -160,14 +154,8 @@ __slow_ieee754_sqrt (x)
return f_wash (x);
}
-#ifdef __STDC__
double
__ieee754_sqrt (double x)
-#else
-double
-__ieee754_sqrt (x)
- double x;
-#endif
{
double z;
@@ -175,7 +163,7 @@ __ieee754_sqrt (x)
if (__CPU_HAS_FSQRT)
{
/* Volatile is required to prevent the compiler from moving the
- fsqrt instruction above the branch. */
+ fsqrt instruction above the branch. */
__asm __volatile (" fsqrt %0,%1\n"
:"=f" (z):"f" (x));
}
@@ -184,3 +172,4 @@ __ieee754_sqrt (x)
return z;
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/powerpc/fpu/e_sqrtf.c b/sysdeps/powerpc/fpu/e_sqrtf.c
index ca44fac..965faee 100644
--- a/sysdeps/powerpc/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/fpu/e_sqrtf.c
@@ -1,5 +1,5 @@
/* Single-precision floating point square root.
- Copyright (C) 1997, 2003, 2004, 2008 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2003, 2004, 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
@@ -46,14 +46,8 @@ extern const float __t_sqrt[1024];
generated guesses (which mostly runs on the integer unit, while the
Newton-Raphson is running on the FPU). */
-#ifdef __STDC__
float
__slow_ieee754_sqrtf (float x)
-#else
-float
-__slow_ieee754_sqrtf (x)
- float x;
-#endif
{
const float inf = a_inf.value;
@@ -123,7 +117,7 @@ __slow_ieee754_sqrtf (x)
else if (x < 0)
{
/* For some reason, some PowerPC32 processors don't implement
- FE_INVALID_SQRT. */
+ FE_INVALID_SQRT. */
#ifdef FE_INVALID_SQRT
feraiseexcept (FE_INVALID_SQRT);
@@ -137,14 +131,8 @@ __slow_ieee754_sqrtf (x)
}
-#ifdef __STDC__
float
__ieee754_sqrtf (float x)
-#else
-float
-__ieee754_sqrtf (x)
- float x;
-#endif
{
double z;
@@ -152,7 +140,7 @@ __ieee754_sqrtf (x)
if (__CPU_HAS_FSQRT)
{
/* Volatile is required to prevent the compiler from moving the
- fsqrt instruction above the branch. */
+ fsqrt instruction above the branch. */
__asm __volatile (" fsqrts %0,%1\n"
:"=f" (z):"f" (x));
}
@@ -161,3 +149,4 @@ __ieee754_sqrtf (x)
return z;
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c b/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
index 0a229cb..314abba 100644
--- a/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
+++ b/sysdeps/powerpc/powerpc64/fpu/e_sqrt.c
@@ -1,5 +1,5 @@
/* Double-precision floating point square root.
- Copyright (C) 1997, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2002-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
@@ -27,3 +27,4 @@ __ieee754_sqrt (double x)
__asm __volatile ("fsqrt %0,%1" : "=f" (z) : "f" (x));
return z;
}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c b/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
index 0f17a64..7157214 100644
--- a/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
+++ b/sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c
@@ -1,5 +1,5 @@
/* Single-precision floating point square root.
- Copyright (C) 1997, 2003, 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2003, 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
@@ -27,3 +27,4 @@ __ieee754_sqrtf (float x)
__asm ("fsqrts %0,%1" : "=f" (z) : "f" (x));
return z;
}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=bb365f5895571160988214f760734129a7f3bf5d
commit bb365f5895571160988214f760734129a7f3bf5d
Author: Andreas Schwab <schwab@redhat.com>
Date: Thu Dec 29 19:36:37 2011 -0500
Fix PLT uses in libm on powerpc
Backport of commit #edc121be8b53da57950daf6f42a619b5826f30b6
diff --git a/ChangeLog b/ChangeLog
index 5119976..64557bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-09-15 Andreas Schwab <schwab@redhat.com>
+
+ * sysdeps/powerpc/fpu/e_hypot.c (__ieee754_hypot): Use
+ __ieee754_sqrt instead of sqrt.
+ * sysdeps/powerpc/fpu/e_hypotf.c (__ieee754_hypotf): Use
+ __ieee754_sqrtf instead of sqrtf.
+ * sysdeps/powerpc/fpu/e_rem_pio2f.c (__ieee754_rem_pio2f): Use
+ __floorf instead of floorf.
+ * sysdeps/powerpc/fpu/k_rem_pio2f.c (__fp_kernel_rem_pio2f): Use
+ __floorf, __truncf instead of floorf, truncf.
+
2011-03-28 Andreas Schwab <schwab@linux-m68k.org>
* sysdeps/powerpc/powerpc32/power4/strncmp.S: Don't read past
diff --git a/sysdeps/powerpc/fpu/e_hypot.c b/sysdeps/powerpc/fpu/e_hypot.c
index f5300ef..afbcc18 100644
--- a/sysdeps/powerpc/fpu/e_hypot.c
+++ b/sysdeps/powerpc/fpu/e_hypot.c
@@ -96,22 +96,22 @@ __ieee754_hypot (double x, double y)
{
x *= twoM600;
y *= twoM600;
- return sqrt (x * x + y * y) / twoM600;
+ return __ieee754_sqrt (x * x + y * y) / twoM600;
}
if (y < twoM500)
{
if (y <= pdnum)
- {
- x *= two1022;
- y *= two1022;
- return sqrt (x * x + y * y) / two1022;
- }
+ {
+ x *= two1022;
+ y *= two1022;
+ return __ieee754_sqrt (x * x + y * y) / two1022;
+ }
else
- {
- x *= two600;
- y *= two600;
- return sqrt (x * x + y * y) / two600;
- }
+ {
+ x *= two600;
+ y *= two600;
+ return __ieee754_sqrt (x * x + y * y) / two600;
+ }
}
- return sqrt (x * x + y * y);
+ return __ieee754_sqrt (x * x + y * y);
}
diff --git a/sysdeps/powerpc/fpu/e_hypotf.c b/sysdeps/powerpc/fpu/e_hypotf.c
index 0476498..02ad773 100644
--- a/sysdeps/powerpc/fpu/e_hypotf.c
+++ b/sysdeps/powerpc/fpu/e_hypotf.c
@@ -97,22 +97,22 @@ __ieee754_hypotf (float x, float y)
{
x *= twoM60;
y *= twoM60;
- return sqrtf (x * x + y * y) / twoM60;
+ return __ieee754_sqrtf (x * x + y * y) / twoM60;
}
if (y < twoM50)
{
if (y <= pdnum)
- {
- x *= two126;
- y *= two126;
- return sqrtf (x * x + y * y) / two126;
- }
+ {
+ x *= two126;
+ y *= two126;
+ return __ieee754_sqrtf (x * x + y * y) / two126;
+ }
else
- {
- x *= two60;
- y *= two60;
- return sqrtf (x * x + y * y) / two60;
- }
+ {
+ x *= two60;
+ y *= two60;
+ return __ieee754_sqrtf (x * x + y * y) / two60;
+ }
}
- return sqrtf (x * x + y * y);
+ return __ieee754_sqrtf (x * x + y * y);
}
diff --git a/sysdeps/powerpc/fpu/e_rem_pio2f.c b/sysdeps/powerpc/fpu/e_rem_pio2f.c
index 24ac936..e4427e4 100644
--- a/sysdeps/powerpc/fpu/e_rem_pio2f.c
+++ b/sysdeps/powerpc/fpu/e_rem_pio2f.c
@@ -78,83 +78,83 @@ __ieee754_rem_pio2f (float x, float *y)
if (ax < pio3_4)
{
if (x > 0)
- {
- z = x - pio2_1;
- if (!__float_and_test28 (ax, pio2_24b))
- {
- y[0] = z - pio2_1t;
- y[1] = (z - y[0]) - pio2_1t;
- }
- else
- {
- z -= pio2_2;
- y[0] = z - pio2_2t;
- y[1] = (z - y[0]) - pio2_2t;
- }
- return 1;
- }
+ {
+ z = x - pio2_1;
+ if (!__float_and_test28 (ax, pio2_24b))
+ {
+ y[0] = z - pio2_1t;
+ y[1] = (z - y[0]) - pio2_1t;
+ }
+ else
+ {
+ z -= pio2_2;
+ y[0] = z - pio2_2t;
+ y[1] = (z - y[0]) - pio2_2t;
+ }
+ return 1;
+ }
else
- {
- z = x + pio2_1;
- if (!__float_and_test28 (ax, pio2_24b))
- {
- y[0] = z + pio2_1t;
- y[1] = (z - y[0]) + pio2_1t;
- }
- else
- {
- z += pio2_2;
- y[0] = z + pio2_2t;
- y[1] = (z - y[0]) + pio2_2t;
- }
- return -1;
- }
+ {
+ z = x + pio2_1;
+ if (!__float_and_test28 (ax, pio2_24b))
+ {
+ y[0] = z + pio2_1t;
+ y[1] = (z - y[0]) + pio2_1t;
+ }
+ else
+ {
+ z += pio2_2;
+ y[0] = z + pio2_2t;
+ y[1] = (z - y[0]) + pio2_2t;
+ }
+ return -1;
+ }
}
if (ax <= pio2_2e7)
{
- n = floorf (ax * invpio2 + half);
+ n = __floorf (ax * invpio2 + half);
i = (int32_t) n;
r = ax - n * pio2_1;
- w = n * pio2_1t; /* 1st round good to 40 bit */
+ w = n * pio2_1t; /* 1st round good to 40 bit */
if (i < 32 && !__float_and_test24 (ax, npio2_hw[i - 1]))
- {
- y[0] = r - w;
- }
+ {
+ y[0] = r - w;
+ }
else
- {
- float i, j;
- j = __float_and8 (ax);
- y[0] = r - w;
- i = __float_and8 (y[0]);
- if (j / i > 256.0 || j / i < 3.9062500e-3)
- { /* 2nd iterations needed, good to 57 */
- t = r;
- w = n * pio2_2;
- r = t - w;
- w = n * pio2_2t - ((t - r) - w);
- y[0] = r - w;
- i = __float_and8 (y[0]);
- if (j / i > 33554432 || j / i < 2.9802322e-8)
- { /* 3rd iteration needed, 74 bits acc */
- t = r;
- w = n * pio2_3;
- r = t - w;
- w = n * pio2_3t - ((t - r) - w);
- y[0] = r - w;
- }
- }
- }
+ {
+ float i, j;
+ j = __float_and8 (ax);
+ y[0] = r - w;
+ i = __float_and8 (y[0]);
+ if (j / i > 256.0 || j / i < 3.9062500e-3)
+ { /* 2nd iterations needed, good to 57 */
+ t = r;
+ w = n * pio2_2;
+ r = t - w;
+ w = n * pio2_2t - ((t - r) - w);
+ y[0] = r - w;
+ i = __float_and8 (y[0]);
+ if (j / i > 33554432 || j / i < 2.9802322e-8)
+ { /* 3rd iteration needed, 74 bits acc */
+ t = r;
+ w = n * pio2_3;
+ r = t - w;
+ w = n * pio2_3t - ((t - r) - w);
+ y[0] = r - w;
+ }
+ }
+ }
y[1] = (r - y[0]) - w;
if (x < 0)
- {
- y[0] = -y[0];
- y[1] = -y[1];
- return -i;
- }
+ {
+ y[0] = -y[0];
+ y[1] = -y[1];
+ return -i;
+ }
else
- {
- return i;
- }
+ {
+ return i;
+ }
}
/* all other (large) arguments */
@@ -168,11 +168,11 @@ __ieee754_rem_pio2f (float x, float *y)
e0 = __float_and8 (ax / 128.0);
z = ax / e0;
- tx[0] = floorf (z);
+ tx[0] = __floorf (z);
z = (z - tx[0]) * two8;
- tx[1] = floorf (z);
+ tx[1] = __floorf (z);
z = (z - tx[1]) * two8;
- tx[2] = floorf (z);
+ tx[2] = __floorf (z);
nx = 3;
while (tx[nx - 1] == zero)
diff --git a/sysdeps/powerpc/fpu/k_rem_pio2f.c b/sysdeps/powerpc/fpu/k_rem_pio2f.c
index a94ca13..7090605 100644
--- a/sysdeps/powerpc/fpu/k_rem_pio2f.c
+++ b/sysdeps/powerpc/fpu/k_rem_pio2f.c
@@ -79,17 +79,17 @@ static const float two_over_pi[] = {
static const float PIo2[] = {
- 1.5703125000e+00, /* 0x3fc90000 */
- 4.5776367188e-04, /* 0x39f00000 */
- 2.5987625122e-05, /* 0x37da0000 */
- 7.5437128544e-08, /* 0x33a20000 */
- 6.0026650317e-11, /* 0x2e840000 */
- 7.3896444519e-13, /* 0x2b500000 */
- 5.3845816694e-15, /* 0x27c20000 */
- 5.6378512969e-18, /* 0x22d00000 */
- 8.3009228831e-20, /* 0x1fc40000 */
- 3.2756352257e-22, /* 0x1bc60000 */
- 6.3331015649e-25, /* 0x17440000 */
+ 1.5703125000e+00, /* 0x3fc90000 */
+ 4.5776367188e-04, /* 0x39f00000 */
+ 2.5987625122e-05, /* 0x37da0000 */
+ 7.5437128544e-08, /* 0x33a20000 */
+ 6.0026650317e-11, /* 0x2e840000 */
+ 7.3896444519e-13, /* 0x2b500000 */
+ 5.3845816694e-15, /* 0x27c20000 */
+ 5.6378512969e-18, /* 0x22d00000 */
+ 8.3009228831e-20, /* 0x1fc40000 */
+ 3.2756352257e-22, /* 0x1bc60000 */
+ 6.3331015649e-25, /* 0x17440000 */
};
@@ -126,7 +126,7 @@ __fp_kernel_rem_pio2f (float *x, float *y, float e0, int32_t nx)
for (i = 0; i <= jk; i++)
{
for (j = 0, fw = 0.0; j <= jx; j++)
- fw += x[j] * f[jx + i - j];
+ fw += x[j] * f[jx + i - j];
q[i] = fw;
}
@@ -135,19 +135,19 @@ recompute:
/* distill q[] into iq[] reversingly */
for (i = 0, j = jz, z = q[jz]; j > 0; i++, j--)
{
- fw = truncf (twon8 * z);
+ fw = __truncf (twon8 * z);
iq[i] = (int32_t) (z - two8 * fw);
z = q[j - 1] + fw;
}
/* compute n */
- z = __scalbnf (z, q0); /* actual value of z */
- z -= 8.0 * floorf (z * 0.125); /* trim off integer >= 8 */
+ z = __scalbnf (z, q0); /* actual value of z */
+ z -= 8.0 * __floorf (z * 0.125); /* trim off integer >= 8 */
n = (int32_t) z;
- z -= truncf (z);
+ z -= __truncf (z);
ih = 0;
if (q0 > 0)
- { /* need iq[jz-1] to determine n */
+ { /* need iq[jz-1] to determine n */
i = (iq[jz - 1] >> (8 - q0));
n += i;
iq[jz - 1] -= i << (8 - q0);
@@ -159,41 +159,41 @@ recompute:
ih = 2;
if (ih > 0)
- { /* q > 0.5 */
+ { /* q > 0.5 */
n += 1;
carry = 0;
for (i = 0; i < jz; i++)
- { /* compute 1-q */
- j = iq[i];
- if (carry == 0)
- {
- if (j != 0)
- {
- carry = 1;
- iq[i] = 0x100 - j;
- }
- }
- else
- iq[i] = 0xff - j;
- }
+ { /* compute 1-q */
+ j = iq[i];
+ if (carry == 0)
+ {
+ if (j != 0)
+ {
+ carry = 1;
+ iq[i] = 0x100 - j;
+ }
+ }
+ else
+ iq[i] = 0xff - j;
+ }
if (q0 > 0)
- { /* rare case: chance is 1 in 12 */
- switch (q0)
- {
- case 1:
- iq[jz - 1] &= 0x7f;
- break;
- case 2:
- iq[jz - 1] &= 0x3f;
- break;
- }
- }
+ { /* rare case: chance is 1 in 12 */
+ switch (q0)
+ {
+ case 1:
+ iq[jz - 1] &= 0x7f;
+ break;
+ case 2:
+ iq[jz - 1] &= 0x3f;
+ break;
+ }
+ }
if (ih == 2)
- {
- z = one - z;
- if (carry != 0)
- z -= __scalbnf (one, q0);
- }
+ {
+ z = one - z;
+ if (carry != 0)
+ z -= __scalbnf (one, q0);
+ }
}
/* check if recomputation is needed */
@@ -201,21 +201,21 @@ recompute:
{
j = 0;
for (i = jz - 1; i >= jk; i--)
- j |= iq[i];
+ j |= iq[i];
if (j == 0)
- { /* need recomputation */
- for (k = 1; iq[jk - k] == 0; k++); /* k = no. of terms needed */
+ { /* need recomputation */
+ for (k = 1; iq[jk - k] == 0; k++); /* k = no. of terms needed */
- for (i = jz + 1; i <= jz + k; i++)
- { /* add q[jz+1] to q[jz+k] */
- f[jx + i] = two_over_pi[jv + i];
- for (j = 0, fw = 0.0; j <= jx; j++)
- fw += x[j] * f[jx + i - j];
- q[i] = fw;
- }
- jz += k;
- goto recompute;
- }
+ for (i = jz + 1; i <= jz + k; i++)
+ { /* add q[jz+1] to q[jz+k] */
+ f[jx + i] = two_over_pi[jv + i];
+ for (j = 0, fw = 0.0; j <= jx; j++)
+ fw += x[j] * f[jx + i - j];
+ q[i] = fw;
+ }
+ jz += k;
+ goto recompute;
+ }
}
/* chop off zero terms */
@@ -224,24 +224,24 @@ recompute:
jz -= 1;
q0 -= 8;
while (iq[jz] == 0)
- {
- jz--;
- q0 -= 8;
- }
+ {
+ jz--;
+ q0 -= 8;
+ }
}
else
- { /* break z into 8-bit if necessary */
+ { /* break z into 8-bit if necessary */
z = __scalbnf (z, -q0);
if (z >= two8)
- {
- fw = truncf (twon8 * z);
- iq[jz] = (int32_t) (z - two8 * fw);
- jz += 1;
- q0 += 8;
- iq[jz] = (int32_t) fw;
- }
+ {
+ fw = __truncf (twon8 * z);
+ iq[jz] = (int32_t) (z - two8 * fw);
+ jz += 1;
+ q0 += 8;
+ iq[jz] = (int32_t) fw;
+ }
else
- iq[jz] = (int32_t) z;
+ iq[jz] = (int32_t) z;
}
/* convert integer "bit" chunk to floating-point value */
@@ -256,7 +256,7 @@ recompute:
for (i = jz; i >= 0; i--)
{
for (fw = 0.0, k = 0; k <= jp && k <= jz - i; k++)
- fw += PIo2[k] * q[i + k];
+ fw += PIo2[k] * q[i + k];
fq[jz - i] = fw;
}
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 161 +++++++++++++++++------
include/unistd.h | 5 +-
io/Makefile | 2 +-
io/have_pipe2.c | 24 ++++
math/libm-test.inc | 4 +
nptl/Versions | 2 +-
nptl/nptl-init.c | 12 ++-
nptl/pthreadP.h | 1 +
nptl/sysdeps/unix/sysv/linux/aio_misc.h | 6 +-
nptl/sysdeps/unix/sysv/linux/timer_routines.c | 2 +-
sysdeps/ieee754/dbl-64/halfulp.c | 18 +--
sysdeps/ieee754/ldbl-128ibm/s_atanl.c | 2 +-
sysdeps/powerpc/Makefile | 2 +
sysdeps/powerpc/fpu/e_hypot.c | 27 ++--
sysdeps/powerpc/fpu/e_hypotf.c | 25 ++--
sysdeps/powerpc/fpu/e_rem_pio2f.c | 138 ++++++++++----------
sysdeps/powerpc/fpu/e_sqrt.c | 22 +---
sysdeps/powerpc/fpu/e_sqrtf.c | 21 +---
sysdeps/powerpc/fpu/k_rem_pio2f.c | 148 +++++++++++-----------
sysdeps/powerpc/fpu/math_private.h | 137 +++++++++++++++++++-
sysdeps/powerpc/locale-defines.sym | 5 +
sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S | 80 +++++++++++
sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S | 70 ++++++++++
sysdeps/powerpc/powerpc32/power7/Makefile | 4 +
sysdeps/powerpc/powerpc32/power7/strcasecmp.S | 132 +++++++++++++++++++
sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S | 5 +
sysdeps/powerpc/powerpc64/fpu/e_sqrt.c | 4 +-
sysdeps/powerpc/powerpc64/fpu/e_sqrtf.c | 4 +-
sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S | 68 ++++++++++
sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S | 59 ++++++++
sysdeps/powerpc/powerpc64/power7/Makefile | 5 +
sysdeps/powerpc/powerpc64/power7/strcasecmp.S | 125 ++++++++++++++++++
sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S | 5 +
33 files changed, 1058 insertions(+), 267 deletions(-)
create mode 100644 io/have_pipe2.c
create mode 100644 sysdeps/powerpc/locale-defines.sym
create mode 100644 sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S
create mode 100644 sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S
create mode 100644 sysdeps/powerpc/powerpc32/power7/Makefile
create mode 100644 sysdeps/powerpc/powerpc32/power7/strcasecmp.S
create mode 100644 sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S
create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
create mode 100644 sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
create mode 100644 sysdeps/powerpc/powerpc64/power7/strcasecmp.S
create mode 100644 sysdeps/powerpc/powerpc64/power7/strcasecmp_l.S
hooks/post-receive
--
GNU C Library master sources