This is the mail archive of the libc-alpha@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]

Re: PATCH: Improve 32 bit strchr and strrchr functions with SSE2


Hello,

I have small fix for this patch.
It seems strchr and strrchr both can be optimized in static mode as well.
So, I changed from
#if defined SHARED && !defined NOT_IN_libc
to
#ifndef NOT_IN_libc
everywhere in the patch.

Fixing patch is:

+++ b/sysdeps/i386/i686/multiarch/strchr-sse2-bsf.S
@@ -18,10 +18,9 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */

-#if defined SHARED && !defined NOT_IN_libc
+#ifndef NOT_IN_libc

 # include <sysdep.h>
-# include "asm-syntax.h"

 # define CFI_PUSH(REG)	\
 	cfi_adjust_cfa_offset (4);	\
diff --git a/sysdeps/i386/i686/multiarch/strchr-sse2.S
b/sysdeps/i386/i686/multiarch/strchr-sse2.S
index 6da0d75..7702210 100644
--- a/sysdeps/i386/i686/multiarch/strchr-sse2.S
+++ b/sysdeps/i386/i686/multiarch/strchr-sse2.S
@@ -18,10 +18,9 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */

-#if defined SHARED && !defined NOT_IN_libc
+#ifndef NOT_IN_libc

 # include <sysdep.h>
-# include "asm-syntax.h"

 # define CFI_PUSH(REG)	\
 	cfi_adjust_cfa_offset (4);	\
diff --git a/sysdeps/i386/i686/multiarch/strchr.S
b/sysdeps/i386/i686/multiarch/strchr.S
index 79c9c71..aed967c 100644
--- a/sysdeps/i386/i686/multiarch/strchr.S
+++ b/sysdeps/i386/i686/multiarch/strchr.S
@@ -21,10 +21,7 @@
 #include <sysdep.h>
 #include <init-arch.h>

-/* Define multiple versions only for the definition in libc and for the
-   DSO.  In static binaries, we need strchr before the initialization
-   happened.  */
-#if defined SHARED && !defined NOT_IN_libc
+#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
diff --git a/sysdeps/i386/i686/multiarch/strrchr-sse2-bsf.S
b/sysdeps/i386/i686/multiarch/strrchr-sse2-bsf.S
index 1beeebb..f1bcb78 100644
--- a/sysdeps/i386/i686/multiarch/strrchr-sse2-bsf.S
+++ b/sysdeps/i386/i686/multiarch/strrchr-sse2-bsf.S
@@ -18,10 +18,9 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */

-#if defined SHARED && !defined NOT_IN_libc
+#ifndef NOT_IN_libc

 # include <sysdep.h>
-# include "asm-syntax.h"

 # define CFI_PUSH(REG)	\
 	cfi_adjust_cfa_offset (4);	\
diff --git a/sysdeps/i386/i686/multiarch/strrchr-sse2.S
b/sysdeps/i386/i686/multiarch/strrchr-sse2.S
index 47d0fde..71cc69d 100644
--- a/sysdeps/i386/i686/multiarch/strrchr-sse2.S
+++ b/sysdeps/i386/i686/multiarch/strrchr-sse2.S
@@ -18,10 +18,9 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */

-#if defined SHARED && !defined NOT_IN_libc
+#ifndef NOT_IN_libc

 # include <sysdep.h>
-# include "asm-syntax.h"

 # define CFI_PUSH(REG)	\
 	cfi_adjust_cfa_offset (4);	\
diff --git a/sysdeps/i386/i686/multiarch/strrchr.S
b/sysdeps/i386/i686/multiarch/strrchr.S
index b15b02a..866cac0 100644
--- a/sysdeps/i386/i686/multiarch/strrchr.S
+++ b/sysdeps/i386/i686/multiarch/strrchr.S
@@ -21,10 +21,7 @@
 #include <sysdep.h>
 #include <init-arch.h>

-/* Define multiple versions only for the definition in libc and for the
-   DSO.  In static binaries, we need strrchr before the initialization
-   happened.  */
-#if defined SHARED && !defined NOT_IN_libc
+#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


2011/8/8 Dmitrieva Liubov <liubov.dmitrieva@gmail.com>:
> Hello,
>
> This patch improves strchr and strrchr for IA 32 bit with SSE2 (two
> versions: with bsf, bsr instructions, without bsf, bsr instructions
> (good on atom) ).
> Tested on core i7, core 2, atom.
>
> It improves performance by up to 6.5 X for strrchr and 7.5 X for strchr.
>
>
> --
> Liubov Dmitrieva
>

Attachment: strchr_strrchr_fix.patch
Description: Binary data


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