Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
X86-64: Prepare memset-vec-unaligned-erms.S
Prepare memset-vec-unaligned-erms.S to make the SSE2 version as the
default memset.

	* sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
	(MEMSET_CHK_SYMBOL): New.  Define if not defined.
	(__bzero): Check VEC_SIZE == 16 instead of USE_MULTIARCH.
	Disabled fro now.
	Replace MEMSET_SYMBOL with MEMSET_CHK_SYMBOL on __memset_chk
	symbols.  Properly check USE_MULTIARCH on __memset symbols.
  • Loading branch information
H.J. Lu committed Apr 6, 2016
1 parent a25322f commit 4af1bb0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
@@ -1,3 +1,12 @@
2016-04-06 H.J. Lu <hongjiu.lu@intel.com>

* sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
(MEMSET_CHK_SYMBOL): New. Define if not defined.
(__bzero): Check VEC_SIZE == 16 instead of USE_MULTIARCH.
Disabled fro now.
Replace MEMSET_SYMBOL with MEMSET_CHK_SYMBOL on __memset_chk
symbols. Properly check USE_MULTIARCH on __memset symbols.

2016-04-06 H.J. Lu <hongjiu.lu@intel.com>

* benchtests/Makefile (string-benchset): Add memcpy-large,
Expand Down
32 changes: 19 additions & 13 deletions sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S
Expand Up @@ -28,6 +28,10 @@

#include <sysdep.h>

#ifndef MEMSET_CHK_SYMBOL
# define MEMSET_CHK_SYMBOL(p,s) MEMSET_SYMBOL(p, s)
#endif

#ifndef VZEROUPPER
# if VEC_SIZE > 16
# define VZEROUPPER vzeroupper
Expand Down Expand Up @@ -66,8 +70,8 @@
# error SECTION is not defined!
#endif

#if !defined USE_MULTIARCH && IS_IN (libc)
.section SECTION(.text),"ax",@progbits
#if VEC_SIZE == 16 && IS_IN (libc) && 0
ENTRY (__bzero)
movq %rdi, %rax /* Set return value. */
movq %rsi, %rdx /* Set n. */
Expand All @@ -78,10 +82,10 @@ weak_alias (__bzero, bzero)
#endif

#if defined SHARED && IS_IN (libc)
ENTRY_CHK (MEMSET_SYMBOL (__memset_chk, unaligned))
ENTRY_CHK (MEMSET_CHK_SYMBOL (__memset_chk, unaligned))
cmpq %rdx, %rcx
jb HIDDEN_JUMPTARGET (__chk_fail)
END_CHK (MEMSET_SYMBOL (__memset_chk, unaligned))
END_CHK (MEMSET_CHK_SYMBOL (__memset_chk, unaligned))
#endif

ENTRY (MEMSET_SYMBOL (__memset, unaligned))
Expand All @@ -97,34 +101,35 @@ L(entry_from_bzero):
VMOVU %VEC(0), (%rdi)
VZEROUPPER
ret
#if defined USE_MULTIARCH && IS_IN (libc)
END (MEMSET_SYMBOL (__memset, unaligned))

#if VEC_SIZE == 16
# if VEC_SIZE == 16
/* Only used to measure performance of REP STOSB. */
ENTRY (__memset_erms)
#else
# else
/* Provide a symbol to debugger. */
ENTRY (MEMSET_SYMBOL (__memset, erms))
#endif
# endif
L(stosb):
movq %rdx, %rcx
movzbl %sil, %eax
movq %rdi, %rdx
rep stosb
movq %rdx, %rax
ret
#if VEC_SIZE == 16
# if VEC_SIZE == 16
END (__memset_erms)
#else
# else
END (MEMSET_SYMBOL (__memset, erms))
#endif
# endif

#if defined SHARED && IS_IN (libc)
ENTRY_CHK (MEMSET_SYMBOL (__memset_chk, unaligned_erms))
# if defined SHARED && IS_IN (libc)
ENTRY_CHK (MEMSET_CHK_SYMBOL (__memset_chk, unaligned_erms))
cmpq %rdx, %rcx
jb HIDDEN_JUMPTARGET (__chk_fail)
END_CHK (MEMSET_SYMBOL (__memset_chk, unaligned_erms))
#endif
END_CHK (MEMSET_CHK_SYMBOL (__memset_chk, unaligned_erms))
# endif

ENTRY (MEMSET_SYMBOL (__memset, unaligned_erms))
VDUP_TO_VEC0_AND_SET_RETURN (%esi, %rdi)
Expand All @@ -144,6 +149,7 @@ L(stosb_more_2x_vec):
/* Force 32-bit displacement to avoid long nop between
instructions. */
ja.d32 L(stosb)
#endif
.p2align 4
L(more_2x_vec):
cmpq $(VEC_SIZE * 4), %rdx
Expand Down

0 comments on commit 4af1bb0

Please sign in to comment.