about summary refs log tree commit diff
path: root/sysdeps/x86_64/multiarch/memmove.c
diff options
context:
space:
mode:
authorLing Ma <ling.ml@alibaba-inc.com>2014-07-14 00:02:52 -0400
committerH.J. Lu <hjl.tools@gmail.com>2014-07-30 08:02:35 -0700
commit05f3633da4f9df870d04dd77336e793746e57ed4 (patch)
treebd980df4702ffd9ebfa9cb4dac8823a659f0c430 /sysdeps/x86_64/multiarch/memmove.c
parenta53fbd8e6cd2f69bdfa3431d616a5f332aea6664 (diff)
downloadglibc-05f3633da4f9df870d04dd77336e793746e57ed4.tar.gz
glibc-05f3633da4f9df870d04dd77336e793746e57ed4.tar.xz
glibc-05f3633da4f9df870d04dd77336e793746e57ed4.zip
Improve 64bit memcpy performance for Haswell CPU with AVX instruction
In this patch we take advantage of HSW memory bandwidth, manage to
reduce miss branch prediction by avoiding using branch instructions and
force destination to be aligned with avx instruction.

The CPU2006 403.gcc benchmark indicates this patch improves performance
from 2% to 10%.
Diffstat (limited to 'sysdeps/x86_64/multiarch/memmove.c')
-rw-r--r--sysdeps/x86_64/multiarch/memmove.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sysdeps/x86_64/multiarch/memmove.c b/sysdeps/x86_64/multiarch/memmove.c
index ba86e7bbb1..0c9af7e4df 100644
--- a/sysdeps/x86_64/multiarch/memmove.c
+++ b/sysdeps/x86_64/multiarch/memmove.c
@@ -35,6 +35,8 @@
 extern __typeof (__redirect_memmove) __memmove_sse2 attribute_hidden;
 extern __typeof (__redirect_memmove) __memmove_ssse3 attribute_hidden;
 extern __typeof (__redirect_memmove) __memmove_ssse3_back attribute_hidden;
+extern __typeof (__redirect_memmove) __memmove_avx_unaligned attribute_hidden;
+
 #endif
 
 #include "string/memmove.c"
@@ -47,10 +49,12 @@ extern __typeof (__redirect_memmove) __memmove_ssse3_back attribute_hidden;
    ifunc symbol properly.  */
 extern __typeof (__redirect_memmove) __libc_memmove;
 libc_ifunc (__libc_memmove,
-	    HAS_SSSE3
-	    ? (HAS_FAST_COPY_BACKWARD
-	       ? __memmove_ssse3_back : __memmove_ssse3)
-	    : __memmove_sse2)
+	    HAS_AVX
+	    ? __memmove_avx_unaligned
+	    : (HAS_SSSE3
+	       ? (HAS_FAST_COPY_BACKWARD
+	          ? __memmove_ssse3_back : __memmove_ssse3)
+	       : __memmove_sse2));
 
 strong_alias (__libc_memmove, memmove)