PATCH: Improve 32 bit strchr and strrchr functions with SSE2
Dmitrieva Liubov
liubov.dmitrieva@gmail.com
Thu Sep 1 13:43:00 GMT 2011
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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: strchr_strrchr_fix.patch
Type: application/octet-stream
Size: 3357 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20110901/49866823/attachment.obj>
More information about the Libc-alpha
mailing list