[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r8583 - in /fsf/trunk/libc: ./ elf/ po/ string/ sysdeps/x86_64/multiarch/
- To: commits@xxxxxxxxxx
- Subject: [commits] r8583 - in /fsf/trunk/libc: ./ elf/ po/ string/ sysdeps/x86_64/multiarch/
- From: eglibc@xxxxxxxxxx
- Date: Tue, 23 Jun 2009 07:07:38 -0000
Author: eglibc
Date: Tue Jun 23 00:07:36 2009
New Revision: 8583
Log:
Import glibc-mainline for 2009-06-23
Added:
fsf/trunk/libc/elf/ifuncdep5.c
fsf/trunk/libc/elf/ifuncdep5pic.c
fsf/trunk/libc/elf/ifuncmain1staticpie.c
fsf/trunk/libc/elf/ifuncmain5.c
fsf/trunk/libc/elf/ifuncmain5pic.c
fsf/trunk/libc/elf/ifuncmain5picstatic.c
fsf/trunk/libc/elf/ifuncmain5pie.c
fsf/trunk/libc/elf/ifuncmain5static.c
fsf/trunk/libc/elf/ifuncmain5staticpic.c
fsf/trunk/libc/elf/ifuncmain6pie.c
fsf/trunk/libc/elf/ifuncmain7.c
fsf/trunk/libc/elf/ifuncmain7pic.c
fsf/trunk/libc/elf/ifuncmain7picstatic.c
fsf/trunk/libc/elf/ifuncmain7pie.c
fsf/trunk/libc/elf/ifuncmain7static.c
fsf/trunk/libc/elf/ifuncmod5.c
fsf/trunk/libc/elf/ifuncmod6.c
fsf/trunk/libc/sysdeps/x86_64/multiarch/strcmp.S
fsf/trunk/libc/sysdeps/x86_64/multiarch/strncmp-c.c
fsf/trunk/libc/sysdeps/x86_64/multiarch/strncmp.S
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/elf/Makefile
fsf/trunk/libc/po/bg.po
fsf/trunk/libc/po/id.po
fsf/trunk/libc/string/strncmp.c
fsf/trunk/libc/sysdeps/x86_64/multiarch/Makefile
fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Jun 23 00:07:36 2009
@@ -1,3 +1,79 @@
+2009-06-22 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * po/id.po: Update from translation team.
+
+ * po/bg.po: Update from translation team.
+
+2009-06-22 H.J. Lu <hongjiu.lu@xxxxxxxxx>
+
+ * string/strncmp.c (STRNCMP): New. Defined to strncmp if not
+ defined.
+ (strncmp): Renamed to STRNCMP.
+ * sysdeps/x86_64/multiarch/Makefile (sysdep_routines): Add
+ strncmp-c for string.
+ * sysdeps/x86_64/multiarch/init-arch.h (HAS_SSE4_2): Define.
+ * sysdeps/x86_64/multiarch/strcmp.S: New file.
+ * sysdeps/x86_64/multiarch/strncmp.S: New file.
+ * sysdeps/x86_64/multiarch/strncmp-c.c: New file.
+
+2009-06-19 H.J. Lu <hongjiu.lu@xxxxxxxxx>
+
+ * elf/Makefile (distribute): Add ifuncmain1staticpie.c,
+ ifuncmain5.c, ifuncmain5pic.c, ifuncmain5picstatic.c,
+ ifuncmain5pie.c, ifuncmain5static.c, ifuncmain5staticpic.c,
+ ifuncdep5.c, ifuncdep5pic.c, ifuncmod5.c, ifuncmain7.c,
+ ifuncmain7pic.c, ifuncmain7picstatic.c, ifuncmain7pie.c, and
+ ifuncmain7static.c.
+ (tests-static): Add ifuncmain5static, ifuncmain5picstatic,
+ ifuncmain7static, and ifuncmain7picstatic.
+ (tests): Also depend on $(objpfx)ifuncmain1staticpie.out,
+ $(objpfx)ifuncmain5pie.out, $(objpfx)ifuncmain6pie.out, and
+ $(objpfx)ifuncmain7pie.out.
+ (modules-names): Add ifuncmod5 ifuncmod6
+ (ifuncmod5.so-no-z-defs): Define.
+ (ifuncmod6.so-no-z-defs): Define.
+ (CFLAGS-ifuncmain5pic.c): Define.
+ (CFLAGS-ifuncmain5picstatic.c): Define.
+ (CFLAGS-ifuncmain5staticpic.c): Define.
+ (CFLAGS-ifuncdep5pic.c): Define.
+ (CFLAGS-ifuncmain7pic.c): Define.
+ (CFLAGS-ifuncmain7picstatic.c): Define.
+ (CFLAGS-ifuncmain1staticpie.c): Define.
+ (CFLAGS-ifuncmain5pie.c): Define.
+ (CFLAGS-ifuncmain6pie.c): Define.
+ (CFLAGS-ifuncmain7pie.c): Define.
+ ($(objpfx)ifuncmain1staticpie.out): Define.
+ ($(objpfx)ifuncmain1staticpie): Define.
+ ($(objpfx)ifuncmain5pie.out): Define.
+ ($(objpfx)ifuncmain5pie): Define.
+ ($(objpfx)ifuncmain6pie.out): Define.
+ ($(objpfx)ifuncmain6pie): Define.
+ ($(objpfx)ifuncmain5): Define.
+ ($(objpfx)ifuncmain5pic): Define.
+ ($(objpfx)ifuncmain5static): Define.
+ ($(objpfx)ifuncmain5staticpic): Define.
+ ($(objpfx)ifuncmain5picstatic): Define.
+ (generated): Add ifuncmain1staticpie, ifuncmain1staticpie.out,
+ ifuncmain5pie, ifuncmain5pie.out, ifuncmain6pie, and
+ ifuncmain6pie.out.
+ * elf/b/elf/ifuncmain1staticpie.c: New file.
+ * elf/ifuncdep5.c: New file.
+ * elf/ifuncdep5pic.c: New file.
+ * elf/ifuncmain5.c: New file.
+ * elf/ifuncmain5pic.c: New file.
+ * elf/ifuncmain5picstatic.c: New file.
+ * elf/ifuncmain5pie.c: New file.
+ * elf/ifuncmain5static.c: New file.
+ * elf/ifuncmain5staticpic.c: New file.
+ * elf/ifuncmain6pie.c: New file.
+ * elf/ifuncmain7.c: New file.
+ * elf/ifuncmain7pic.c: New file.
+ * elf/ifuncmain7picstatic.c: New file.
+ * elf/ifuncmain7pie.c: New file.
+ * elf/ifuncmain7static.c: New file.
+ * elf/ifuncmod5.c: New file.
+ * elf/ifuncmod6.c: New file.
+
2009-06-20 Ulrich Drepper <drepper@xxxxxxxxxx>
[BZ #10085]
Modified: fsf/trunk/libc/elf/Makefile
==============================================================================
--- fsf/trunk/libc/elf/Makefile (original)
+++ fsf/trunk/libc/elf/Makefile Tue Jun 23 00:07:36 2009
@@ -99,10 +99,18 @@
ifuncmain1staticpic.c ifuncmain1picstatic.c \
ifuncdep1.c ifuncdep1pic.c ifuncmod1.c \
ifuncmain1pie.c ifuncmain1vispie.c \
+ ifuncmain1staticpie.c \
ifuncmain2.c ifuncmain2static.c ifuncdep2.c \
ifuncmain2pic.c ifuncmain2picstatic.c ifuncdep2pic.c \
ifuncmain3.c ifuncmod3.c \
- ifuncmain4.c ifuncmain4static.c ifuncmain4picstatic.c
+ ifuncmain4.c ifuncmain4static.c ifuncmain4picstatic.c \
+ ifuncmain5.c ifuncmain5pic.c ifuncmain5picstatic.c \
+ ifuncmain5pie.c ifuncmain5static.c \
+ ifuncmain5staticpic.c \
+ ifuncdep5.c ifuncdep5pic.c ifuncmod5.c \
+ ifuncmain6pie.c ifuncmod6.c \
+ ifuncmain7.c ifuncmain7pic.c ifuncmain7picstatic.c \
+ ifuncmain7pie.c ifuncmain7static.c
CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
@@ -244,16 +252,22 @@
ifeq (yes,$(multi-arch))
tests-static += ifuncmain1static ifuncmain1picstatic \
ifuncmain2static ifuncmain2picstatic \
- ifuncmain4static ifuncmain4picstatic
+ ifuncmain4static ifuncmain4picstatic \
+ ifuncmain5static ifuncmain5picstatic \
+ ifuncmain7static ifuncmain7picstatic
ifeq (yes,$(build-shared))
tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
ifuncmain1staticpic \
- ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4
+ ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
+ ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
+ ifuncmain7 ifuncmain7pic
ifeq (yes,$(have-fpie))
-tests: $(objpfx)ifuncmain1pie.out $(objpfx)ifuncmain1vispie.out
-endif
-modules-names += ifuncmod1 ifuncmod3
+tests: $(objpfx)ifuncmain1pie.out $(objpfx)ifuncmain1vispie.out \
+ $(objpfx)ifuncmain1staticpie.out $(objpfx)ifuncmain5pie.out \
+ $(objpfx)ifuncmain6pie.out $(objpfx)ifuncmain7pie.out
+endif
+modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
endif
endif
@@ -530,6 +544,8 @@
unload3mod4.so-no-z-defs = yes
unload4mod1.so-no-z-defs = yes
ifuncmod1.so-no-z-defs = yes
+ifuncmod5.so-no-z-defs = yes
+ifuncmod6.so-no-z-defs = yes
ifeq ($(build-shared),yes)
# Build all the modules even when not actually running test programs.
@@ -980,12 +996,22 @@
CFLAGS-ifuncmain2picstatic.c += $(pic-ccflag)
CFLAGS-ifuncdep2pic.c += $(pic-ccflag)
CFLAGS-ifuncmain4picstatic.c += $(pic-ccflag)
+CFLAGS-ifuncmain5pic.c += $(pic-ccflag)
+CFLAGS-ifuncmain5picstatic.c += $(pic-ccflag)
+CFLAGS-ifuncmain5staticpic.c += $(pic-ccflag)
+CFLAGS-ifuncdep5pic.c += $(pic-ccflag)
+CFLAGS-ifuncmain7pic.c += $(pic-ccflag)
+CFLAGS-ifuncmain7picstatic.c += $(pic-ccflag)
LDFLAGS-ifuncmain3 = -Wl,-export-dynamic
ifeq (yesyes,$(have-fpie)$(build-shared))
CFLAGS-ifuncmain1pie.c += $(pie-ccflag)
CFLAGS-ifuncmain1vispie.c += $(pie-ccflag)
+CFLAGS-ifuncmain1staticpie.c += $(pie-ccflag)
+CFLAGS-ifuncmain5pie.c += $(pie-ccflag)
+CFLAGS-ifuncmain6pie.c += $(pie-ccflag)
+CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
$(objpfx)ifuncmain1pie.out: $(objpfx)ifuncmain1pie
$(elf-objpfx)$(rtld-installed-name) \
@@ -997,6 +1023,16 @@
generated += ifuncmain1pie ifuncmain1pie.out
+$(objpfx)ifuncmain1staticpie.out: $(objpfx)ifuncmain1staticpie
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $< > $@
+
+$(objpfx)ifuncmain1staticpie: $(objpfx)ifuncmain1staticpie.o $(objpfx)ifuncdep1pic.o
+ $(+link-pie)
+
+generated += ifuncmain1staticpie ifuncmain1staticpie.out
+
$(objpfx)ifuncmain1vispie.out: $(objpfx)ifuncmain1vispie
$(elf-objpfx)$(rtld-installed-name) \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
@@ -1006,6 +1042,36 @@
$(+link-pie)
generated += ifuncmain1vispie ifuncmain1vispie.out
+
+$(objpfx)ifuncmain5pie.out: $(objpfx)ifuncmain5pie
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $< > $@
+
+$(objpfx)ifuncmain5pie: $(objpfx)ifuncmain5pie.o $(objpfx)ifuncmod5.so
+ $(+link-pie)
+
+generated += ifuncmain5pie ifuncmain5pie.out
+
+$(objpfx)ifuncmain6pie.out: $(objpfx)ifuncmain6pie
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $< > $@
+
+$(objpfx)ifuncmain6pie: $(objpfx)ifuncmain6pie.o $(objpfx)ifuncmod6.so
+ $(+link-pie)
+
+generated += ifuncmain6pie ifuncmain6pie.out
+
+$(objpfx)ifuncmain7pie.out: $(objpfx)ifuncmain7pie
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $< > $@
+
+$(objpfx)ifuncmain7pie: $(objpfx)ifuncmain7pie.o
+ $(+link-pie)
+
+generated += ifuncmain7pie ifuncmain7pie.out
endif
$(objpfx)ifuncmain1: $(addprefix $(objpfx),ifuncmod1.so)
@@ -1022,3 +1088,9 @@
$(objpfx)ifuncmain3: $(libdl)
$(objpfx)ifuncmain3.out: $(objpfx)ifuncmod3.so
+
+$(objpfx)ifuncmain5: $(addprefix $(objpfx),ifuncmod5.so)
+$(objpfx)ifuncmain5pic: $(addprefix $(objpfx),ifuncmod5.so)
+$(objpfx)ifuncmain5static: $(addprefix $(objpfx),ifuncdep5.o)
+$(objpfx)ifuncmain5staticpic: $(addprefix $(objpfx),ifuncdep5pic.o)
+$(objpfx)ifuncmain5picstatic: $(addprefix $(objpfx),ifuncdep5pic.o)
Added: fsf/trunk/libc/elf/ifuncdep5.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncdep5.c (added)
+++ fsf/trunk/libc/elf/ifuncdep5.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols without -fPIC. */
+
+#include "ifuncmod5.c"
Added: fsf/trunk/libc/elf/ifuncdep5pic.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncdep5pic.c (added)
+++ fsf/trunk/libc/elf/ifuncdep5pic.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC. */
+
+#include "ifuncmod5.c"
Added: fsf/trunk/libc/elf/ifuncmain1staticpie.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain1staticpie.c (added)
+++ fsf/trunk/libc/elf/ifuncmain1staticpie.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with PIE and no DSO. */
+
+#include "ifuncmain1.c"
Added: fsf/trunk/libc/elf/ifuncmain5.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain5.c (added)
+++ fsf/trunk/libc/elf/ifuncmain5.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,40 @@
+/* Test STT_GNU_IFUNC symbols with dynamic function pointer only. */
+
+#include <stdlib.h>
+
+int global = -1;
+
+extern int foo (void);
+extern int foo_protected (void);
+
+typedef int (*foo_p) (void);
+
+foo_p
+__attribute__ ((noinline))
+get_foo (void)
+{
+ return foo;
+}
+
+foo_p
+__attribute__ ((noinline))
+get_foo_protected (void)
+{
+ return foo_protected;
+}
+
+int
+main (void)
+{
+ foo_p p;
+
+ p = get_foo ();
+ if ((*p) () != -1)
+ abort ();
+
+ p = get_foo_protected ();
+ if ((*p) () != 0)
+ abort ();
+
+ return 0;
+}
Added: fsf/trunk/libc/elf/ifuncmain5pic.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain5pic.c (added)
+++ fsf/trunk/libc/elf/ifuncmain5pic.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC. */
+
+#include "ifuncmain5.c"
Added: fsf/trunk/libc/elf/ifuncmain5picstatic.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain5picstatic.c (added)
+++ fsf/trunk/libc/elf/ifuncmain5picstatic.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC and -static. */
+
+#include "ifuncmain5.c"
Added: fsf/trunk/libc/elf/ifuncmain5pie.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain5pie.c (added)
+++ fsf/trunk/libc/elf/ifuncmain5pie.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with PIE. */
+
+#include "ifuncmain5.c"
Added: fsf/trunk/libc/elf/ifuncmain5static.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain5static.c (added)
+++ fsf/trunk/libc/elf/ifuncmain5static.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -static. */
+
+#include "ifuncmain5.c"
Added: fsf/trunk/libc/elf/ifuncmain5staticpic.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain5staticpic.c (added)
+++ fsf/trunk/libc/elf/ifuncmain5staticpic.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,3 @@
+/* Test STT_GNU_IFUNC symbols with -fPIC and no DSO. */
+
+#include "ifuncmain5.c"
Added: fsf/trunk/libc/elf/ifuncmain6pie.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain6pie.c (added)
+++ fsf/trunk/libc/elf/ifuncmain6pie.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,63 @@
+/* Test STT_GNU_IFUNC symbols in PIE:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ 3. Reference from a shared library.
+ */
+
+#include <stdlib.h>
+
+typedef int (*foo_p) (void);
+extern foo_p foo_ptr;
+
+static int
+one (void)
+{
+ return -30;
+}
+
+void * foo_ifunc (void) __asm__ ("foo");
+__asm__(".type foo, %gnu_indirect_function");
+
+void *
+foo_ifunc (void)
+{
+ return one;
+}
+
+extern int foo (void);
+extern foo_p get_foo (void);
+extern foo_p get_foo_p (void);
+
+foo_p my_foo_ptr = foo;
+
+int
+main (void)
+{
+ foo_p p;
+
+ p = get_foo ();
+ if (p != foo)
+ abort ();
+ if ((*p) () != -30)
+ abort ();
+
+ p = get_foo_p ();
+ if (p != foo)
+ abort ();
+ if ((*p) () != -30)
+ abort ();
+
+ if (foo_ptr != foo)
+ abort ();
+ if (my_foo_ptr != foo)
+ abort ();
+ if ((*foo_ptr) () != -30)
+ abort ();
+ if ((*my_foo_ptr) () != -30)
+ abort ();
+ if (foo () != -30)
+ abort ();
+
+ return 0;
+}
Added: fsf/trunk/libc/elf/ifuncmain7.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain7.c (added)
+++ fsf/trunk/libc/elf/ifuncmain7.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,70 @@
+/* Test local STT_GNU_IFUNC symbols:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ */
+
+#include <stdlib.h>
+
+extern int foo (void);
+
+static int
+one (void)
+{
+ return -30;
+}
+
+static void * foo_ifunc (void) __asm__ ("foo");
+__asm__(".type foo, %gnu_indirect_function");
+
+static void *
+__attribute__ ((used))
+foo_ifunc (void)
+{
+ return one;
+}
+
+typedef int (*foo_p) (void);
+
+foo_p foo_ptr = foo;
+
+foo_p
+__attribute__ ((noinline))
+get_foo_p (void)
+{
+ return foo_ptr;
+}
+
+foo_p
+__attribute__ ((noinline))
+get_foo (void)
+{
+ return foo;
+}
+
+int
+main (void)
+{
+ foo_p p;
+
+ p = get_foo ();
+ if (p != foo)
+ abort ();
+ if ((*p) () != -30)
+ abort ();
+
+ p = get_foo_p ();
+ if (p != foo)
+ abort ();
+ if ((*p) () != -30)
+ abort ();
+
+ if (foo_ptr != foo)
+ abort ();
+ if ((*foo_ptr) () != -30)
+ abort ();
+ if (foo () != -30)
+ abort ();
+
+ return 0;
+}
Added: fsf/trunk/libc/elf/ifuncmain7pic.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain7pic.c (added)
+++ fsf/trunk/libc/elf/ifuncmain7pic.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,7 @@
+/* Test local STT_GNU_IFUNC symbols with -fPIC:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ */
+
+#include "ifuncmain7.c"
Added: fsf/trunk/libc/elf/ifuncmain7picstatic.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain7picstatic.c (added)
+++ fsf/trunk/libc/elf/ifuncmain7picstatic.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,7 @@
+/* Test local STT_GNU_IFUNC symbols with -fPIC and -static:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ */
+
+#include "ifuncmain7.c"
Added: fsf/trunk/libc/elf/ifuncmain7pie.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain7pie.c (added)
+++ fsf/trunk/libc/elf/ifuncmain7pie.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,7 @@
+/* Test local STT_GNU_IFUNC symbols with PIE:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ */
+
+#include "ifuncmain7.c"
Added: fsf/trunk/libc/elf/ifuncmain7static.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmain7static.c (added)
+++ fsf/trunk/libc/elf/ifuncmain7static.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,7 @@
+/* Test local STT_GNU_IFUNC symbols with -static:
+
+ 1. Direct function call.
+ 2. Function pointer.
+ */
+
+#include "ifuncmain7.c"
Added: fsf/trunk/libc/elf/ifuncmod5.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmod5.c (added)
+++ fsf/trunk/libc/elf/ifuncmod5.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,78 @@
+/* Test STT_GNU_IFUNC symbols without direct function call. */
+
+extern int global;
+
+static int
+one (void)
+{
+ return 1;
+}
+
+static int
+minus_one (void)
+{
+ return -1;
+}
+
+static int
+zero (void)
+{
+ return 0;
+}
+
+void * foo_ifunc (void) __asm__ ("foo");
+__asm__(".type foo, %gnu_indirect_function");
+
+void *
+foo_ifunc (void)
+{
+ switch (global)
+ {
+ case 1:
+ return one;
+ case -1:
+ return minus_one;
+ default:
+ return zero;
+ }
+}
+
+void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
+__asm__(".type foo_hidden, %gnu_indirect_function");
+
+void *
+foo_hidden_ifunc (void)
+{
+ switch (global)
+ {
+ case 1:
+ return minus_one;
+ case -1:
+ return one;
+ default:
+ return zero;
+ }
+}
+
+void * foo_protected_ifunc (void) __asm__ ("foo_protected");
+__asm__(".type foo_protected, %gnu_indirect_function");
+
+void *
+foo_protected_ifunc (void)
+{
+ switch (global)
+ {
+ case 1:
+ return one;
+ case -1:
+ return zero;
+ default:
+ return minus_one;
+ }
+}
+
+/* Test hidden indirect function. */
+__asm__(".hidden foo_hidden");
+
+/* Test protected indirect function. */
+__asm__(".protected foo_protected");
Added: fsf/trunk/libc/elf/ifuncmod6.c
==============================================================================
--- fsf/trunk/libc/elf/ifuncmod6.c (added)
+++ fsf/trunk/libc/elf/ifuncmod6.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,19 @@
+/* Test STT_GNU_IFUNC symbol reference in a shared library. */
+
+extern int foo (void);
+
+typedef int (*foo_p) (void);
+
+foo_p foo_ptr = foo;
+
+foo_p
+get_foo_p (void)
+{
+ return foo_ptr;
+}
+
+foo_p
+get_foo (void)
+{
+ return foo;
+}
Modified: fsf/trunk/libc/po/bg.po
==============================================================================
--- fsf/trunk/libc/po/bg.po (original)
+++ fsf/trunk/libc/po/bg.po Tue Jun 23 00:07:36 2009
@@ -6,9 +6,9 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: libc 2.9.90\n"
+"Project-Id-Version: libc 2.10.1\n"
"POT-Creation-Date: 2009-02-06 12:40-0800\n"
-"PO-Revision-Date: 2009-02-28 12:36+0200\n"
+"PO-Revision-Date: 2009-06-23 01:27+0300\n"
"Last-Translator: Roumen Petrov <transl@xxxxxxxxxxxxxxxxx>\n"
"Language-Team: Bulgarian <dict@xxxxxxxxxx>\n"
"MIME-Version: 1.0\n"
@@ -651,7 +651,7 @@
#: elf/dl-reloc.c:211
msgid "cannot make segment writable for relocation"
-msgstr "дÑлÑÑ Ð½Ðµ може да Ñе маÑкиÑа каÑо запиÑваем за \"непÑемеÑÑваем код\""
+msgstr "дÑлÑÑ Ð½Ðµ може да Ñе маÑкиÑа каÑо запиÑваем за \"пÑемеÑÑваем код\""
#: elf/dl-reloc.c:277
#, c-format
@@ -661,7 +661,7 @@
#: elf/dl-reloc.c:288
#, c-format
msgid "%s: out of memory to store relocation results for %s\n"
-msgstr "%s: недоÑÑиг на Ð¿Ð°Ð¼ÐµÑ Ð·Ð° ÑÑÑ
ÑанÑване на ÑезÑлÑаÑа за \"непÑемеÑÑваем код\" на %s\n"
+msgstr "%s: недоÑÑиг на Ð¿Ð°Ð¼ÐµÑ Ð·Ð° ÑÑÑ
ÑанÑване на ÑезÑлÑаÑа за \"пÑемеÑÑваем код\" на %s\n"
#: elf/dl-reloc.c:304
msgid "cannot restore segment prot after reloc"
@@ -922,8 +922,8 @@
"УпоÑÑеба: ldd [ÐÐЦÐЯ]... ФÐÐÐ...\n"
" --help Ðзвеждане на Ñази Ð¿Ð¾Ð¼Ð¾Ñ Ð¸ изÑ
од\n"
" --version Ðзвеждане на инÑоÑмаÑÐ¸Ñ Ð·Ð° веÑÑиÑÑа и изÑ
од\n"
-" -d, --data-relocs ÐбÑабоÑване на непÑемеÑÑваеми данни\n"
-" -r, --function-relocs ÐбÑабоÑване на непÑемеÑÑваеми данни и ÑÑнкÑии\n"
+" -d, --data-relocs ÐбÑабоÑване на пÑемеÑÑваеми данни\n"
+" -r, --function-relocs ÐбÑабоÑване на пÑемеÑÑваеми данни и ÑÑнкÑии\n"
" -u, --unused Ðзвеждане на неизползваниÑе диÑекÑни завиÑимоÑÑи\n"
" -v, --verbose Ðзвеждане на подÑобна инÑоÑмаÑиÑ\n"
@@ -1591,7 +1591,7 @@
#: locale/programs/charmap.c:888
#, c-format
msgid "number of bytes for byte sequence of beginning and end of range not the same: %d vs %d"
-msgstr "Ð±Ð¾Ñ Ð½Ð° байÑовеÑе, в поÑледоваÑелноÑÑ Ð¾Ñ Ð±Ð°Ð¹Ñове за наÑало и кÑай на диапазон, не е ÑÑÑиÑ: %d vs %d"
+msgstr "Ð±Ð¾Ñ Ð½Ð° байÑовеÑе, в поÑледоваÑелноÑÑ Ð¾Ñ Ð±Ð°Ð¹Ñове за наÑало и кÑай на диапазон, не е ÑÑÑиÑ: %d Ñ/Ñ %d"
#: locale/programs/charmap.c:993 locale/programs/ld-collate.c:3044
#: locale/programs/repertoire.c:419
@@ -4791,7 +4791,7 @@
#: sunrpc/rpc_main.c:352
msgid "cannot find any C preprocessor (cpp)\n"
-msgstr "не е намеÑен нÑкакÑв Си пÑепÑоÑеÑÐ¾Ñ (cpp)\n"
+msgstr "не е намеÑен никакÑв Си пÑепÑоÑеÑÐ¾Ñ (cpp)\n"
#: sunrpc/rpc_main.c:421
#, c-format
Modified: fsf/trunk/libc/po/id.po
==============================================================================
--- fsf/trunk/libc/po/id.po (original)
+++ fsf/trunk/libc/po/id.po Tue Jun 23 00:07:36 2009
@@ -5,9 +5,9 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: libc 2.9.90\n"
+"Project-Id-Version: libc 2.10.1\n"
"POT-Creation-Date: 2009-02-06 12:40-0800\n"
-"PO-Revision-Date: 2009-03-10 11:30+0700\n"
+"PO-Revision-Date: 2009-06-23 12:30+0700\n"
"Last-Translator: Arif E. Nugroho <arif_endro@xxxxxxxxx>\n"
"Language-Team: Indonesian <translation-team-id@xxxxxxxxxxxxxxxxxxxxx>\n"
"MIME-Version: 1.0\n"
@@ -86,7 +86,7 @@
#: argp/argp-parse.c:766
msgid "(PROGRAM ERROR) Option should have been recognized!?"
-msgstr "(APLIKASI ERROR) Opsi seharusnya telah dikenal!?"
+msgstr "(APLIKASI ERROR) Pilihan seharusnya telah dikenal!?"
#: assert/assert-perr.c:57
#, c-format
@@ -2864,7 +2864,7 @@
" --usage Tampilkan sebuah pesan penggunaan singkat\n"
" -V,--version Tampilkan informasi versi dan keluar\n"
"\n"
-" Opsi berikut hanya berlaku ketika menghasilkan keluaran graphis:\n"
+" Pilihan berikut hanya berlaku ketika menghasilkan keluaran graphis:\n"
" -t,--time-based Buat graphis linear dengan waktu\n"
" -T,--total Juga gambar graphis dari total penggunaan memori\n"
" --title=STRING Gunakan STRING sebagai judul dari grapik\n"
@@ -3987,7 +3987,7 @@
#: nscd/nscd_conf.c:274
#, c-format
msgid "Unknown option: %s %s %s"
-msgstr "Opsi tidak dikenal: %s %s %s"
+msgstr "Pilihan tidak dikenal: %s %s %s"
#: nscd/nscd_conf.c:287
#, c-format
Modified: fsf/trunk/libc/string/strncmp.c
==============================================================================
--- fsf/trunk/libc/string/strncmp.c (original)
+++ fsf/trunk/libc/string/strncmp.c Tue Jun 23 00:07:36 2009
@@ -21,15 +21,16 @@
#undef strncmp
+#ifndef STRNCMP
+#define STRNCMP strncmp
+#endif
+
/* Compare no more than N characters of S1 and S2,
returning less than, equal to or greater than zero
if S1 is lexicographically less than, equal to or
greater than S2. */
int
-strncmp (s1, s2, n)
- const char *s1;
- const char *s2;
- size_t n;
+STRNCMP (const char *s1, const char *s2, size_t n)
{
unsigned reg_char c1 = '\0';
unsigned reg_char c2 = '\0';
@@ -70,4 +71,5 @@
return c1 - c2;
}
-libc_hidden_builtin_def (strncmp)
+
+libc_hidden_builtin_def (STRNCMP)
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 Tue Jun 23 00:07:36 2009
@@ -2,3 +2,7 @@
aux += init-arch
gen-as-const-headers += ifunc-defines.sym
endif
+
+ifeq ($(subdir),string)
+sysdep_routines += strncmp-c
+endif
Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/init-arch.h Tue Jun 23 00:07:36 2009
@@ -56,3 +56,6 @@
#define HAS_POPCOUNT \
((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 23)) != 0)
+
+#define HAS_SSE4_2 \
+ ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & (1 << 20)) != 0)
Added: fsf/trunk/libc/sysdeps/x86_64/multiarch/strcmp.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/strcmp.S (added)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/strcmp.S Tue Jun 23 00:07:36 2009
@@ -1,0 +1,1677 @@
+/* strcmp with SSE4.2
+ Copyright (C) 2009 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 <ifunc-defines.h>
+
+#ifdef USE_AS_STRNCMP
+/* 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 STRCMP_SSE2 __strncmp_sse2
+#define __GI_STRCMP __GI_strncmp
+#else
+#define UPDATE_STRNCMP_COUNTER
+#ifndef STRCMP
+#define STRCMP strcmp
+#define STRCMP_SSE42 __strcmp_sse42
+#define STRCMP_SSE2 __strcmp_sse2
+#define __GI_STRCMP __GI_strcmp
+#endif
+#endif
+
+#ifndef LABEL
+#define LABEL(l) L(l)
+#endif
+
+/* Define multiple versions only for the definition in libc. Don't
+ define multiple versions for strncmp in static library since we
+ need strncmp before the initialization happened. */
+#if (defined SHARED || !defined USE_AS_STRNCMP) && !defined NOT_IN_libc
+ .text
+ENTRY(STRCMP)
+ .type STRCMP, @gnu_indirect_function
+ cmpl $0, __cpu_features+KIND_OFFSET(%rip)
+ jne 1f
+ call __init_cpu_features
+1: leaq STRCMP_SSE2(%rip), %rax
+ testl $(1<<20), __cpu_features+CPUID_OFFSET+COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET(%rip)
+ jz 2f
+ leaq STRCMP_SSE42(%rip), %rax
+2: ret
+END(STRCMP)
+
+/* We use 0x1a:
+ _SIDD_SBYTE_OPS
+ | _SIDD_CMP_EQUAL_EACH
+ | _SIDD_NEGATIVE_POLARITY
+ | _SIDD_LEAST_SIGNIFICANT
+ on pcmpistri to find out if two 16byte data elements are the same
+ and the offset of the first different byte. There are 4 cases:
+
+ 1. Both 16byte data elements are valid and identical.
+ 2. Both 16byte data elements have EOS and identical.
+ 3. Both 16byte data elements are valid and they differ at offset X.
+ 4. At least one 16byte data element has EOS at offset X. Two 16byte
+ data elements must differ at or before offset X.
+
+ Here is the table of ECX, CFlag, ZFlag and SFlag for 4 cases:
+
+ case ECX CFlag ZFlag SFlag
+ 1 16 0 0 0
+ 2 16 0 1 1
+ 3 X 1 0 0
+ 4 0 <= X 1 0/1 0/1
+
+ We exit from the loop for cases 2, 3 and 4 with jbe which branches
+ when either CFlag or ZFlag is 1. If CFlag == 0, we return 0 for
+ case 2. */
+
+ /* Put all SSE 4.2 functions together. */
+ .section .text.sse4.2,"ax",@progbits
+ .align 16
+ .type STRCMP_SSE42, @function
+STRCMP_SSE42:
+ cfi_startproc
+ CALL_MCOUNT
+
+/*
+ * This implementation uses SSE to compare up to 16 bytes at a time.
+ */
+#ifdef USE_AS_STRNCMP
+ test %rdx, %rdx
+ je LABEL(strcmp_exitz)
+ cmp $1, %rdx
+ je LABEL(Byte0)
+ mov %rdx, %r11
+#endif
+ mov %esi, %ecx
+ mov %edi, %eax
+/* Use 64bit AND here to avoid long NOP padding. */
+ and $0x3f, %rcx /* rsi alignment in cache line */
+ and $0x3f, %rax /* rdi alignment in cache line */
+ cmp $0x30, %ecx
+ ja LABEL(crosscache) /* rsi: 16-byte load will cross cache line */
+ cmp $0x30, %eax
+ ja LABEL(crosscache) /* rdi: 16-byte load will cross cache line */
+ movlpd (%rdi), %xmm1
+ movlpd (%rsi), %xmm2
+ movhpd 8(%rdi), %xmm1
+ movhpd 8(%rsi), %xmm2
+ pxor %xmm0, %xmm0 /* clear %xmm0 for null char checks */
+ pcmpeqb %xmm1, %xmm0 /* Any null chars? */
+ pcmpeqb %xmm2, %xmm1 /* compare first 16 bytes for equality */
+ psubb %xmm0, %xmm1 /* packed sub of comparison results*/
+ pmovmskb %xmm1, %edx
+ sub $0xffff, %edx /* if first 16 bytes are same, edx == 0xffff */
+ jnz LABEL(less16bytes) /* If not, find different value or null char */
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz) /* finish comparision */
+#endif
+ add $16, %rsi /* prepare to search next 16 bytes */
+ add $16, %rdi /* prepare to search next 16 bytes */
+
+ /*
+ * Determine source and destination string offsets from 16-byte alignment.
+ * Use relative offset difference between the two to determine which case
+ * below to use.
+ */
+ .p2align 4
+LABEL(crosscache):
+ and $0xfffffffffffffff0, %rsi /* force %rsi is 16 byte aligned */
+ and $0xfffffffffffffff0, %rdi /* force %rdi is 16 byte aligned */
+ mov $0xffff, %edx /* for equivalent offset */
+ xor %r8d, %r8d
+ and $0xf, %ecx /* offset of rsi */
+ and $0xf, %eax /* offset of rdi */
+ cmp %eax, %ecx
+ je LABEL(ashr_0) /* rsi and rdi relative offset same */
+ ja LABEL(bigger)
+ mov %edx, %r8d /* r8d is offset flag for exit tail */
+ xchg %ecx, %eax
+ xchg %rsi, %rdi
+LABEL(bigger):
+ lea 15(%rax), %r9
+ sub %rcx, %r9
+ lea LABEL(unaligned_table)(%rip), %r10
+ movslq (%r10, %r9,4), %r9
+ lea (%r10, %r9), %r10
+ jmp *%r10 /* jump to corresponding case */
+
+/*
+ * The following cases will be handled by ashr_0
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(0~15) n(0~15) 15(15+ n-n) ashr_0
+ */
+ .p2align 4
+LABEL(ashr_0):
+
+ movdqa (%rsi), %xmm1
+ pxor %xmm0, %xmm0 /* clear %xmm0 for null char check */
+ pcmpeqb %xmm1, %xmm0 /* Any null chars? */
+ pcmpeqb (%rdi), %xmm1 /* compare 16 bytes for equality */
+ psubb %xmm0, %xmm1 /* packed sub of comparison results*/
+ pmovmskb %xmm1, %r9d
+ shr %cl, %edx /* adjust 0xffff for offset */
+ shr %cl, %r9d /* adjust for 16-byte offset */
+ sub %r9d, %edx
+ /*
+ * edx must be the same with r9d if in left byte (16-rcx) is equal to
+ * the start from (16-rax) and no null char was seen.
+ */
+ jne LABEL(less32bytes) /* mismatch or null char */
+ UPDATE_STRNCMP_COUNTER
+ mov $16, %rcx
+ mov $16, %r9
+ pxor %xmm0, %xmm0 /* clear xmm0, may have changed above */
+
+ /*
+ * Now both strings are aligned at 16-byte boundary. Loop over strings
+ * checking 32-bytes per iteration.
+ */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+ .p2align 4
+LABEL(ashr_0_use_sse4_2):
+ movdqa (%rdi,%rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ lea 16(%rdx), %rdx
+ jbe LABEL(ashr_0_use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ movdqa (%rdi,%rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ lea 16(%rdx), %rdx
+ jbe LABEL(ashr_0_use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ jmp LABEL(ashr_0_use_sse4_2)
+
+
+ .p2align 4
+LABEL(ashr_0_use_sse4_2_exit):
+ jnc LABEL(strcmp_exitz)
+#ifdef USE_AS_STRNCMP
+ sub %rcx, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ lea -16(%rdx, %rcx), %rcx
+ movzbl (%rdi, %rcx), %eax
+ movzbl (%rsi, %rcx), %edx
+ sub %edx, %eax
+ ret
+
+
+
+
+/*
+ * The following cases will be handled by ashr_1
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(15) n -15 0(15 +(n-15) - n) ashr_1
+ */
+ .p2align 4
+LABEL(ashr_1):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0 /* Any null chars? */
+ pslldq $15, %xmm2 /* shift first string to align with second */
+ pcmpeqb %xmm1, %xmm2 /* compare 16 bytes for equality */
+ psubb %xmm0, %xmm2 /* packed sub of comparison results*/
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx /* adjust 0xffff for offset */
+ shr %cl, %r9d /* adjust for 16-byte offset */
+ sub %r9d, %edx
+ jnz LABEL(less32bytes) /* mismatch or null char seen */
+ movdqa (%rdi), %xmm3
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads*/
+ mov $1, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 1(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_1_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_1_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $1, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_1_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $1, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_1_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_1_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $1, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $14, %ecx
+ ja LABEL(loop_ashr_1_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_2
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(14~15) n -14 1(15 +(n-14) - n) ashr_2
+ */
+ .p2align 4
+LABEL(ashr_2):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $14, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $2, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 2(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_2_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_2_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $2, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_2_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $2, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_2_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_2_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $2, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $13, %ecx
+ ja LABEL(loop_ashr_2_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_3
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(13~15) n -13 2(15 +(n-13) - n) ashr_3
+ */
+ .p2align 4
+LABEL(ashr_3):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $13, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $3, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 3(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+LABEL(loop_ashr_3_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_3_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $3, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_3_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $3, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_3_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_3_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $3, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $12, %ecx
+ ja LABEL(loop_ashr_3_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_4
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(12~15) n -12 3(15 +(n-12) - n) ashr_4
+ */
+ .p2align 4
+LABEL(ashr_4):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $12, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $4, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 4(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_4_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_4_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $4, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_4_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $4, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_4_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_4_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $4, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $11, %ecx
+ ja LABEL(loop_ashr_4_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_5
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(11~15) n - 11 4(15 +(n-11) - n) ashr_5
+ */
+ .p2align 4
+LABEL(ashr_5):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $11, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $5, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 5(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_5_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_5_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $5, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_5_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+
+ palignr $5, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_5_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_5_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $5, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $10, %ecx
+ ja LABEL(loop_ashr_5_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_6
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(10~15) n - 10 5(15 +(n-10) - n) ashr_6
+ */
+ .p2align 4
+LABEL(ashr_6):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $10, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $6, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 6(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_6_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_6_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $6, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_6_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $6, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_6_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_6_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $6, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $9, %ecx
+ ja LABEL(loop_ashr_6_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_7
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(9~15) n - 9 6(15 +(n - 9) - n) ashr_7
+ */
+ .p2align 4
+LABEL(ashr_7):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $9, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $7, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 7(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_7_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_7_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $7, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_7_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $7, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_7_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_7_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $7, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $8, %ecx
+ ja LABEL(loop_ashr_7_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_8
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(8~15) n - 8 7(15 +(n - 8) - n) ashr_8
+ */
+ .p2align 4
+LABEL(ashr_8):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $8, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $8, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 8(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_8_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_8_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $8, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_8_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $8, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_8_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_8_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $8, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $7, %ecx
+ ja LABEL(loop_ashr_8_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_9
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(7~15) n - 7 8(15 +(n - 7) - n) ashr_9
+ */
+ .p2align 4
+LABEL(ashr_9):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $7, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $9, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 9(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_9_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_9_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+
+ palignr $9, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_9_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $9, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_9_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_9_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $9, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $6, %ecx
+ ja LABEL(loop_ashr_9_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_10
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(6~15) n - 6 9(15 +(n - 6) - n) ashr_10
+ */
+ .p2align 4
+LABEL(ashr_10):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $6, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $10, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 10(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_10_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_10_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $10, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_10_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $10, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_10_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_10_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $10, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $5, %ecx
+ ja LABEL(loop_ashr_10_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_11
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(5~15) n - 5 10(15 +(n - 5) - n) ashr_11
+ */
+ .p2align 4
+LABEL(ashr_11):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $5, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $11, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 11(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_11_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_11_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $11, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_11_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $11, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_11_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_11_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $11, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $4, %ecx
+ ja LABEL(loop_ashr_11_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_12
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(4~15) n - 4 11(15 +(n - 4) - n) ashr_12
+ */
+ .p2align 4
+LABEL(ashr_12):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $4, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $12, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 12(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_12_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_12_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $12, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_12_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $12, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_12_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_12_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $12, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $3, %ecx
+ ja LABEL(loop_ashr_12_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_13
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(3~15) n - 3 12(15 +(n - 3) - n) ashr_13
+ */
+ .p2align 4
+LABEL(ashr_13):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $3, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $13, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 13(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_13_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_13_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $13, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_13_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $13, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_13_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_13_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $13, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $2, %ecx
+ ja LABEL(loop_ashr_13_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_14
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(2~15) n - 2 13(15 +(n - 2) - n) ashr_14
+ */
+ .p2align 4
+LABEL(ashr_14):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $2, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $14, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 14(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_14_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_14_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $14, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_14_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $14, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_14_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_14_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $14, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $1, %ecx
+ ja LABEL(loop_ashr_14_use_sse4_2)
+
+ jmp LABEL(nibble_ashr_use_sse4_2_exit)
+
+/*
+ * The following cases will be handled by ashr_15
+ * rcx(offset of rsi) rax(offset of rdi) relative offset corresponding case
+ * n(1~15) n - 1 14(15 +(n - 1) - n) ashr_15
+ */
+ .p2align 4
+LABEL(ashr_15):
+ pxor %xmm0, %xmm0
+ movdqa (%rdi), %xmm2
+ movdqa (%rsi), %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pslldq $1, %xmm2
+ pcmpeqb %xmm1, %xmm2
+ psubb %xmm0, %xmm2
+ pmovmskb %xmm2, %r9d
+ shr %cl, %edx
+ shr %cl, %r9d
+ sub %r9d, %edx
+ jnz LABEL(less32bytes)
+
+ movdqa (%rdi), %xmm3
+
+ UPDATE_STRNCMP_COUNTER
+
+ pxor %xmm0, %xmm0
+ mov $16, %rcx /* index for loads */
+ mov $15, %r9d /* byte position left over from less32bytes case */
+ /*
+ * Setup %r10 value allows us to detect crossing a page boundary.
+ * When %r10 goes positive we have crossed a page boundary and
+ * need to do a nibble.
+ */
+ lea 15(%rdi), %r10
+ and $0xfff, %r10 /* offset into 4K page */
+
+ sub $0x1000, %r10 /* subtract 4K pagesize */
+
+ mov %rcx, %rdx /* only for offset of sse4 instruction loop*/
+
+ .p2align 4
+LABEL(loop_ashr_15_use_sse4_2):
+ add $16, %r10
+ jg LABEL(nibble_ashr_15_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $15, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+
+ add $16, %rdx
+ add $16, %r10
+ jg LABEL(nibble_ashr_15_use_sse4_2)
+
+ movdqa (%rdi, %rdx), %xmm0
+ palignr $15, -16(%rdi, %rdx), %xmm0
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ jbe LABEL(use_sse4_2_exit)
+#ifdef USE_AS_STRNCMP
+ sub $16, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add $16, %rdx
+ jmp LABEL(loop_ashr_15_use_sse4_2)
+
+ .p2align 4
+LABEL(nibble_ashr_15_use_sse4_2):
+ sub $0x1000, %r10
+ movdqa -16(%rdi, %rdx), %xmm0
+ psrldq $15, %xmm0
+ pcmpistri $0x3a,%xmm0, %xmm0
+#ifdef USE_AS_STRNCMP
+ cmp %r11, %rcx
+ jae LABEL(nibble_ashr_use_sse4_2_exit)
+#endif
+ cmp $0, %ecx
+ ja LABEL(loop_ashr_15_use_sse4_2)
+
+LABEL(nibble_ashr_use_sse4_2_exit):
+ pcmpistri $0x1a,(%rsi,%rdx), %xmm0
+ .p2align 4
+LABEL(use_sse4_2_exit):
+ jnc LABEL(strcmp_exitz)
+#ifdef USE_AS_STRNCMP
+ sub %rcx, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ add %rcx, %rdx
+ lea -16(%rdi, %r9), %rdi
+ movzbl (%rdi, %rdx), %eax
+ movzbl (%rsi, %rdx), %edx
+ test %r8d, %r8d
+ jz LABEL(use_sse4_2_ret)
+ xchg %eax, %edx
+LABEL(use_sse4_2_ret):
+ sub %edx, %eax
+ ret
+
+ .p2align 4
+LABEL(aftertail):
+ pcmpeqb %xmm3, %xmm1
+ psubb %xmm0, %xmm1
+ pmovmskb %xmm1, %edx
+ not %edx
+
+ .p2align 4
+LABEL(exit):
+ lea -16(%r9, %rcx), %rax /* locate the exact offset for rdi */
+LABEL(less32bytes):
+ lea (%rdi, %rax), %rdi /* locate the exact address for first operand(rdi) */
+ lea (%rsi, %rcx), %rsi /* locate the exact address for second operand(rsi) */
+ test %r8d, %r8d
+ jz LABEL(ret)
+ xchg %rsi, %rdi /* recover original order according to flag(%r8d) */
+
+ .p2align 4
+LABEL(ret):
+LABEL(less16bytes):
+ /*
+ * Check to see if BSF is fast on this processor. If not, use a different
+ * exit tail.
+ */
+ bsf %rdx, %rdx /* find and store bit index in %rdx */
+
+#ifdef USE_AS_STRNCMP
+ sub %rdx, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ xor %ecx, %ecx /* clear %ecx */
+ xor %eax, %eax /* clear %eax */
+
+ movb (%rsi, %rdx), %cl
+ movb (%rdi, %rdx), %al
+
+ sub %ecx, %eax
+ ret
+
+LABEL(strcmp_exitz):
+ xor %eax, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte0):
+ /*
+ * never need to handle byte 0 for strncmpy
+#ifdef USE_AS_STRNCMP
+ sub $0, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ */
+ movzx (%rsi), %ecx
+ movzx (%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte1):
+
+#ifdef USE_AS_STRNCMP
+ sub $1, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 1(%rsi), %ecx
+ movzx 1(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte2):
+
+#ifdef USE_AS_STRNCMP
+ sub $2, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 2(%rsi), %ecx
+ movzx 2(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte3):
+
+#ifdef USE_AS_STRNCMP
+ sub $3, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 3(%rsi), %ecx
+ movzx 3(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte4):
+
+#ifdef USE_AS_STRNCMP
+ sub $4, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 4(%rsi), %ecx
+ movzx 4(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte5):
+
+#ifdef USE_AS_STRNCMP
+ sub $5, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 5(%rsi), %ecx
+ movzx 5(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(Byte6):
+
+#ifdef USE_AS_STRNCMP
+ sub $6, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 6(%rsi), %ecx
+ movzx 6(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+
+ .p2align 4
+LABEL(next_8_bytes):
+ add $8, %rdi
+ add $8, %rsi
+#ifdef USE_AS_STRNCMP
+ sub $8, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ test $0x01, %dh
+ jnz LABEL(Byte0)
+
+ test $0x02, %dh
+ jnz LABEL(Byte1)
+
+ test $0x04, %dh
+ jnz LABEL(Byte2)
+
+ test $0x08, %dh
+ jnz LABEL(Byte3)
+
+ test $0x10, %dh
+ jnz LABEL(Byte4)
+
+ test $0x20, %dh
+ jnz LABEL(Byte5)
+
+ test $0x40, %dh
+ jnz LABEL(Byte6)
+
+#ifdef USE_AS_STRNCMP
+ sub $7, %r11
+ jbe LABEL(strcmp_exitz)
+#endif
+ movzx 7(%rsi), %ecx
+ movzx 7(%rdi), %eax
+
+ sub %ecx, %eax
+ ret
+ cfi_endproc
+ .size STRCMP_SSE42, .-STRCMP_SSE42
+
+ /* Put all SSE 4.2 functions together. */
+ .section .rodata.sse4.2,"a",@progbits
+ .p2align 4
+LABEL(unaligned_table):
+ .int LABEL(ashr_1) - LABEL(unaligned_table)
+ .int LABEL(ashr_2) - LABEL(unaligned_table)
+ .int LABEL(ashr_3) - LABEL(unaligned_table)
+ .int LABEL(ashr_4) - LABEL(unaligned_table)
+ .int LABEL(ashr_5) - LABEL(unaligned_table)
+ .int LABEL(ashr_6) - LABEL(unaligned_table)
+ .int LABEL(ashr_7) - LABEL(unaligned_table)
+ .int LABEL(ashr_8) - LABEL(unaligned_table)
+ .int LABEL(ashr_9) - LABEL(unaligned_table)
+ .int LABEL(ashr_10) - LABEL(unaligned_table)
+ .int LABEL(ashr_11) - LABEL(unaligned_table)
+ .int LABEL(ashr_12) - LABEL(unaligned_table)
+ .int LABEL(ashr_13) - LABEL(unaligned_table)
+ .int LABEL(ashr_14) - LABEL(unaligned_table)
+ .int LABEL(ashr_15) - LABEL(unaligned_table)
+ .int LABEL(ashr_0) - LABEL(unaligned_table)
+
+
+# undef ENTRY
+# define ENTRY(name) \
+ .type STRCMP_SSE2, @function; \
+ STRCMP_SSE2: cfi_startproc; \
+ CALL_MCOUNT
+# undef END
+# define END(name) \
+ cfi_endproc; .size STRCMP_SSE2, .-STRCMP_SSE2
+# undef libc_hidden_builtin_def
+/* It doesn't make sense to send libc-internal strcmp calls through a PLT.
+ The speedup we get from using SSE4.2 instruction is likely eaten away
+ by the indirect call in the PLT. */
+# define libc_hidden_builtin_def(name) \
+ .globl __GI_STRCMP; __GI_STRCMP = STRCMP_SSE2
+#endif
+
+#ifndef USE_AS_STRNCMP
+#include "../strcmp.S"
+#endif
Added: fsf/trunk/libc/sysdeps/x86_64/multiarch/strncmp-c.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/strncmp-c.c (added)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/strncmp-c.c Tue Jun 23 00:07:36 2009
@@ -1,0 +1,8 @@
+#ifdef SHARED
+#define STRNCMP __strncmp_sse2
+#undef libc_hidden_builtin_def
+#define libc_hidden_builtin_def(name) \
+ __hidden_ver1 (__strncmp_sse2, __GI_strncmp, __strncmp_sse2);
+#endif
+
+#include "strncmp.c"
Added: fsf/trunk/libc/sysdeps/x86_64/multiarch/strncmp.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/strncmp.S (added)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/strncmp.S Tue Jun 23 00:07:36 2009
@@ -1,0 +1,3 @@
+#define STRCMP strncmp
+#define USE_AS_STRNCMP
+#include "strcmp.S"