about summary refs log tree commit diff
path: root/sysdeps/x86_64/multiarch/mempcpy_chk.S
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-04-28 10:04:15 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-04-28 10:04:28 -0700
commit06d79808f6faf6025c5a7d4e27d949a8216275cc (patch)
treef3a16266ae6bb63f638680b09b3af0fcef530375 /sysdeps/x86_64/multiarch/mempcpy_chk.S
parent4c6f97798fe1854a32b1199c42370eac1620eebf (diff)
downloadglibc-06d79808f6faf6025c5a7d4e27d949a8216275cc.tar.gz
glibc-06d79808f6faf6025c5a7d4e27d949a8216275cc.tar.xz
glibc-06d79808f6faf6025c5a7d4e27d949a8216275cc.zip
x86: Use AVX2 memcpy/memset on Skylake server [BZ #21396]
On Skylake server, AVX512 load/store instructions in memcpy/memset may
lead to lower CPU turbo frequency in certain situations.  Use of AVX2
in memcpy/memset has been observed to have improved overall performance
in many workloads due to the higher frequency.

Since AVX512ER is unique to Xeon Phi, this patch sets Prefer_No_AVX512
if AVX512ER isn't available so that AVX2 versions of memcpy/memset are
used on Skylake server.

	[BZ #21396]
	* sysdeps/x86/cpu-features.c (init_cpu_features): Set
	Prefer_No_AVX512 if AVX512ER isn't available.
	* sysdeps/x86/cpu-features.h (bit_arch_Prefer_No_AVX512): New.
	(index_arch_Prefer_No_AVX512): Likewise.
	* sysdeps/x86_64/multiarch/memcpy.S (__new_memcpy): Don't use
	AVX512 version if Prefer_No_AVX512 is set.
	* sysdeps/x86_64/multiarch/memcpy_chk.S (__memcpy_chk):
	Likewise.
	* sysdeps/x86_64/multiarch/memmove.S (__libc_memmove): Likewise.
	* sysdeps/x86_64/multiarch/memmove_chk.S (__memmove_chk):
	Likewise.
	* sysdeps/x86_64/multiarch/mempcpy.S (__mempcpy): Likewise.
	* sysdeps/x86_64/multiarch/mempcpy_chk.S (__mempcpy_chk):
	Likewise.
	* sysdeps/x86_64/multiarch/memset.S (memset): Likewise.
	* sysdeps/x86_64/multiarch/memset_chk.S (__memset_chk):
	Likewise.

(cherry picked from commit 4cb334c4d6249686653137ec273d081371b3672d)
Diffstat (limited to 'sysdeps/x86_64/multiarch/mempcpy_chk.S')
-rw-r--r--sysdeps/x86_64/multiarch/mempcpy_chk.S2
1 files changed, 2 insertions, 0 deletions
diff --git a/sysdeps/x86_64/multiarch/mempcpy_chk.S b/sysdeps/x86_64/multiarch/mempcpy_chk.S
index 6927962e81..072b22c49f 100644
--- a/sysdeps/x86_64/multiarch/mempcpy_chk.S
+++ b/sysdeps/x86_64/multiarch/mempcpy_chk.S
@@ -30,6 +30,8 @@
 ENTRY(__mempcpy_chk)
 	.type	__mempcpy_chk, @gnu_indirect_function
 	LOAD_RTLD_GLOBAL_RO_RDX
+	HAS_ARCH_FEATURE (Prefer_No_AVX512)
+	jnz	1f
 	HAS_ARCH_FEATURE (AVX512F_Usable)
 	jz	1f
 	lea	__mempcpy_chk_avx512_no_vzeroupper(%rip), %RAX_LP