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 hjl/ifunc/c updated. glibc-2.25-464-ge73ee67


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, hjl/ifunc/c has been updated
       via  e73ee6709d22cae001822cbee223428894e061dd (commit)
       via  fb146e449da5d1b5bdb278aeea1fd9cadbe7a5b3 (commit)
       via  421a1b5376b358e377520d982f5b194c5ac18f08 (commit)
      from  fb3d0118f65ab97f74247582d6eacce142583a58 (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://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e73ee6709d22cae001822cbee223428894e061dd

commit e73ee6709d22cae001822cbee223428894e061dd
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jun 13 06:34:16 2017 -0700

    Simplify strcmp SSE4.2

diff --git a/sysdeps/x86_64/multiarch/strcasecmp_l-avx.S b/sysdeps/x86_64/multiarch/strcasecmp_l-avx.S
index 6182fb7..040eeed 100644
--- a/sysdeps/x86_64/multiarch/strcasecmp_l-avx.S
+++ b/sysdeps/x86_64/multiarch/strcasecmp_l-avx.S
@@ -18,10 +18,6 @@
 
 #define STRCMP_SSE42		__strcasecmp_l_avx
 
-#define UPDATE_STRNCMP_COUNTER
-
 #define USE_AVX			1
 #define USE_AS_STRCASECMP_L
-#define NO_NOLOCALE_ALIAS
-#include "locale-defines.h"
 #include "strcmp-sse42.S"
diff --git a/sysdeps/x86_64/multiarch/strcasecmp_l-sse42.S b/sysdeps/x86_64/multiarch/strcasecmp_l-sse42.S
index 1b94df0..d6a0176 100644
--- a/sysdeps/x86_64/multiarch/strcasecmp_l-sse42.S
+++ b/sysdeps/x86_64/multiarch/strcasecmp_l-sse42.S
@@ -18,9 +18,5 @@
 
 #define STRCMP_SSE42		__strcasecmp_l_sse42
 
-#define UPDATE_STRNCMP_COUNTER
-
 #define USE_AS_STRCASECMP_L
-#define NO_NOLOCALE_ALIAS
-#include "locale-defines.h"
 #include "strcmp-sse42.S"
diff --git a/sysdeps/x86_64/multiarch/strcmp-avx.S b/sysdeps/x86_64/multiarch/strcmp-avx.S
index 978aee3..51425f6 100644
--- a/sysdeps/x86_64/multiarch/strcmp-avx.S
+++ b/sysdeps/x86_64/multiarch/strcmp-avx.S
@@ -16,8 +16,6 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define UPDATE_STRNCMP_COUNTER	
-
 #define STRCMP_SSE42		__strcmp_avx
 
 #define USE_AVX			1
diff --git a/sysdeps/x86_64/multiarch/strcmp-sse42.S b/sysdeps/x86_64/multiarch/strcmp-sse42.S
index 6db38d6..4aeb14e 100644
--- a/sysdeps/x86_64/multiarch/strcmp-sse42.S
+++ b/sysdeps/x86_64/multiarch/strcmp-sse42.S
@@ -21,6 +21,24 @@
 
 #ifndef STRCMP_SSE42
 # define STRCMP_SSE42	__strcmp_sse42
+#endif
+
+#if defined USE_AS_STRCASECMP_L || defined USE_AS_STRNCASECMP_L
+# include "locale-defines.h"
+#endif
+
+#if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
+/* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
+   if the new counter > the old one or is 0.  */
+# define UPDATE_STRNCMP_COUNTER				\
+	/* calculate left number to compare */		\
+	lea	-16(%rcx, %r11), %r9;			\
+	cmp	%r9, %r11;				\
+	jb	LABEL(strcmp_exitz);			\
+	test	%r9, %r9;				\
+	je	LABEL(strcmp_exitz);			\
+	mov	%r9, %r11
+#else
 # define UPDATE_STRNCMP_COUNTER
 #endif
 
diff --git a/sysdeps/x86_64/multiarch/strncase_l-avx.S b/sysdeps/x86_64/multiarch/strncase_l-avx.S
index 9ed01e7..f7043b3 100644
--- a/sysdeps/x86_64/multiarch/strncase_l-avx.S
+++ b/sysdeps/x86_64/multiarch/strncase_l-avx.S
@@ -16,21 +16,8 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
-   if the new counter > the old one or is 0.  */
-#define UPDATE_STRNCMP_COUNTER				\
-	/* calculate left number to compare */		\
-	lea	-16(%rcx, %r11), %r9;			\
-	cmp	%r9, %r11;				\
-	jb	LABEL(strcmp_exitz);			\
-	test	%r9, %r9;				\
-	je	LABEL(strcmp_exitz);			\
-	mov	%r9, %r11
-
 #define STRCMP_SSE42		__strncasecmp_l_avx
 
 #define USE_AVX			1
 #define USE_AS_STRNCASECMP_L
-#define NO_NOLOCALE_ALIAS
-#include "locale-defines.h"
 #include "strcmp-sse42.S"
diff --git a/sysdeps/x86_64/multiarch/strncase_l-sse42.S b/sysdeps/x86_64/multiarch/strncase_l-sse42.S
index 3b9b8c3..0b8e7ee 100644
--- a/sysdeps/x86_64/multiarch/strncase_l-sse42.S
+++ b/sysdeps/x86_64/multiarch/strncase_l-sse42.S
@@ -17,21 +17,8 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
-/* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
-   if the new counter > the old one or is 0.  */
-# define UPDATE_STRNCMP_COUNTER				\
-	/* calculate left number to compare */		\
-	lea	-16(%rcx, %r11), %r9;			\
-	cmp	%r9, %r11;				\
-	jb	LABEL(strcmp_exitz);			\
-	test	%r9, %r9;				\
-	je	LABEL(strcmp_exitz);			\
-	mov	%r9, %r11
-
 # define STRCMP_SSE42		__strncasecmp_l_sse42
 
 # define USE_AS_STRNCASECMP_L
-# define NO_NOLOCALE_ALIAS
-# include "locale-defines.h"
 # include "strcmp-sse42.S"
 #endif
diff --git a/sysdeps/x86_64/multiarch/strncmp-avx.S b/sysdeps/x86_64/multiarch/strncmp-avx.S
index 4375aa4..ac65cae 100644
--- a/sysdeps/x86_64/multiarch/strncmp-avx.S
+++ b/sysdeps/x86_64/multiarch/strncmp-avx.S
@@ -16,17 +16,6 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
-   if the new counter > the old one or is 0.  */
-#define UPDATE_STRNCMP_COUNTER				\
-	/* calculate left number to compare */		\
-	lea	-16(%rcx, %r11), %r9;			\
-	cmp	%r9, %r11;				\
-	jb	LABEL(strcmp_exitz);			\
-	test	%r9, %r9;				\
-	je	LABEL(strcmp_exitz);			\
-	mov	%r9, %r11
-
 #define STRCMP_SSE42		__strncmp_avx
 
 #define USE_AVX			1
diff --git a/sysdeps/x86_64/multiarch/strncmp-sse42.S b/sysdeps/x86_64/multiarch/strncmp-sse42.S
index 25a2cff..d8c1622 100644
--- a/sysdeps/x86_64/multiarch/strncmp-sse42.S
+++ b/sysdeps/x86_64/multiarch/strncmp-sse42.S
@@ -17,17 +17,6 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
-/* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
-   if the new counter > the old one or is 0.  */
-# define UPDATE_STRNCMP_COUNTER				\
-	/* calculate left number to compare */		\
-	lea	-16(%rcx, %r11), %r9;			\
-	cmp	%r9, %r11;				\
-	jb	LABEL(strcmp_exitz);			\
-	test	%r9, %r9;				\
-	je	LABEL(strcmp_exitz);			\
-	mov	%r9, %r11
-
 # define STRCMP_SSE42	__strncmp_sse42
 
 # define USE_AS_STRNCMP

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=fb146e449da5d1b5bdb278aeea1fd9cadbe7a5b3

commit fb146e449da5d1b5bdb278aeea1fd9cadbe7a5b3
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jun 13 06:19:13 2017 -0700

    Add strcmp-avx.S

diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile
index 543dec7..f5cefa0 100644
--- a/sysdeps/x86_64/multiarch/Makefile
+++ b/sysdeps/x86_64/multiarch/Makefile
@@ -6,7 +6,7 @@ ifeq ($(subdir),string)
 
 sysdep_routines += strncat-c stpncpy-c strncpy-c \
 		   strcmp-sse2 strcmp-sse2-unaligned strcmp-ssse3  \
-		   strcmp-sse4_2 \
+		   strcmp-sse4_2 strcmp-avx \
 		   strncmp-sse2 strncmp-ssse3 strncmp-sse42 strncmp-avx \
 		   memchr-sse2 rawmemchr-sse2 memchr-avx2 rawmemchr-avx2 \
 		   memrchr-sse2 memrchr-avx2 \
diff --git a/sysdeps/x86_64/multiarch/ifunc-impl-list.c b/sysdeps/x86_64/multiarch/ifunc-impl-list.c
index b3df41d..90674c7 100644
--- a/sysdeps/x86_64/multiarch/ifunc-impl-list.c
+++ b/sysdeps/x86_64/multiarch/ifunc-impl-list.c
@@ -264,6 +264,9 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 
   /* Support sysdeps/x86_64/multiarch/strcmp.S.  */
   IFUNC_IMPL (i, name, strcmp,
+	      IFUNC_IMPL_ADD (array, i, strcmp,
+			      HAS_ARCH_FEATURE (AVX_Usable),
+			      __strcmp_avx)
 	      IFUNC_IMPL_ADD (array, i, strcmp, HAS_CPU_FEATURE (SSE4_2),
 			      __strcmp_sse42)
 	      IFUNC_IMPL_ADD (array, i, strcmp, HAS_CPU_FEATURE (SSSE3),
diff --git a/sysdeps/x86_64/multiarch/strncmp-avx.S b/sysdeps/x86_64/multiarch/strcmp-avx.S
similarity index 63%
copy from sysdeps/x86_64/multiarch/strncmp-avx.S
copy to sysdeps/x86_64/multiarch/strcmp-avx.S
index bdd6c2e..978aee3 100644
--- a/sysdeps/x86_64/multiarch/strncmp-avx.S
+++ b/sysdeps/x86_64/multiarch/strcmp-avx.S
@@ -1,4 +1,4 @@
-/* strncmp optimized with AVX.
+/* strcmp optimized with AVX.
    Copyright (C) 2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -16,21 +16,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-/* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
-   if the new counter > the old one or is 0.  */
-# define UPDATE_STRNCMP_COUNTER				\
-	/* calculate left number to compare */		\
-	lea	-16(%rcx, %r11), %r9;			\
-	cmp	%r9, %r11;				\
-	jb	LABEL(strcmp_exitz);			\
-	test	%r9, %r9;				\
-	je	LABEL(strcmp_exitz);			\
-	mov	%r9, %r11
+#define UPDATE_STRNCMP_COUNTER	
 
-#define STRCMP_SSE42		__strncmp_avx
+#define STRCMP_SSE42		__strcmp_avx
 
 #define USE_AVX			1
-#define USE_AS_STRNCMP
-#define NO_NOLOCALE_ALIAS
-#include "locale-defines.h"
 #include "strcmp-sse42.S"
diff --git a/sysdeps/x86_64/multiarch/strcmp.c b/sysdeps/x86_64/multiarch/strcmp.c
index 2cad895..0f63527 100644
--- a/sysdeps/x86_64/multiarch/strcmp.c
+++ b/sysdeps/x86_64/multiarch/strcmp.c
@@ -30,12 +30,16 @@ extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2) attribute_hidden;
 extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2_unaligned) attribute_hidden;
 extern __typeof (REDIRECT_NAME) OPTIMIZE (ssse3) attribute_hidden;
 extern __typeof (REDIRECT_NAME) OPTIMIZE (sse42) attribute_hidden;
+extern __typeof (REDIRECT_NAME) OPTIMIZE (avx) attribute_hidden;
 
 static inline void *
 IFUNC_SELECTOR (void)
 {
   const struct cpu_features* cpu_features = __get_cpu_features ();
 
+  if (CPU_FEATURES_ARCH_P (cpu_features, AVX_Usable))
+    return OPTIMIZE (avx);
+
   if (CPU_FEATURES_CPU_P (cpu_features, SSE4_2)
       && !CPU_FEATURES_ARCH_P (cpu_features, Slow_SSE4_2))
     return OPTIMIZE (sse42);
diff --git a/sysdeps/x86_64/multiarch/strncmp-avx.S b/sysdeps/x86_64/multiarch/strncmp-avx.S
index bdd6c2e..4375aa4 100644
--- a/sysdeps/x86_64/multiarch/strncmp-avx.S
+++ b/sysdeps/x86_64/multiarch/strncmp-avx.S
@@ -18,7 +18,7 @@
 
 /* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
    if the new counter > the old one or is 0.  */
-# define UPDATE_STRNCMP_COUNTER				\
+#define UPDATE_STRNCMP_COUNTER				\
 	/* calculate left number to compare */		\
 	lea	-16(%rcx, %r11), %r9;			\
 	cmp	%r9, %r11;				\
@@ -31,6 +31,4 @@
 
 #define USE_AVX			1
 #define USE_AS_STRNCMP
-#define NO_NOLOCALE_ALIAS
-#include "locale-defines.h"
 #include "strcmp-sse42.S"

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=421a1b5376b358e377520d982f5b194c5ac18f08

commit 421a1b5376b358e377520d982f5b194c5ac18f08
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Jun 13 06:13:19 2017 -0700

    Add strncmp-avx.S

diff --git a/sysdeps/x86_64/multiarch/Makefile b/sysdeps/x86_64/multiarch/Makefile
index 08b61ec..543dec7 100644
--- a/sysdeps/x86_64/multiarch/Makefile
+++ b/sysdeps/x86_64/multiarch/Makefile
@@ -7,7 +7,7 @@ ifeq ($(subdir),string)
 sysdep_routines += strncat-c stpncpy-c strncpy-c \
 		   strcmp-sse2 strcmp-sse2-unaligned strcmp-ssse3  \
 		   strcmp-sse4_2 \
-		   strncmp-sse2 strncmp-ssse3 strncmp-sse42 \
+		   strncmp-sse2 strncmp-ssse3 strncmp-sse42 strncmp-avx \
 		   memchr-sse2 rawmemchr-sse2 memchr-avx2 rawmemchr-avx2 \
 		   memrchr-sse2 memrchr-avx2 \
 		   memcmp-sse2 \
diff --git a/sysdeps/x86_64/multiarch/ifunc-impl-list.c b/sysdeps/x86_64/multiarch/ifunc-impl-list.c
index 7912dd0..b3df41d 100644
--- a/sysdeps/x86_64/multiarch/ifunc-impl-list.c
+++ b/sysdeps/x86_64/multiarch/ifunc-impl-list.c
@@ -529,6 +529,9 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 
   /* Support sysdeps/x86_64/multiarch/strncmp.S.  */
   IFUNC_IMPL (i, name, strncmp,
+	      IFUNC_IMPL_ADD (array, i, strncmp,
+			      HAS_ARCH_FEATURE (AVX_Usable),
+			      __strncmp_avx)
 	      IFUNC_IMPL_ADD (array, i, strncmp, HAS_CPU_FEATURE (SSE4_2),
 			      __strncmp_sse42)
 	      IFUNC_IMPL_ADD (array, i, strncmp, HAS_CPU_FEATURE (SSSE3),
diff --git a/sysdeps/x86_64/multiarch/strncmp-avx.S b/sysdeps/x86_64/multiarch/strncmp-avx.S
new file mode 100644
index 0000000..bdd6c2e
--- /dev/null
+++ b/sysdeps/x86_64/multiarch/strncmp-avx.S
@@ -0,0 +1,36 @@
+/* strncmp optimized with AVX.
+   Copyright (C) 2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Since the counter, %r11, is unsigned, we branch to strcmp_exitz
+   if the new counter > the old one or is 0.  */
+# define UPDATE_STRNCMP_COUNTER				\
+	/* calculate left number to compare */		\
+	lea	-16(%rcx, %r11), %r9;			\
+	cmp	%r9, %r11;				\
+	jb	LABEL(strcmp_exitz);			\
+	test	%r9, %r9;				\
+	je	LABEL(strcmp_exitz);			\
+	mov	%r9, %r11
+
+#define STRCMP_SSE42		__strncmp_avx
+
+#define USE_AVX			1
+#define USE_AS_STRNCMP
+#define NO_NOLOCALE_ALIAS
+#include "locale-defines.h"
+#include "strcmp-sse42.S"
diff --git a/sysdeps/x86_64/multiarch/strncmp.c b/sysdeps/x86_64/multiarch/strncmp.c
index 1457d42..a8a5245 100644
--- a/sysdeps/x86_64/multiarch/strncmp.c
+++ b/sysdeps/x86_64/multiarch/strncmp.c
@@ -24,26 +24,7 @@
 # undef strncmp
 
 # define SYMBOL_NAME strncmp
-# include <init-arch.h>
-
-extern __typeof (REDIRECT_NAME) OPTIMIZE (sse2) attribute_hidden;
-extern __typeof (REDIRECT_NAME) OPTIMIZE (ssse3) attribute_hidden;
-extern __typeof (REDIRECT_NAME) OPTIMIZE (sse42) attribute_hidden;
-
-static inline void *
-IFUNC_SELECTOR (void)
-{
-  const struct cpu_features* cpu_features = __get_cpu_features ();
-
-  if (CPU_FEATURES_CPU_P (cpu_features, SSE4_2)
-      && !CPU_FEATURES_ARCH_P (cpu_features, Slow_SSE4_2))
-    return OPTIMIZE (sse42);
-
-  if (CPU_FEATURES_CPU_P (cpu_features, SSSE3))
-    return OPTIMIZE (ssse3);
-
-  return OPTIMIZE (sse2);
-}
+# include "ifunc-strcasecmp.h"
 
 libc_ifunc_redirected (__redirect_strncmp, strncmp, IFUNC_SELECTOR ());
 

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

Summary of changes:
 sysdeps/x86_64/multiarch/Makefile                  |    4 +-
 sysdeps/x86_64/multiarch/ifunc-impl-list.c         |    6 +++++
 sysdeps/x86_64/multiarch/strcasecmp_l-avx.S        |    4 ---
 sysdeps/x86_64/multiarch/strcasecmp_l-sse42.S      |    4 ---
 .../multiarch/{strlen-sse2.S => strcmp-avx.S}      |    9 +++----
 sysdeps/x86_64/multiarch/strcmp-sse42.S            |   18 +++++++++++++++++
 sysdeps/x86_64/multiarch/strcmp.c                  |    4 +++
 sysdeps/x86_64/multiarch/strncase_l-avx.S          |   13 ------------
 sysdeps/x86_64/multiarch/strncase_l-sse42.S        |   13 ------------
 .../ipc_priv.h => x86_64/multiarch/strncmp-avx.S}  |    8 ++++--
 sysdeps/x86_64/multiarch/strncmp-sse42.S           |   11 ----------
 sysdeps/x86_64/multiarch/strncmp.c                 |   21 +-------------------
 12 files changed, 40 insertions(+), 75 deletions(-)
 copy sysdeps/x86_64/multiarch/{strlen-sse2.S => strcmp-avx.S} (87%)
 copy sysdeps/{unix/sysv/linux/hppa/ipc_priv.h => x86_64/multiarch/strncmp-avx.S} (85%)


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]