[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r16261 - in /fsf/trunk/libc: ./ math/ resolv/ string/ sysdeps/i386/i686/multiarch/ sysdeps/powerpc/powerpc32/ sysdeps/powerp...
- To: commits@xxxxxxxxxx
- Subject: [Commits] r16261 - in /fsf/trunk/libc: ./ math/ resolv/ string/ sysdeps/i386/i686/multiarch/ sysdeps/powerpc/powerpc32/ sysdeps/powerp...
- From: eglibc@xxxxxxxxxx
- Date: Sun, 18 Dec 2011 00:02:09 -0000
Author: eglibc
Date: Sun Dec 18 00:02:07 2011
New Revision: 16261
Log:
Import glibc-mainline for 2011-12-18
Added:
fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcschr-c.c
fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcschr-sse2.S
fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcschr.S
fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcscpy-c.c
fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcscpy-ssse3.S
fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcscpy.S
fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcsrchr-c.c
fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S
fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcsrchr.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S
fsf/trunk/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
fsf/trunk/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
fsf/trunk/libc/sysdeps/x86_64/multiarch/wcscpy-c.c
fsf/trunk/libc/sysdeps/x86_64/multiarch/wcscpy-ssse3.S
fsf/trunk/libc/sysdeps/x86_64/multiarch/wcscpy.S
fsf/trunk/libc/sysdeps/x86_64/wcschr.S
fsf/trunk/libc/sysdeps/x86_64/wcsrchr.S
fsf/trunk/libc/wcsmbs/test-wcscpy.c
fsf/trunk/libc/wcsmbs/test-wcsrchr.c
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/NEWS
fsf/trunk/libc/math/libm-test.inc
fsf/trunk/libc/resolv/res_init.c
fsf/trunk/libc/string/test-strcmp.c
fsf/trunk/libc/string/test-strcpy.c
fsf/trunk/libc/string/test-strrchr.c
fsf/trunk/libc/sysdeps/i386/i686/multiarch/Makefile
fsf/trunk/libc/sysdeps/powerpc/powerpc32/a2/memcpy.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-start.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/elf/start.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_round.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/memset.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
fsf/trunk/libc/sysdeps/powerpc/powerpc32/sysdep.h
fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S
fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
fsf/trunk/libc/sysdeps/x86_64/multiarch/Makefile
fsf/trunk/libc/wcsmbs/Makefile
fsf/trunk/libc/wcsmbs/wcschr.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sun Dec 18 00:02:07 2011
@@ -1,7 +1,84 @@
-2011-12-12 Jeff Law <law@xxxxxxxxxx>
-
- * manual/resource.texi (Processor Resources):
- Fix typo in _SC_NPROCESSORS_ONLN.
+2011-11-21 Will Schmidt <will_schmidt@xxxxxxxxxxxx>
+
+ * powerpc/powerpc32/sysdep.h: Define SETUP_GOT_ACCESS() macro.
+ * powerpc/powerpc32/a2/memcpy.S: Use SETUP_GOT_ACCESS() macro.
+ * powerpc/powerpc32/dl-start.S: Likewise.
+ * powerpc/powerpc32/elf/start.S: Likewise.
+ * powerpc/powerpc32/fpu/__longjmp-common.S: Likewise.
+ * powerpc/powerpc32/fpu/s_ceil.S: Likewise.
+ * powerpc/powerpc32/fpu/s_ceilf.S: Likewise.
+ * powerpc/powerpc32/fpu/s_floor.S: Likewise.
+ * powerpc/powerpc32/fpu/s_floorf.S: Likewise.
+ * powerpc/powerpc32/fpu/s_lround.S: Likewise.
+ * powerpc/powerpc32/fpu/s_rint.S: Likewise.
+ * powerpc/powerpc32/fpu/s_rintf.S: Likewise.
+ * powerpc/powerpc32/fpu/s_round.S: Likewise.
+ * powerpc/powerpc32/fpu/s_roundf.S: Likewise.
+ * powerpc/powerpc32/fpu/s_trunc.S: Likewise.
+ * powerpc/powerpc32/fpu/s_truncf.S: Likewise.
+ * powerpc/powerpc32/fpu/setjmp-common.S: Likewise.
+ * powerpc/powerpc32/memset.S: Likewise.
+ * powerpc/powerpc32/power4/fpu/s_llround.S: Likewise.
+ * powerpc/powerpc32/power4/fpu/w_sqrt.S: Likewise.
+ * powerpc/powerpc32/power4/fpu/w_sqrtf.S: Likewise.
+ * powerpc/powerpc32/power5/fpu/w_sqrt.S: Likewise.
+ * powerpc/powerpc32/power5/fpu/w_sqrtf.S: Likewise.
+ * powerpc/powerpc32/power7/fpu/s_finite.S: Likewise.
+ * powerpc/powerpc32/power7/fpu/s_isinf.S: Likewise.
+ * powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise.
+ * unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S: Likewise.
+ * unix/sysv/linux/powerpc/powerpc32/brk.S: Likewise.
+ * unix/sysv/linux/powerpc/powerpc32/getcontext-common.S: Likewise.
+ * unix/sysv/linux/powerpc/powerpc32/setcontext-common.S: Likewise.
+ * unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S: Likewise.
+
+2011-11-18 Adhemerval Zanella <azanella@xxxxxxxxxxxxxxxxxx>
+
+ * math/libm-test.inc: Added more nearbyint tests.
+ * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: New file.
+ * sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: New file.
+ * sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S: New file.
+
+2011-11-21 Ross Lagerwall <rosslagerwall@xxxxxxxxx>
+
+ * resolv/res_init.c (__res_vinit): Open /etc/resolv.conf with
+ FD_CLOEXEC.
+
+2011-11-14 Liubov Dmitrieva <liubov.dmitrieva@xxxxxxxxx>
+
+ * sysdeps/x86_64/multiarch/Makefile [subdir=wcsmbs] (sysdep_routines):
+ Add wcscpy-ssse3 wcscpy-c.
+ * sysdeps/x86_64/multiarch/wcscpy-ssse3.S: New file.
+ * sysdeps/x86_64/multiarch/wcscpy-c.c: New file.
+ * sysdeps/x86_64/multiarch/wcscpy.S: New file.
+ * sysdeps/x86_64/wcschr.S: New file.
+ * sysdeps/x86_64/wcsrchr.S: New file.
+ * string/test-strcmp.c: Remove checking of wcscmp function for
+ wrong alignments.
+ * sysdeps/i386/i686/multiarch/Makefile [subdir=wcsmbs]
+ (sysdep_routines): Add wcscpy-ssse3 wcscpy-c wcschr-sse2 wcschr-c
+ wcsrchr-sse2 wcsrchr-c.
+ * sysdeps/i386/i686/multiarch/wcschr.S: New file.
+ * sysdeps/i386/i686/multiarch/wcschr-c.c: New file.
+ * sysdeps/i386/i686/multiarch/wcschr-sse2.S: New file.
+ * sysdeps/i386/i686/multiarch/wcsrchr.S: New file.
+ * sysdeps/i386/i686/multiarch/wcsrchr-c.c: New file.
+ * sysdeps/i386/i686/multiarch/wcsrchr-sse2.S: New file.
+ * sysdeps/i386/i686/multiarch/wcscpy.S: New file.
+ * sysdeps/i386/i686/multiarch/wcscpy-c.c: New file.
+ * sysdeps/i386/i686/multiarch/wcscpy-ssse3.S: New file.
+ * wcsmbc/wcschr.c (WCSCHR): New macro.
+
+2011-11-17 Liubov Dmitrieva <liubov.dmitrieva@xxxxxxxxx>
+
+ * wcsmbs/Makefile (strop-tests): Add wcsrchr wcscpy.
+ * wcsmbs/test-wcsrchr.c: New file.
+ * string/test-strrchr.c: Add wcsrchr support.
+ (WIDE): New macro.
+ * wcsmbs/test-wcscpy.c: New file.
+ * string/test-strcpy.c: Add wcscpy support.
+ (WIDE): New macro.
2011-12-10 Ulrich Drepper <drepper@xxxxxxxxx>
Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Sun Dec 18 00:02:07 2011
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2011-11-14
+GNU C Library NEWS -- history of user-visible changes. 2011-12-17
Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -34,7 +34,8 @@
* Optimized strchr and strrchr for SSE on x86-32.
Contributed by Liubov Dmitrieva.
-* Optimized memchr, memrchr, rawmemchr, memcmp, wmemcmp for x86-64 and x86-32.
+* Optimized memchr, memrchr, rawmemchr, memcmp, wmemcmp, wcschr, wcscpy
+ for x86-64 and x86-32.
Contributed by Liubov Dmitrieva.
* New interfaces: scandirat, scandirat64
@@ -59,6 +60,8 @@
* Optimized strcasecmp and strncasecmp for SSSE3 and SSE4.2 on x86-32.
Implemented by Ulrich Drepper.
+
+* Optimized nearbyint for PPC. Implemented by Adhemerval Zanella.
Version 2.14
Modified: fsf/trunk/libc/math/libm-test.inc
==============================================================================
--- fsf/trunk/libc/math/libm-test.inc (original)
+++ fsf/trunk/libc/math/libm-test.inc Sun Dec 18 00:02:07 2011
@@ -4618,6 +4618,10 @@
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);
Modified: fsf/trunk/libc/resolv/res_init.c
==============================================================================
--- fsf/trunk/libc/resolv/res_init.c (original)
+++ fsf/trunk/libc/resolv/res_init.c Sun Dec 18 00:02:07 2011
@@ -233,7 +233,7 @@
(line[sizeof(name) - 1] == ' ' || \
line[sizeof(name) - 1] == '\t'))
- if ((fp = fopen(_PATH_RESCONF, "rc")) != NULL) {
+ if ((fp = fopen(_PATH_RESCONF, "rce")) != NULL) {
/* No threads use this stream. */
__fsetlocking (fp, FSETLOCKING_BYCALLER);
/* read the config file */
Modified: fsf/trunk/libc/string/test-strcmp.c
==============================================================================
--- fsf/trunk/libc/string/test-strcmp.c (original)
+++ fsf/trunk/libc/string/test-strcmp.c Sun Dec 18 00:02:07 2011
@@ -221,14 +221,16 @@
static void
do_random_tests (void)
{
- for (size_t a = 0; a < CHARBYTES; a += CHARALIGN)
- for (size_t b = 0; b < CHARBYTES; b += CHARALIGN)
- {
- UCHAR *p1 = (UCHAR *) (buf1 + page_size - 512 * CHARBYTES - a);
- UCHAR *p2 = (UCHAR *) (buf2 + page_size - 512 * CHARBYTES - b);
+ UCHAR *p1 = (UCHAR *) (buf1 + page_size - 512 * CHARBYTES);
+ UCHAR *p2 = (UCHAR *) (buf2 + page_size - 512 * CHARBYTES);
for (size_t n = 0; n < ITERATIONS; n++)
{
+ /* for wcscmp case align1 and align2 mean here alignment
+ in wchar_t symbols, it equal 4*k alignment in bytes, we
+ don't check other alignments like for example
+ p1 = (wchar_t *)(buf1 + 1)
+ because it's wrong using of wchar_t type. */
size_t align1 = random () & 31;
size_t align2;
if (random () & 1)
@@ -274,7 +276,7 @@
}
int result = 0;
- MEMCPY ((CHAR *) (p2 + align2), (CHAR *) (p1 + align1), pos);
+ MEMCPY (p2 + align2, p1 + align1, pos);
if (pos < len1)
{
if (p2[align2 + pos] == p1[align1 + pos])
@@ -302,13 +304,12 @@
|| (r < 0 && result >= 0)
|| (r > 0 && result <= 0))
{
- error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd, %zd, %zd) %d != %d, p1 %p p2 %p",
+ error (0, 0, "Iteration %zd - wrong result in function %s (align in bytes: %zd, align in bytes: %zd, len1: %zd, len2: %zd, pos: %zd) %d != %d, p1 %p p2 %p",
n, impl->name, (size_t) (p1 + align1) & 63, (size_t) (p1 + align2) & 63, len1, len2, pos, r, result, p1, p2);
ret = 1;
}
}
- }
- }
+ }
}
static void
Modified: fsf/trunk/libc/string/test-strcpy.c
==============================================================================
--- fsf/trunk/libc/string/test-strcpy.c (original)
+++ fsf/trunk/libc/string/test-strcpy.c Sun Dec 18 00:02:07 2011
@@ -1,7 +1,8 @@
/* Test and measure strcpy functions.
- Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2003, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@xxxxxxxxxx>, 1999.
+ Added wcscpy support by Liubov Dmitrieva <liubov.dmitrieva@xxxxxxxxx>, 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
@@ -18,29 +19,55 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#ifdef WIDE
+# include <wchar.h>
+# define CHAR wchar_t
+# define UCHAR wchar_t
+# define BIG_CHAR WCHAR_MAX
+# define SMALL_CHAR 1273
+# define STRCMP wcscmp
+# define MEMCMP wmemcmp
+# define MEMSET wmemset
+#else
+# define CHAR char
+# define UCHAR unsigned char
+# define BIG_CHAR CHAR_MAX
+# define SMALL_CHAR 127
+# define STRCMP strcmp
+# define MEMCMP memcmp
+# define MEMSET memset
+#endif
+
#ifndef STRCPY_RESULT
# define STRCPY_RESULT(dst, len) dst
# define TEST_MAIN
# include "test-string.h"
-
-char *simple_strcpy (char *, const char *);
-
-IMPL (simple_strcpy, 0)
-IMPL (strcpy, 1)
-
-char *
-simple_strcpy (char *dst, const char *src)
-{
- char *ret = dst;
+# ifndef WIDE
+# define SIMPLE_STRCPY simple_strcpy
+# define STRCPY strcpy
+# else
+# define SIMPLE_STRCPY simple_wcscpy
+# define STRCPY wcscpy
+# endif
+
+CHAR *SIMPLE_STRCPY (CHAR *, const CHAR *);
+
+IMPL (SIMPLE_STRCPY, 0)
+IMPL (STRCPY, 1)
+
+CHAR *
+SIMPLE_STRCPY (CHAR *dst, const CHAR *src)
+{
+ CHAR *ret = dst;
while ((*dst++ = *src++) != '\0');
return ret;
}
#endif
-typedef char *(*proto_t) (char *, const char *);
+typedef CHAR *(*proto_t) (CHAR *, const CHAR *);
static void
-do_one_test (impl_t *impl, char *dst, const char *src,
+do_one_test (impl_t *impl, CHAR *dst, const CHAR *src,
size_t len __attribute__((unused)))
{
if (CALL (impl, dst, src) != STRCPY_RESULT (dst, len))
@@ -51,7 +78,7 @@
return;
}
- if (strcmp (dst, src) != 0)
+ if (STRCMP (dst, src) != 0)
{
error (0, 0, "Wrong result in function %s dst \"%s\" src \"%s\"",
impl->name, dst, src);
@@ -82,25 +109,27 @@
do_test (size_t align1, size_t align2, size_t len, int max_char)
{
size_t i;
- char *s1, *s2;
-
+ CHAR *s1, *s2;
+/* For wcscpy: align1 and align2 here mean alignment not in bytes,
+ but in wchar_ts, in bytes it will equal to align * (sizeof (wchar_t))
+ len for wcschr here isn't in bytes but it's number of wchar_t symbols. */
align1 &= 7;
- if (align1 + len >= page_size)
+ if ((align1 + len) * sizeof(CHAR) >= page_size)
return;
align2 &= 7;
- if (align2 + len >= page_size)
+ if ((align2 + len) * sizeof(CHAR) >= page_size)
return;
- s1 = (char *) (buf1 + align1);
- s2 = (char *) (buf2 + align2);
+ s1 = (CHAR *) (buf1) + align1;
+ s2 = (CHAR *) (buf2) + align2;
for (i = 0; i < len; i++)
s1[i] = 32 + 23 * i % (max_char - 32);
s1[len] = 0;
if (HP_TIMING_AVAIL)
- printf ("Length %4zd, alignment %2zd/%2zd:", len, align1, align2);
+ printf ("Length %4zd, alignments in bytes %2zd/%2zd:", len, align1 * sizeof(CHAR), align2 * sizeof(CHAR));
FOR_EACH_IMPL (impl, 0)
do_one_test (impl, s2, s1, len);
@@ -113,15 +142,21 @@
do_random_tests (void)
{
size_t i, j, n, align1, align2, len;
- unsigned char *p1 = buf1 + page_size - 512;
- unsigned char *p2 = buf2 + page_size - 512;
- unsigned char *res;
+ UCHAR *p1 = (UCHAR *) (buf1 + page_size) - 512;
+ UCHAR *p2 = (UCHAR *) (buf2 + page_size) - 512;
+ UCHAR *res;
for (n = 0; n < ITERATIONS; n++)
{
- align1 = random () & 31;
+ /* For wcsrchr: align1 and align2 here mean align not in bytes,
+ but in wchar_ts, in bytes it will equal to align * (sizeof
+ (wchar_t)). For strrchr we need to check all alignments from
+ 0 to 63 since some assembly implementations have separate
+ prolog for alignments more 48. */
+
+ align1 = random () & (63 / sizeof(CHAR));
if (random () & 1)
- align2 = random () & 31;
+ align2 = random () & (63 / sizeof(CHAR));
else
align2 = align1 + (random () & 24);
len = random () & 511;
@@ -139,17 +174,16 @@
p1[i] = 0;
else
{
- p1[i] = random () & 255;
+ p1[i] = random () & BIG_CHAR;
if (i >= align1 && i < len + align1 && !p1[i])
- p1[i] = (random () & 127) + 3;
+ p1[i] = (random () & SMALL_CHAR) + 3;
}
}
FOR_EACH_IMPL (impl, 1)
{
- memset (p2 - 64, '\1', 512 + 64);
- res = (unsigned char *) CALL (impl, (char *) (p2 + align2),
- (char *) (p1 + align1));
+ MEMSET (p2 - 64, '\1', 512 + 64);
+ res = (UCHAR *) CALL (impl, (CHAR *) (p2 + align2), (CHAR *) (p1 + align1));
if (res != STRCPY_RESULT (p2 + align2, len))
{
error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %zd, %zd) %p != %p",
@@ -177,7 +211,7 @@
break;
}
}
- if (memcmp (p1 + align1, p2 + align2, len + 1))
+ if (MEMCMP (p1 + align1, p2 + align2, len + 1))
{
error (0, 0, "Iteration %zd - different strings, %s (%zd, %zd, %zd)",
n, impl->name, align1, align2, len);
@@ -201,24 +235,24 @@
for (i = 0; i < 16; ++i)
{
- do_test (0, 0, i, 127);
- do_test (0, 0, i, 255);
- do_test (0, i, i, 127);
- do_test (i, 0, i, 255);
+ do_test (0, 0, i, SMALL_CHAR);
+ do_test (0, 0, i, BIG_CHAR);
+ do_test (0, i, i, SMALL_CHAR);
+ do_test (i, 0, i, BIG_CHAR);
}
for (i = 1; i < 8; ++i)
{
- do_test (0, 0, 8 << i, 127);
- do_test (8 - i, 2 * i, 8 << i, 127);
+ do_test (0, 0, 8 << i, SMALL_CHAR);
+ do_test (8 - i, 2 * i, 8 << i, SMALL_CHAR);
}
for (i = 1; i < 8; ++i)
{
- do_test (i, 2 * i, 8 << i, 127);
- do_test (2 * i, i, 8 << i, 255);
- do_test (i, i, 8 << i, 127);
- do_test (i, i, 8 << i, 255);
+ do_test (i, 2 * i, 8 << i, SMALL_CHAR);
+ do_test (2 * i, i, 8 << i, BIG_CHAR);
+ do_test (i, i, 8 << i, SMALL_CHAR);
+ do_test (i, i, 8 << i, BIG_CHAR);
}
do_random_tests ();
Modified: fsf/trunk/libc/string/test-strrchr.c
==============================================================================
--- fsf/trunk/libc/string/test-strrchr.c (original)
+++ fsf/trunk/libc/string/test-strrchr.c Sun Dec 18 00:02:07 2011
@@ -1,7 +1,9 @@
-/* Test and measure strrchr functions.
- Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+/* Test and measure STRCHR functions.
+ Copyright (C) 1999, 2002, 2003, 2005, 2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@xxxxxxxxxx>, 1999.
+ Added wcsrrchr support by Liubov Dmitrieva <liubov.dmitrieva@xxxxxxxxx>,
+ 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
@@ -21,28 +23,45 @@
#define TEST_MAIN
#include "test-string.h"
-typedef char *(*proto_t) (const char *, int);
-char *simple_strrchr (const char *, int);
-
-IMPL (simple_strrchr, 0)
-IMPL (strrchr, 1)
-
-char *
-simple_strrchr (const char *s, int c)
-{
- const char *ret = NULL;
+#ifdef WIDE
+# include <wchar.h>
+# define SIMPLE_STRRCHR simple_wcsrchr
+# define STRRCHR wcsrchr
+# define CHAR wchar_t
+# define UCHAR wchar_t
+# define BIG_CHAR WCHAR_MAX
+# define SMALL_CHAR 1273
+#else
+# define SIMPLE_STRRCHR simple_strrchr
+# define STRRCHR strrchr
+# define CHAR char
+# define UCHAR unsigned char
+# define BIG_CHAR CHAR_MAX
+# define SMALL_CHAR 127
+#endif
+
+typedef CHAR *(*proto_t) (const CHAR *, int);
+CHAR *SIMPLE_STRRCHR (const CHAR *, int);
+
+IMPL (SIMPLE_STRRCHR, 0)
+IMPL (STRRCHR, 1)
+
+CHAR *
+SIMPLE_STRRCHR (const CHAR *s, int c)
+{
+ const CHAR *ret = NULL;
for (; *s != '\0'; ++s)
- if (*s == (char) c)
+ if (*s == (CHAR) c)
ret = s;
- return (char *) (c == '\0' ? s : ret);
+ return (CHAR *) (c == '\0' ? s : ret);
}
static void
-do_one_test (impl_t *impl, const char *s, int c, char *exp_res)
-{
- char *res = CALL (impl, s, c);
+do_one_test (impl_t *impl, const CHAR *s, int c, CHAR *exp_res)
+{
+ CHAR *res = CALL (impl, s, c);
if (res != exp_res)
{
error (0, 0, "Wrong result in function %s %p %p", impl->name,
@@ -72,41 +91,45 @@
static void
do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char)
+/* For wcsrchr: align here means align not in bytes,
+ but in wchar_ts, in bytes it will equal to align * (sizeof (wchar_t))
+ len for wcschr here isn't in bytes but it's number of wchar_t symbols. */
{
size_t i;
- char *result;
+ CHAR *result;
+ CHAR *buf = (CHAR *) buf1;
align &= 7;
- if (align + len >= page_size)
+ if ( (align + len) * sizeof(CHAR) >= page_size)
return;
for (i = 0; i < len; ++i)
{
- buf1[align + i] = random () & max_char;
- if (!buf1[align + i])
- buf1[align + i] = random () & max_char;
- if (!buf1[align + i])
- buf1[align + i] = 1;
- if ((i > pos || pos >= len) && buf1[align + i] == seek_char)
- buf1[align + i] = seek_char + 10 + (random () & 15);
- }
- buf1[align + len] = 0;
+ buf[align + i] = (random () * random ()) & max_char;
+ if (!buf[align + i])
+ buf[align + i] = (random () * random ()) & max_char;
+ if (!buf[align + i])
+ buf[align + i] = 1;
+ if ((i > pos || pos >= len) && buf[align + i] == seek_char)
+ buf[align + i] = seek_char + 10 + (random () & 15);
+ }
+ buf[align + len] = 0;
if (pos < len)
{
- buf1[align + pos] = seek_char;
- result = (char *) (buf1 + align + pos);
+ buf[align + pos] = seek_char;
+ result = (CHAR *) (buf + align + pos);
}
else if (seek_char == 0)
- result = (char *) (buf1 + align + len);
+ result = (CHAR *) (buf + align + len);
else
result = NULL;
if (HP_TIMING_AVAIL)
- printf ("Length %4zd, alignment %2zd:", pos, align);
+ printf ("Length %4zd, alignment in bytes %2zd:", pos, align * sizeof(CHAR));
FOR_EACH_IMPL (impl, 0)
- do_one_test (impl, (char *) (buf1 + align), seek_char, result);
+ do_one_test (impl, (CHAR *) (buf + align), seek_char, result);
if (HP_TIMING_AVAIL)
putchar ('\n');
@@ -117,20 +140,27 @@
{
size_t i, j, n, align, pos, len;
int seek_char;
- char *result;
- unsigned char *p = buf1 + page_size - 512;
+ CHAR *result;
+ UCHAR *p = (UCHAR *) (buf1 + page_size) - 512;
for (n = 0; n < ITERATIONS; n++)
{
- align = random () & 15;
+ align = random () & (63 / sizeof(CHAR));
+ /* For wcsrchr: align here means align not in bytes, but in wchar_ts,
+ in bytes it will equal to align * (sizeof (wchar_t)).
+ For strrchr we need to check all alignments from 0 to 63 since
+ some assembly implementations have separate prolog for alignments
+ more 48. */
pos = random () & 511;
if (pos + align >= 511)
pos = 510 - align - (random () & 7);
len = random () & 511;
+ /* len for wcschr here isn't in bytes but it's number of wchar_t
+ symbols. */
if (pos >= len)
len = pos + (random () & 7);
if (len + align >= 512)
- len = 511 - align - (random () & 7);
+ len = 511 - align - (random () & 7);
seek_char = random () & 255;
if (seek_char && pos == len)
{
@@ -141,7 +171,7 @@
}
j = len + align + 64;
if (j > 512)
- j = 512;
+ j = 512;
for (i = 0; i < j; i++)
{
@@ -165,18 +195,18 @@
}
if (pos <= len)
- result = (char *) (p + pos + align);
+ result = (CHAR *) (p + pos + align);
else if (seek_char == 0)
- result = (char *) (p + len + align);
+ result = (CHAR *) (p + len + align);
else
result = NULL;
FOR_EACH_IMPL (impl, 1)
- if (CALL (impl, (char *) (p + align), seek_char) != result)
+ if (CALL (impl, (CHAR *) (p + align), seek_char) != result)
{
error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %d, %zd, %zd) %p != %p, p %p",
n, impl->name, align, seek_char, len, pos,
- CALL (impl, (char *) (p + align), seek_char), result, p);
+ CALL (impl, (CHAR *) (p + align), seek_char), result, p);
ret = 1;
}
}
@@ -196,38 +226,38 @@
for (i = 1; i < 8; ++i)
{
- do_test (0, 16 << i, 2048, 23, 127);
- do_test (i, 16 << i, 2048, 23, 127);
- }
-
- for (i = 1; i < 8; ++i)
- {
- do_test (i, 64, 256, 23, 127);
- do_test (i, 64, 256, 23, 255);
+ do_test (0, 16 << i, 2048, 23, SMALL_CHAR);
+ do_test (i, 16 << i, 2048, 23, SMALL_CHAR);
+ }
+
+ for (i = 1; i < 8; ++i)
+ {
+ do_test (i, 64, 256, 23, SMALL_CHAR);
+ do_test (i, 64, 256, 23, BIG_CHAR);
}
for (i = 0; i < 32; ++i)
{
- do_test (0, i, i + 1, 23, 127);
- do_test (0, i, i + 1, 23, 255);
- }
-
- for (i = 1; i < 8; ++i)
- {
- do_test (0, 16 << i, 2048, 0, 127);
- do_test (i, 16 << i, 2048, 0, 127);
- }
-
- for (i = 1; i < 8; ++i)
- {
- do_test (i, 64, 256, 0, 127);
- do_test (i, 64, 256, 0, 255);
+ do_test (0, i, i + 1, 23, SMALL_CHAR);
+ do_test (0, i, i + 1, 23, BIG_CHAR);
+ }
+
+ for (i = 1; i < 8; ++i)
+ {
+ do_test (0, 16 << i, 2048, 0, SMALL_CHAR);
+ do_test (i, 16 << i, 2048, 0, SMALL_CHAR);
+ }
+
+ for (i = 1; i < 8; ++i)
+ {
+ do_test (i, 64, 256, 0, SMALL_CHAR);
+ do_test (i, 64, 256, 0, BIG_CHAR);
}
for (i = 0; i < 32; ++i)
{
- do_test (0, i, i + 1, 0, 127);
- do_test (0, i, i + 1, 0, 255);
+ do_test (0, i, i + 1, 0, SMALL_CHAR);
+ do_test (0, i, i + 1, 0, BIG_CHAR);
}
do_random_tests ();
Modified: fsf/trunk/libc/sysdeps/i386/i686/multiarch/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/Makefile (original)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/Makefile Sun Dec 18 00:02:07 2011
@@ -37,7 +37,8 @@
ifeq ($(subdir),wcsmbs)
sysdep_routines += wcscmp-sse2 wcscmp-c wcslen-sse2 wcslen-c \
- wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c
+ wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c wcschr-sse2 \
+ wcschr-c wcsrchr-sse2 wcsrchr-c wcscpy-ssse3 wcscpy-c
endif
ifeq (mathyes,$(subdir)$(config-cflags-avx))
Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcschr-c.c
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcschr-c.c (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcschr-c.c Sun Dec 18 00:02:07 2011
@@ -1,0 +1,8 @@
+#ifndef NOT_IN_libc
+# undef libc_hidden_def
+# define libc_hidden_def(name) \
+ __hidden_ver1 (__wcschr_ia32, __GI_wcschr, __wcschr_ia32);
+# define WCSCHR __wcschr_ia32
+#endif
+
+#include "wcsmbs/wcschr.c"
Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcschr-sse2.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcschr-sse2.S (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcschr-sse2.S Sun Dec 18 00:02:07 2011
@@ -1,0 +1,220 @@
+/* wcschr with SSE2, without using bsf instructions
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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. */
+
+#ifndef NOT_IN_libc
+# include <sysdep.h>
+
+# define CFI_PUSH(REG) \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (REG, 0)
+
+# define CFI_POP(REG) \
+ cfi_adjust_cfa_offset (-4); \
+ cfi_restore (REG)
+
+# define PUSH(REG) pushl REG; CFI_PUSH (REG)
+# define POP(REG) popl REG; CFI_POP (REG)
+
+# define PARMS 4
+# define STR1 PARMS
+# define STR2 STR1+4
+
+ atom_text_section
+ENTRY (__wcschr_sse2)
+
+ mov STR1(%esp), %ecx
+ movd STR2(%esp), %xmm1
+
+ mov %ecx, %eax
+ punpckldq %xmm1, %xmm1
+ pxor %xmm2, %xmm2
+ punpckldq %xmm1, %xmm1
+
+ and $63, %eax
+ cmp $48, %eax
+ ja L(cross_cache)
+
+ movdqu (%ecx), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %edx
+ pmovmskb %xmm0, %eax
+ or %eax, %edx
+ jnz L(matches)
+ and $-16, %ecx
+ jmp L(loop)
+
+ .p2align 4
+L(cross_cache):
+ PUSH (%edi)
+ mov %ecx, %edi
+ mov %eax, %ecx
+ and $-16, %edi
+ and $15, %ecx
+ movdqa (%edi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %edx
+ pmovmskb %xmm0, %eax
+
+ sarl %cl, %edx
+ sarl %cl, %eax
+ test %eax, %eax
+ jz L(unaligned_no_match)
+
+ add %edi, %ecx
+ POP (%edi)
+
+ test %edx, %edx
+ jz L(match_case1)
+ test %al, %al
+ jz L(match_higth_case2)
+ test $15, %al
+ jnz L(match_case2_4)
+ test $15, %dl
+ jnz L(return_null)
+ lea 4(%ecx), %eax
+ ret
+
+ CFI_PUSH (%edi)
+
+ .p2align 4
+L(unaligned_no_match):
+ mov %edi, %ecx
+ POP (%edi)
+
+ test %edx, %edx
+ jnz L(return_null)
+
+ pxor %xmm2, %xmm2
+
+/* Loop start on aligned string. */
+ .p2align 4
+L(loop):
+ add $16, %ecx
+ movdqa (%ecx), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %edx
+ pmovmskb %xmm0, %eax
+ or %eax, %edx
+ jnz L(matches)
+ add $16, %ecx
+
+ movdqa (%ecx), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %edx
+ pmovmskb %xmm0, %eax
+ or %eax, %edx
+ jnz L(matches)
+ add $16, %ecx
+
+ movdqa (%ecx), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %edx
+ pmovmskb %xmm0, %eax
+ or %eax, %edx
+ jnz L(matches)
+ add $16, %ecx
+
+ movdqa (%ecx), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %edx
+ pmovmskb %xmm0, %eax
+ or %eax, %edx
+ jz L(loop)
+
+ .p2align 4
+L(matches):
+ pmovmskb %xmm2, %edx
+ test %eax, %eax
+ jz L(return_null)
+ test %edx, %edx
+ jz L(match_case1)
+
+ .p2align 4
+L(match_case2):
+ test %al, %al
+ jz L(match_higth_case2)
+ test $15, %al
+ jnz L(match_case2_4)
+ test $15, %dl
+ jnz L(return_null)
+ lea 4(%ecx), %eax
+ ret
+
+ .p2align 4
+L(match_case2_4):
+ mov %ecx, %eax
+ ret
+
+ .p2align 4
+L(match_higth_case2):
+ test %dl, %dl
+ jnz L(return_null)
+ test $15, %ah
+ jnz L(match_case2_12)
+ test $15, %dh
+ jnz L(return_null)
+ lea 12(%ecx), %eax
+ ret
+
+ .p2align 4
+L(match_case2_12):
+ lea 8(%ecx), %eax
+ ret
+
+ .p2align 4
+L(match_case1):
+ test %al, %al
+ jz L(match_higth_case1)
+
+ test $0x01, %al
+ jnz L(exit0)
+ lea 4(%ecx), %eax
+ ret
+
+ .p2align 4
+L(match_higth_case1):
+ test $0x01, %ah
+ jnz L(exit3)
+ lea 12(%ecx), %eax
+ ret
+
+ .p2align 4
+L(exit0):
+ mov %ecx, %eax
+ ret
+
+ .p2align 4
+L(exit3):
+ lea 8(%ecx), %eax
+ ret
+
+ .p2align 4
+L(return_null):
+ xor %eax, %eax
+ ret
+
+END (__wcschr_sse2)
+#endif
Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcschr.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcschr.S (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcschr.S Sun Dec 18 00:02:07 2011
@@ -1,0 +1,54 @@
+/* Multiple versions of wcschr
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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 <init-arch.h>
+
+#ifndef NOT_IN_libc
+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
+ .globl __i686.get_pc_thunk.bx
+ .hidden __i686.get_pc_thunk.bx
+ .p2align 4
+ .type __i686.get_pc_thunk.bx,@function
+__i686.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+
+ .text
+ENTRY(wcschr)
+ .type wcschr, @gnu_indirect_function
+ pushl %ebx
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebx, 0)
+ call __i686.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
+ jne 1f
+ call __init_cpu_features
+1: leal __wcschr_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __wcschr_sse2@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4);
+ cfi_restore (ebx)
+ ret
+END(wcschr)
+#endif
Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcscpy-c.c
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcscpy-c.c (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcscpy-c.c Sun Dec 18 00:02:07 2011
@@ -1,0 +1,5 @@
+#ifndef NOT_IN_libc
+# define wcscpy __wcscpy_ia32
+#endif
+
+#include "wcsmbs/wcscpy.c"
Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcscpy-ssse3.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcscpy-ssse3.S (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcscpy-ssse3.S Sun Dec 18 00:02:07 2011
@@ -1,0 +1,621 @@
+/* wcscpy with SSSE3
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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. */
+
+#ifndef NOT_IN_libc
+# include <sysdep.h>
+
+# define CFI_PUSH(REG) \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (REG, 0)
+
+# define CFI_POP(REG) \
+ cfi_adjust_cfa_offset (-4); \
+ cfi_restore (REG)
+
+# define PUSH(REG) pushl REG; CFI_PUSH (REG)
+# define POP(REG) popl REG; CFI_POP (REG)
+
+# define PARMS 4
+# define RETURN POP (%edi); ret; CFI_PUSH (%edi)
+# define STR1 PARMS
+# define STR2 STR1+4
+# define LEN STR2+4
+
+ atom_text_section
+ENTRY (__wcscpy_ssse3)
+ mov STR1(%esp), %edx
+ mov STR2(%esp), %ecx
+
+ cmp $0, (%ecx)
+ jz L(ExitTail4)
+ cmp $0, 4(%ecx)
+ jz L(ExitTail8)
+ cmp $0, 8(%ecx)
+ jz L(ExitTail12)
+ cmp $0, 12(%ecx)
+ jz L(ExitTail16)
+
+ PUSH (%edi)
+ mov %edx, %edi
+
+ PUSH (%esi)
+ lea 16(%ecx), %esi
+
+ and $-16, %esi
+
+ pxor %xmm0, %xmm0
+ pcmpeqd (%esi), %xmm0
+ movdqu (%ecx), %xmm1
+ movdqu %xmm1, (%edx)
+
+ pmovmskb %xmm0, %eax
+ sub %ecx, %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ mov %edx, %eax
+ lea 16(%edx), %edx
+ and $-16, %edx
+ sub %edx, %eax
+
+ sub %eax, %ecx
+ mov %ecx, %eax
+ and $0xf, %eax
+ mov $0, %esi
+
+ jz L(Align16Both)
+ cmp $4, %eax
+ je L(Shl4)
+ cmp $8, %eax
+ je L(Shl8)
+ jmp L(Shl12)
+
+L(Align16Both):
+ movaps (%ecx), %xmm1
+ movaps 16(%ecx), %xmm2
+ movaps %xmm1, (%edx)
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %eax
+ lea 16(%esi), %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%ecx, %esi), %xmm3
+ movaps %xmm2, (%edx, %esi)
+ pcmpeqd %xmm3, %xmm0
+ pmovmskb %xmm0, %eax
+ lea 16(%esi), %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%ecx, %esi), %xmm4
+ movaps %xmm3, (%edx, %esi)
+ pcmpeqd %xmm4, %xmm0
+ pmovmskb %xmm0, %eax
+ lea 16(%esi), %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%ecx, %esi), %xmm1
+ movaps %xmm4, (%edx, %esi)
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm0, %eax
+ lea 16(%esi), %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%ecx, %esi), %xmm2
+ movaps %xmm1, (%edx, %esi)
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %eax
+ lea 16(%esi), %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps 16(%ecx, %esi), %xmm3
+ movaps %xmm2, (%edx, %esi)
+ pcmpeqd %xmm3, %xmm0
+ pmovmskb %xmm0, %eax
+ lea 16(%esi), %esi
+
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps %xmm3, (%edx, %esi)
+ mov %ecx, %eax
+ lea 16(%ecx, %esi), %ecx
+ and $-0x40, %ecx
+ sub %ecx, %eax
+ sub %eax, %edx
+
+ mov $-0x40, %esi
+
+L(Aligned64Loop):
+ movaps (%ecx), %xmm2
+ movaps 32(%ecx), %xmm3
+ movaps %xmm2, %xmm4
+ movaps 16(%ecx), %xmm5
+ movaps %xmm3, %xmm6
+ movaps 48(%ecx), %xmm7
+ pminub %xmm5, %xmm2
+ pminub %xmm7, %xmm3
+ pminub %xmm2, %xmm3
+ lea 64(%edx), %edx
+ pcmpeqd %xmm0, %xmm3
+ lea 64(%ecx), %ecx
+ pmovmskb %xmm3, %eax
+
+ test %eax, %eax
+ jnz L(Aligned64Leave)
+ movaps %xmm4, -64(%edx)
+ movaps %xmm5, -48(%edx)
+ movaps %xmm6, -32(%edx)
+ movaps %xmm7, -16(%edx)
+ jmp L(Aligned64Loop)
+
+L(Aligned64Leave):
+ pcmpeqd %xmm4, %xmm0
+ pmovmskb %xmm0, %eax
+ test %eax, %eax
+ jnz L(CopyFrom1To16Bytes)
+
+ pcmpeqd %xmm5, %xmm0
+ pmovmskb %xmm0, %eax
+ movaps %xmm4, -64(%edx)
+ test %eax, %eax
+ lea 16(%esi), %esi
+ jnz L(CopyFrom1To16Bytes)
+
+ pcmpeqd %xmm6, %xmm0
+ pmovmskb %xmm0, %eax
+ movaps %xmm5, -48(%edx)
+ test %eax, %eax
+ lea 16(%esi), %esi
+ jnz L(CopyFrom1To16Bytes)
+
+ movaps %xmm6, -32(%edx)
+ pcmpeqd %xmm7, %xmm0
+ pmovmskb %xmm0, %eax
+ test %eax, %eax
+ lea 16(%esi), %esi
+ jnz L(CopyFrom1To16Bytes)
+
+ mov $-0x40, %esi
+ movaps %xmm7, -16(%edx)
+ jmp L(Aligned64Loop)
+
+ .p2align 4
+L(Shl4):
+ movaps -4(%ecx), %xmm1
+ movaps 12(%ecx), %xmm2
+L(Shl4Start):
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %eax
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl4LoopExit)
+
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ movaps 28(%ecx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl4LoopExit)
+
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm2, (%edx)
+ movaps 28(%ecx), %xmm2
+ movaps %xmm3, %xmm1
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl4LoopExit)
+
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ movaps 28(%ecx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl4LoopExit)
+
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ lea 28(%ecx), %ecx
+ lea 16(%edx), %edx
+
+ mov %ecx, %eax
+ and $-0x40, %ecx
+ sub %ecx, %eax
+ lea -12(%ecx), %ecx
+ sub %eax, %edx
+
+ movaps -4(%ecx), %xmm1
+
+L(Shl4LoopStart):
+ movaps 12(%ecx), %xmm2
+ movaps 28(%ecx), %xmm3
+ movaps %xmm3, %xmm6
+ movaps 44(%ecx), %xmm4
+ movaps %xmm4, %xmm7
+ movaps 60(%ecx), %xmm5
+ pminub %xmm2, %xmm6
+ pminub %xmm5, %xmm7
+ pminub %xmm6, %xmm7
+ pcmpeqd %xmm0, %xmm7
+ pmovmskb %xmm7, %eax
+ movaps %xmm5, %xmm7
+ palignr $4, %xmm4, %xmm5
+ test %eax, %eax
+ palignr $4, %xmm3, %xmm4
+ jnz L(Shl4Start)
+
+ palignr $4, %xmm2, %xmm3
+ lea 64(%ecx), %ecx
+ palignr $4, %xmm1, %xmm2
+ movaps %xmm7, %xmm1
+ movaps %xmm5, 48(%edx)
+ movaps %xmm4, 32(%edx)
+ movaps %xmm3, 16(%edx)
+ movaps %xmm2, (%edx)
+ lea 64(%edx), %edx
+ jmp L(Shl4LoopStart)
+
+L(Shl4LoopExit):
+ movaps (%edx), %xmm6
+ psrldq $12, %xmm6
+ palignr $4, %xmm1, %xmm6
+ movaps %xmm6, (%edx)
+ add $12, %edx
+ add $12, %ecx
+
+ POP (%esi)
+ test %al, %al
+ jz L(ExitHigh)
+ test $0x01, %al
+ jnz L(Exit4)
+ movlpd (%ecx), %xmm0
+ movlpd %xmm0, (%edx)
+ movl %edi, %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(Shl8):
+ movaps -8(%ecx), %xmm1
+ movaps 8(%ecx), %xmm2
+L(Shl8Start):
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %eax
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl8LoopExit)
+
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ movaps 24(%ecx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl8LoopExit)
+
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm2, (%edx)
+ movaps 24(%ecx), %xmm2
+ movaps %xmm3, %xmm1
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl8LoopExit)
+
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ movaps 24(%ecx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl8LoopExit)
+
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ lea 24(%ecx), %ecx
+ lea 16(%edx), %edx
+
+ mov %ecx, %eax
+ and $-0x40, %ecx
+ sub %ecx, %eax
+ lea -8(%ecx), %ecx
+ sub %eax, %edx
+
+ movaps -8(%ecx), %xmm1
+
+L(Shl8LoopStart):
+ movaps 8(%ecx), %xmm2
+ movaps 24(%ecx), %xmm3
+ movaps %xmm3, %xmm6
+ movaps 40(%ecx), %xmm4
+ movaps %xmm4, %xmm7
+ movaps 56(%ecx), %xmm5
+ pminub %xmm2, %xmm6
+ pminub %xmm5, %xmm7
+ pminub %xmm6, %xmm7
+ pcmpeqd %xmm0, %xmm7
+ pmovmskb %xmm7, %eax
+ movaps %xmm5, %xmm7
+ palignr $8, %xmm4, %xmm5
+ test %eax, %eax
+ palignr $8, %xmm3, %xmm4
+ jnz L(Shl8Start)
+
+ palignr $8, %xmm2, %xmm3
+ lea 64(%ecx), %ecx
+ palignr $8, %xmm1, %xmm2
+ movaps %xmm7, %xmm1
+ movaps %xmm5, 48(%edx)
+ movaps %xmm4, 32(%edx)
+ movaps %xmm3, 16(%edx)
+ movaps %xmm2, (%edx)
+ lea 64(%edx), %edx
+ jmp L(Shl8LoopStart)
+
+L(Shl8LoopExit):
+ movaps (%edx), %xmm6
+ psrldq $8, %xmm6
+ palignr $8, %xmm1, %xmm6
+ movaps %xmm6, (%edx)
+ add $8, %edx
+ add $8, %ecx
+
+ POP (%esi)
+ test %al, %al
+ jz L(ExitHigh)
+ test $0x01, %al
+ jnz L(Exit4)
+ movlpd (%ecx), %xmm0
+ movlpd %xmm0, (%edx)
+ movl %edi, %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(Shl12):
+ movaps -12(%ecx), %xmm1
+ movaps 4(%ecx), %xmm2
+L(Shl12Start):
+ pcmpeqd %xmm2, %xmm0
+ pmovmskb %xmm0, %eax
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl12LoopExit)
+
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ movaps 20(%ecx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl12LoopExit)
+
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm2, (%edx)
+ movaps 20(%ecx), %xmm2
+ movaps %xmm3, %xmm1
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl12LoopExit)
+
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ movaps 20(%ecx), %xmm2
+
+ pcmpeqd %xmm2, %xmm0
+ lea 16(%edx), %edx
+ pmovmskb %xmm0, %eax
+ lea 16(%ecx), %ecx
+ movaps %xmm2, %xmm3
+
+ test %eax, %eax
+ jnz L(Shl12LoopExit)
+
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm3, %xmm1
+ movaps %xmm2, (%edx)
+ lea 20(%ecx), %ecx
+ lea 16(%edx), %edx
+
+ mov %ecx, %eax
+ and $-0x40, %ecx
+ sub %ecx, %eax
+ lea -4(%ecx), %ecx
+ sub %eax, %edx
+
+ movaps -12(%ecx), %xmm1
+
+L(Shl12LoopStart):
+ movaps 4(%ecx), %xmm2
+ movaps 20(%ecx), %xmm3
+ movaps %xmm3, %xmm6
+ movaps 36(%ecx), %xmm4
+ movaps %xmm4, %xmm7
+ movaps 52(%ecx), %xmm5
+ pminub %xmm2, %xmm6
+ pminub %xmm5, %xmm7
+ pminub %xmm6, %xmm7
+ pcmpeqd %xmm0, %xmm7
+ pmovmskb %xmm7, %eax
+ movaps %xmm5, %xmm7
+ palignr $12, %xmm4, %xmm5
+ test %eax, %eax
+ palignr $12, %xmm3, %xmm4
+ jnz L(Shl12Start)
+
+ palignr $12, %xmm2, %xmm3
+ lea 64(%ecx), %ecx
+ palignr $12, %xmm1, %xmm2
+ movaps %xmm7, %xmm1
+ movaps %xmm5, 48(%edx)
+ movaps %xmm4, 32(%edx)
+ movaps %xmm3, 16(%edx)
+ movaps %xmm2, (%edx)
+ lea 64(%edx), %edx
+ jmp L(Shl12LoopStart)
+
+L(Shl12LoopExit):
+ movaps (%edx), %xmm6
+ psrldq $4, %xmm6
+ mov $4, %esi
+ palignr $12, %xmm1, %xmm6
+ movaps %xmm6, (%edx)
+
+ .p2align 4
+L(CopyFrom1To16Bytes):
+ add %esi, %edx
+ add %esi, %ecx
+
+ POP (%esi)
+ test %al, %al
+ jz L(ExitHigh)
+ test $0x01, %al
+ jnz L(Exit4)
+ movlpd (%ecx), %xmm0
+ movlpd %xmm0, (%edx)
+ movl %edi, %eax
+ RETURN
+
+ .p2align 4
+L(ExitHigh):
+ test $0x01, %ah
+ jnz L(Exit12)
+ movdqu (%ecx), %xmm0
+ movdqu %xmm0, (%edx)
+ movl %edi, %eax
+ RETURN
+
+ .p2align 4
+L(Exit4):
+ movl (%ecx), %eax
+ movl %eax, (%edx)
+ movl %edi, %eax
+ RETURN
+
+ .p2align 4
+L(Exit12):
+ movlpd (%ecx), %xmm0
+ movlpd %xmm0, (%edx)
+ movl 8(%ecx), %eax
+ movl %eax, 8(%edx)
+ movl %edi, %eax
+ RETURN
+
+CFI_POP (%edi)
+
+ .p2align 4
+L(ExitTail4):
+ movl (%ecx), %eax
+ movl %eax, (%edx)
+ movl %edx, %eax
+ ret
+
+ .p2align 4
+L(ExitTail8):
+ movlpd (%ecx), %xmm0
+ movlpd %xmm0, (%edx)
+ movl %edx, %eax
+ ret
+
+ .p2align 4
+L(ExitTail12):
+ movlpd (%ecx), %xmm0
+ movlpd %xmm0, (%edx)
+ movl 8(%ecx), %eax
+ movl %eax, 8(%edx)
+ movl %edx, %eax
+ ret
+
+ .p2align 4
+L(ExitTail16):
+ movdqu (%ecx), %xmm0
+ movdqu %xmm0, (%edx)
+ movl %edx, %eax
+ ret
+
+END (__wcscpy_ssse3)
+#endif
Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcscpy.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcscpy.S (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcscpy.S Sun Dec 18 00:02:07 2011
@@ -1,0 +1,46 @@
+/* Multiple versions of wcscpy
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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 <init-arch.h>
+
+/* Define multiple versions only for the definition in libc. */
+#ifndef NOT_IN_libc
+ .text
+ENTRY(wcscpy)
+ .type wcscpy, @gnu_indirect_function
+ pushl %ebx
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebx, 0)
+ call __i686.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
+ jne 1f
+ call __init_cpu_features
+1: leal __wcscpy_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSSE3, CPUID_OFFSET+index_SSSE3+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __wcscpy_ssse3@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4)
+ cfi_restore (ebx)
+ ret
+END(wcscpy)
+#endif
Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcsrchr-c.c
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcsrchr-c.c (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcsrchr-c.c Sun Dec 18 00:02:07 2011
@@ -1,0 +1,5 @@
+#ifndef NOT_IN_libc
+# define wcsrchr __wcsrchr_ia32
+#endif
+
+#include "wcsmbs/wcsrchr.c"
Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcsrchr-sse2.S Sun Dec 18 00:02:07 2011
@@ -1,0 +1,355 @@
+/* wcsrchr with SSE2, without using bsf instructions.
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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. */
+
+#ifndef NOT_IN_libc
+# include <sysdep.h>
+# define CFI_PUSH(REG) \
+ cfi_adjust_cfa_offset (4); \
+ cfi_rel_offset (REG, 0)
+
+# define CFI_POP(REG) \
+ cfi_adjust_cfa_offset (-4); \
+ cfi_restore (REG)
+
+# define PUSH(REG) pushl REG; CFI_PUSH (REG)
+# define POP(REG) popl REG; CFI_POP (REG)
+
+# define PARMS 8
+# define ENTRANCE PUSH (%edi);
+# define RETURN POP (%edi); ret; CFI_PUSH (%edi);
+# define STR1 PARMS
+# define STR2 STR1+4
+
+ atom_text_section
+ENTRY (__wcsrchr_sse2)
+
+ ENTRANCE
+ mov STR1(%esp), %ecx
+ movd STR2(%esp), %xmm1
+
+ mov %ecx, %edi
+ punpckldq %xmm1, %xmm1
+ pxor %xmm2, %xmm2
+ punpckldq %xmm1, %xmm1
+
+/* ECX has OFFSET. */
+ and $63, %ecx
+ cmp $48, %ecx
+ ja L(crosscache)
+
+/* unaligned string. */
+ movdqu (%edi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ pcmpeqd %xmm1, %xmm0
+/* Find where NULL is. */
+ pmovmskb %xmm2, %ecx
+/* Check if there is a match. */
+ pmovmskb %xmm0, %eax
+ add $16, %edi
+
+ test %eax, %eax
+ jnz L(unaligned_match1)
+
+ test %ecx, %ecx
+ jnz L(return_null)
+
+ and $-16, %edi
+
+ PUSH (%esi)
+
+ xor %edx, %edx
+ jmp L(loop)
+
+ CFI_POP (%esi)
+
+ .p2align 4
+L(unaligned_match1):
+ test %ecx, %ecx
+ jnz L(prolog_find_zero_1)
+
+ PUSH (%esi)
+
+/* Save current match */
+ mov %eax, %edx
+ mov %edi, %esi
+ and $-16, %edi
+ jmp L(loop)
+
+ CFI_POP (%esi)
+
+ .p2align 4
+L(crosscache):
+/* Hancle unaligned string. */
+ and $15, %ecx
+ and $-16, %edi
+ pxor %xmm3, %xmm3
+ movdqa (%edi), %xmm0
+ pcmpeqd %xmm0, %xmm3
+ pcmpeqd %xmm1, %xmm0
+/* Find where NULL is. */
+ pmovmskb %xmm3, %edx
+/* Check if there is a match. */
+ pmovmskb %xmm0, %eax
+/* Remove the leading bytes. */
+ shr %cl, %edx
+ shr %cl, %eax
+ add $16, %edi
+
+ test %eax, %eax
+ jnz L(unaligned_match)
+
+ test %edx, %edx
+ jnz L(return_null)
+
+ PUSH (%esi)
+
+ xor %edx, %edx
+ jmp L(loop)
+
+ CFI_POP (%esi)
+
+ .p2align 4
+L(unaligned_match):
+ test %edx, %edx
+ jnz L(prolog_find_zero)
+
+ PUSH (%esi)
+
+ mov %eax, %edx
+ lea (%edi, %ecx), %esi
+
+/* Loop start on aligned string. */
+ .p2align 4
+L(loop):
+ movdqa (%edi), %xmm0
+ pcmpeqd %xmm0, %xmm2
+ add $16, %edi
+ pcmpeqd %xmm1, %xmm0
+ pmovmskb %xmm2, %ecx
+ pmovmskb %xmm0, %eax
+ or %eax, %ecx
+ jnz L(matches)
+
+ movdqa (%edi), %xmm3
+ pcmpeqd %xmm3, %xmm2
+ add $16, %edi
+ pcmpeqd %xmm1, %xmm3
+ pmovmskb %xmm2, %ecx
+ pmovmskb %xmm3, %eax
+ or %eax, %ecx
+ jnz L(matches)
+
+ movdqa (%edi), %xmm4
+ pcmpeqd %xmm4, %xmm2
+ add $16, %edi
+ pcmpeqd %xmm1, %xmm4
+ pmovmskb %xmm2, %ecx
+ pmovmskb %xmm4, %eax
+ or %eax, %ecx
+ jnz L(matches)
+
+ movdqa (%edi), %xmm5
+ pcmpeqd %xmm5, %xmm2
+ add $16, %edi
+ pcmpeqd %xmm1, %xmm5
+ pmovmskb %xmm2, %ecx
+ pmovmskb %xmm5, %eax
+ or %eax, %ecx
+ jz L(loop)
+
+ .p2align 4
+L(matches):
+ test %eax, %eax
+ jnz L(match)
+L(return_value):
+ test %edx, %edx
+ jz L(return_null_1)
+ mov %edx, %eax
+ mov %esi, %edi
+
+ POP (%esi)
+
+ test %ah, %ah
+ jnz L(match_third_or_fourth_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(return_null_1):
+ POP (%esi)
+
+ xor %eax, %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(match):
+ pmovmskb %xmm2, %ecx
+ test %ecx, %ecx
+ jnz L(find_zero)
+/* save match info */
+ mov %eax, %edx
+ mov %edi, %esi
+ jmp L(loop)
+
+ .p2align 4
+L(find_zero):
+ test %cl, %cl
+ jz L(find_zero_in_third_or_fourth_wchar)
+ test $15, %cl
+ jz L(find_zero_in_second_wchar)
+ and $1, %eax
+ jz L(return_value)
+
+ POP (%esi)
+
+ lea -16(%edi), %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(find_zero_in_second_wchar):
+ and $1 << 5 - 1, %eax
+ jz L(return_value)
+
+ POP (%esi)
+
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(find_zero_in_third_or_fourth_wchar):
+ test $15, %ch
+ jz L(find_zero_in_fourth_wchar)
+ and $1 << 9 - 1, %eax
+ jz L(return_value)
+
+ POP (%esi)
+
+ test %ah, %ah
+ jnz L(match_third_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(find_zero_in_fourth_wchar):
+
+ POP (%esi)
+
+ test %ah, %ah
+ jnz L(match_third_or_fourth_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+ CFI_PUSH (%esi)
+
+ .p2align 4
+L(match_second_wchar):
+ lea -12(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(match_third_or_fourth_wchar):
+ test $15 << 4, %ah
+ jnz L(match_fourth_wchar)
+ lea -8(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(match_third_wchar):
+ lea -8(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(match_fourth_wchar):
+ lea -4(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(return_null):
+ xor %eax, %eax
+ RETURN
+
+ .p2align 4
+L(prolog_find_zero):
+ add %ecx, %edi
+ mov %edx, %ecx
+L(prolog_find_zero_1):
+ test %cl, %cl
+ jz L(prolog_find_zero_in_third_or_fourth_wchar)
+ test $15, %cl
+ jz L(prolog_find_zero_in_second_wchar)
+ and $1, %eax
+ jz L(return_null)
+
+ lea -16(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(prolog_find_zero_in_second_wchar):
+ and $1 << 5 - 1, %eax
+ jz L(return_null)
+
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(prolog_find_zero_in_third_or_fourth_wchar):
+ test $15, %ch
+ jz L(prolog_find_zero_in_fourth_wchar)
+ and $1 << 9 - 1, %eax
+ jz L(return_null)
+
+ test %ah, %ah
+ jnz L(match_third_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+ .p2align 4
+L(prolog_find_zero_in_fourth_wchar):
+ test %ah, %ah
+ jnz L(match_third_or_fourth_wchar)
+ test $15 << 4, %al
+ jnz L(match_second_wchar)
+ lea -16(%edi), %eax
+ RETURN
+
+END (__wcsrchr_sse2)
+#endif
Added: fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcsrchr.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcsrchr.S (added)
+++ fsf/trunk/libc/sysdeps/i386/i686/multiarch/wcsrchr.S Sun Dec 18 00:02:07 2011
@@ -1,0 +1,54 @@
+/* Multiple versions of wcsrchr
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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 <init-arch.h>
+
+#ifndef NOT_IN_libc
+ .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits
+ .globl __i686.get_pc_thunk.bx
+ .hidden __i686.get_pc_thunk.bx
+ .p2align 4
+ .type __i686.get_pc_thunk.bx,@function
+__i686.get_pc_thunk.bx:
+ movl (%esp), %ebx
+ ret
+
+ .text
+ENTRY(wcsrchr)
+ .type wcsrchr, @gnu_indirect_function
+ pushl %ebx
+ cfi_adjust_cfa_offset (4)
+ cfi_rel_offset (ebx, 0)
+ call __i686.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ cmpl $0, KIND_OFFSET+__cpu_features@GOTOFF(%ebx)
+ jne 1f
+ call __init_cpu_features
+1: leal __wcsrchr_ia32@GOTOFF(%ebx), %eax
+ testl $bit_SSE2, CPUID_OFFSET+index_SSE2+__cpu_features@GOTOFF(%ebx)
+ jz 2f
+ leal __wcsrchr_sse2@GOTOFF(%ebx), %eax
+2: popl %ebx
+ cfi_adjust_cfa_offset (-4);
+ cfi_restore (ebx)
+ ret
+END(wcsrchr)
+#endif
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/a2/memcpy.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/a2/memcpy.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/a2/memcpy.S Sun Dec 18 00:02:07 2011
@@ -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@xxxxxxxxxx>.
This file is part of the GNU C Library.
@@ -113,11 +113,9 @@
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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-start.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-start.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/dl-start.S Sun Dec 18 00:02:07 2011
@@ -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 @@
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. */
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/elf/start.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/elf/start.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/elf/start.S Sun Dec 18 00:02:07 2011
@@ -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 @@
/* 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 @@
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)
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S Sun Dec 18 00:02:07 2011
@@ -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 @@
# 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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_ceil.S Sun Dec 18 00:02:07 2011
@@ -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 @@
#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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S Sun Dec 18 00:02:07 2011
@@ -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 @@
#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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_floor.S Sun Dec 18 00:02:07 2011
@@ -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 @@
#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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_floorf.S Sun Dec 18 00:02:07 2011
@@ -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 @@
#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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_lround.S Sun Dec 18 00:02:07 2011
@@ -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 @@
#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
Added: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S Sun Dec 18 00:02:07 2011
@@ -1,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@xxxxxxxxxx>, 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
Added: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_nearbyintf.S Sun Dec 18 00:02:07 2011
@@ -1,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@xxxxxxxxxx>, 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)
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_rint.S Sun Dec 18 00:02:07 2011
@@ -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 @@
#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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_rintf.S Sun Dec 18 00:02:07 2011
@@ -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 @@
#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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_round.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_round.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_round.S Sun Dec 18 00:02:07 2011
@@ -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 @@
#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)
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_roundf.S Sun Dec 18 00:02:07 2011
@@ -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 @@
#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)
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_trunc.S Sun Dec 18 00:02:07 2011
@@ -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 @@
#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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/s_truncf.S Sun Dec 18 00:02:07 2011
@@ -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 @@
#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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S Sun Dec 18 00:02:07 2011
@@ -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 @@
# 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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/memset.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/memset.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/memset.S Sun Dec 18 00:02:07 2011
@@ -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 @@
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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S Sun Dec 18 00:02:07 2011
@@ -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 @@
#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)
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S Sun Dec 18 00:02:07 2011
@@ -63,11 +63,9 @@
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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S Sun Dec 18 00:02:07 2011
@@ -63,11 +63,9 @@
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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S Sun Dec 18 00:02:07 2011
@@ -63,11 +63,9 @@
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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S Sun Dec 18 00:02:07 2011
@@ -63,11 +63,9 @@
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
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S Sun Dec 18 00:02:07 2011
@@ -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@xxxxxxxxxx>.
This file is part of the GNU C Library.
@@ -35,10 +35,9 @@
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)
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S Sun Dec 18 00:02:07 2011
@@ -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@xxxxxxxxxx>.
This file is part of the GNU C Library.
@@ -35,10 +35,9 @@
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)
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S Sun Dec 18 00:02:07 2011
@@ -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@xxxxxxxxxx>.
This file is part of the GNU C Library.
@@ -35,10 +35,9 @@
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)
Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc32/sysdep.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/sysdep.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/sysdep.h Sun Dec 18 00:02:07 2011
@@ -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
@@ -45,6 +46,13 @@
C_LABEL(name) \
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
Added: fsf/trunk/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S Sun Dec 18 00:02:07 2011
@@ -1,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@xxxxxxxxxx>, 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
Added: fsf/trunk/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S Sun Dec 18 00:02:07 2011
@@ -1,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@xxxxxxxxxx>, 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)
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S Sun Dec 18 00:02:07 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Free Software Foundation, Inc.
+/* Copyright (C) 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
@@ -29,10 +29,9 @@
#ifdef PIC
# define LOAD_ARG \
- bcl 20,31,1f; \
-1: mflr r3; \
- addis r3,r3,_GLOBAL_OFFSET_TABLE_-1b@ha; \
- addi r3,r3,_GLOBAL_OFFSET_TABLE_-1b@l; \
+ SETUP_GOT_ACCESS(r3,got_label2); \
+ addis r3,r3,_GLOBAL_OFFSET_TABLE_-got_label2@ha; \
+ addi r3,r3,_GLOBAL_OFFSET_TABLE_-got_label2@l; \
lwz r3,.LC0@got(r3)
#else
# define LOAD_ARG \
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S Sun Dec 18 00:02:07 2011
@@ -1,5 +1,5 @@
/* brk system call for Linux/ppc.
- Copyright (C) 1995-97, 1999, 2000, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995-97, 1999, 2000, 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
@@ -36,10 +36,9 @@
DO_CALL(SYS_ify(brk))
lwz r6,8(r1)
#ifdef PIC
- bcl 20,31,1f
-1: mflr r5
- addis r5,r5,__curbrk-1b@ha
- stw r3,__curbrk-1b@l(r5)
+ SETUP_GOT_ACCESS(r5,got_label)
+ addis r5,r5,__curbrk-got_label@ha
+ stw r3,__curbrk-got_label@l(r5)
#else
lis r4,__curbrk@ha
stw r3,__curbrk@l(r4)
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S Sun Dec 18 00:02:07 2011
@@ -1,5 +1,5 @@
/* Save current context, powerpc32 common.
- Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -145,10 +145,9 @@
# ifdef __CONTEXT_ENABLE_VRS
# ifdef PIC
mflr r8
- bcl 20,31,1f
-1: mflr r7
- addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
- addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+ SETUP_GOT_ACCESS(r7,got_label)
+ addis r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@l
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S Sun Dec 18 00:02:07 2011
@@ -1,5 +1,5 @@
/* Jump to a new context powerpc32 common.
- Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2008, 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
@@ -73,10 +73,9 @@
#ifdef PIC
mflr r8
- bcl 20,31,1f
-1: mflr r7
- addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
- addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+ SETUP_GOT_ACCESS(r7,got_label)
+ addis r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@l
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S Sun Dec 18 00:02:07 2011
@@ -1,5 +1,5 @@
/* Save current context and jump to a new context.
- Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2008, 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
@@ -146,10 +146,9 @@
# ifdef PIC
mflr r8
- bcl 20,31,1f
-1: mflr r7
- addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
- addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
+ SETUP_GOT_ACCESS(r7,got_label)
+ addis r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@l
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
@@ -299,10 +298,9 @@
# ifdef PIC
mflr r8
# ifdef HAVE_ASM_PPC_REL16
- bcl 20,31,5f
-5: mflr r7
- addis r7,r7,_GLOBAL_OFFSET_TABLE_-5b@ha
- addi r7,r7,_GLOBAL_OFFSET_TABLE_-5b@l
+ SETUP_GOT_ACCESS(r7,got_label)
+ addis r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r7,r7,_GLOBAL_OFFSET_TABLE_-got_label@l
# else
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr r7
Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/Makefile (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/Makefile Sun Dec 18 00:02:07 2011
@@ -16,7 +16,7 @@
strcat-sse2-unaligned strncat-sse2-unaligned \
strcat-ssse3 strncat-ssse3 strlen-sse2-pminub \
strnlen-sse2-no-bsf strrchr-sse2-no-bsf strchr-sse2-no-bsf \
- memcmp-ssse3 wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c
+ memcmp-ssse3
ifeq (yes,$(config-cflags-sse4))
sysdep_routines += strcspn-c strpbrk-c strspn-c strstr-c strcasestr-c varshift
CFLAGS-varshift.c += -msse4
@@ -28,3 +28,7 @@
CFLAGS-strcasestr-nonascii.c += -msse4
endif
endif
+
+ifeq ($(subdir),wcsmbs)
+sysdep_routines += wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c wcscpy-ssse3 wcscpy-c
+endif
Added: fsf/trunk/libc/sysdeps/x86_64/multiarch/wcscpy-c.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/wcscpy-c.c (added)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/wcscpy-c.c Sun Dec 18 00:02:07 2011
@@ -1,0 +1,5 @@
+#ifndef NOT_IN_libc
+# define wcscpy __wcscpy_sse2
+#endif
+
+#include "wcsmbs/wcscpy.c"
Added: fsf/trunk/libc/sysdeps/x86_64/multiarch/wcscpy-ssse3.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/wcscpy-ssse3.S (added)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/wcscpy-ssse3.S Sun Dec 18 00:02:07 2011
@@ -1,0 +1,565 @@
+/* wcscpy with SSSE3
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Intel Corporation.
+ 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. */
+
+#ifndef NOT_IN_libc
+# include <sysdep.h>
+
+.text
+ENTRY (__wcscpy_ssse3)
+ mov %rsi, %rcx
+ mov %rdi, %rdx
+
+ cmpl $0, (%rcx)
+ jz L(Exit4)
+ cmpl $0, 4(%rcx)
+ jz L(Exit8)
+ cmpl $0, 8(%rcx)
+ jz L(Exit12)
+ cmpl $0, 12(%rcx)
+ jz L(Exit16)
+
[... 1076 lines stripped ...]
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits