This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.14-458-gfd52bc6


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  fd52bc6dc4bfb844995cc63d98682970de1c9fed (commit)
      from  a5b81e1fb7c6a5e323785598767460fe040ca778 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=fd52bc6dc4bfb844995cc63d98682970de1c9fed

commit fd52bc6dc4bfb844995cc63d98682970de1c9fed
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Fri Oct 28 18:18:04 2011 -0400

    Clean up x86-64 strcasestr
    
    Actually describe in the C code what is going on.

diff --git a/ChangeLog b/ChangeLog
index bd571c2..feb3567 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-10-28  Ulrich Drepper  <drepper@gmail.com>
 
+	* sysdeps/x86_64/multiarch/strstr.c (__m128i_strloadu_tolower): Take
+	the three constants needed as parameters.  Drop the others.
+	(strcasestr_sse42): Load uclow, uchigh, and lcqword and pass to
+	__m128i_strloadu_tolower.
+
 	* sysdeps/x86_64/fpu/multiarch/Makefile: Don't build brandred-avx.c,
 	doasin-avx.c, dosincos-avx.c, e_asin-avx.c, mpatan-avx.c,
 	mpatan2-avx.c, mpsqrt-avx.c, mptan-avx.c, sincos32-avx.c.
diff --git a/sysdeps/x86_64/multiarch/strstr.c b/sysdeps/x86_64/multiarch/strstr.c
index b408b75..6e93744 100644
--- a/sysdeps/x86_64/multiarch/strstr.c
+++ b/sysdeps/x86_64/multiarch/strstr.c
@@ -1,5 +1,5 @@
 /* strstr with SSE4.2 intrinsics
-   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
    Contributed by Intel Corporation.
    This file is part of the GNU C Library.
 
@@ -106,24 +106,22 @@ __m128i_strloadu (const unsigned char * p)
 #if defined USE_AS_STRCASESTR && !defined STRCASESTR_NONASCII
 
 /* Similar to __m128i_strloadu.  Convert to lower case for POSIX/C
-   locale.  */
+   locale and other which have single-byte letters only in the ASCII
+   range.  */
 static inline __m128i
-__m128i_strloadu_tolower (const unsigned char *p, __m128i rangeuc,
-			  __m128i u2ldelta)
+__m128i_strloadu_tolower (const unsigned char *p, __m128i uclow,
+			  __m128i uchigh, __m128i lcqword)
 {
   __m128i frag = __m128i_strloadu (p);
 
-#define UCLOW 0x4040404040404040ULL
-#define UCHIGH 0x5b5b5b5b5b5b5b5bULL
-#define LCQWORD 0x2020202020202020ULL
   /* Compare if 'Z' > bytes. Inverted way to get a mask for byte <= 'Z'.  */
-  __m128i r2 = _mm_cmpgt_epi8 (_mm_set1_epi64x (UCHIGH), frag);
+  __m128i r2 = _mm_cmpgt_epi8 (uchigh, frag);
   /* Compare if bytes are > 'A' - 1.  */
-  __m128i r1 = _mm_cmpgt_epi8 (frag, _mm_set1_epi64x (UCLOW));
+  __m128i r1 = _mm_cmpgt_epi8 (frag, uclow);
   /* Mask byte == ff if byte(r2) <= 'Z' and byte(r1) > 'A' - 1.  */
   __m128i mask = _mm_and_si128 (r2, r1);
   /* Apply lowercase bit 6 mask for above mask bytes == ff.  */
-  return _mm_or_si128 (frag, _mm_and_si128 (mask, _mm_set1_epi64x (LCQWORD)));
+  return _mm_or_si128 (frag, _mm_and_si128 (mask, lcqword));
 }
 
 #endif
@@ -190,9 +188,10 @@ STRSTR_SSE42 (const unsigned char *s1, const unsigned char *s2)
 			!= 0, 0))
     return __strcasestr_sse42_nonascii (s1, s2);
 
-  const __m128i rangeuc = _mm_set_epi64x (0x0, 0x5a41);
-  const __m128i u2ldelta = _mm_set1_epi64x (0xe0e0e0e0e0e0e0e0);
-#  define strloadu(p) __m128i_strloadu_tolower (p, rangeuc, u2ldelta)
+  const __m128i uclow = _mm_set1_epi8 (0x40);
+  const __m128i uchigh = _mm_set1_epi8 (0x5b);
+  const __m128i lcqword = _mm_set1_epi8 (0x20);
+#  define strloadu(p) __m128i_strloadu_tolower (p, uclow, uchigh, lcqword)
 # else
 #  define strloadu __m128i_strloadu_tolower
 # endif

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                         |    5 +++++
 sysdeps/x86_64/multiarch/strstr.c |   25 ++++++++++++-------------
 2 files changed, 17 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]