Define _HAVE_STRING_ARCH_mempcpy to 1 for x86

Message ID 20160308135143.GA3849@intel.com
State New, archived
Headers

Commit Message

Lu, Hongjiu March 8, 2016, 1:51 p.m. UTC
  On Mon, Mar 07, 2016 at 12:57:35PM -0800, H.J. Lu wrote:
> Since x86 has an optimized mempcpy and GCC can inline mempcpy on x86,
> define _HAVE_STRING_ARCH_mempcpy to 1 for x86.
> 
> If duplicated code between optimized memcpy and mempcpy is a concern,
> we can add an entry point in memcpy and use it to implement mempcpy,
> similar to the set of patches for __mempcpy_sse2_unaligned:
> 
> https://sourceware.org/ml/libc-alpha/2016-03/msg00166.html
> 
> OK for master?
> 

This one actually works.  Any objections?

H.J.
---
From 9e2ed19d8c644e357c06ab56178962877c4fea5c Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 8 Mar 2016 05:04:15 -0800
Subject: [PATCH] Define _HAVE_STRING_ARCH_mempcpy to 1 for x86

Since x86 has an optimized mempcpy and GCC can inline mempcpy on x86,
define _HAVE_STRING_ARCH_mempcpy to 1 for x86.

	[BZ #19759]
	* sysdeps/x86/bits/string.h (_HAVE_STRING_ARCH_mempcpy): New.
---
 sysdeps/x86/bits/string.h | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Roland McGrath March 8, 2016, 6:51 p.m. UTC | #1
OK
  
H.J. Lu March 11, 2016, 4:13 p.m. UTC | #2
On Tue, Mar 8, 2016 at 10:51 AM, Roland McGrath <roland@hack.frob.com> wrote:
> OK

I am backporting it to 2.23 branch.
  

Patch

diff --git a/sysdeps/x86/bits/string.h b/sysdeps/x86/bits/string.h
index e4e019f..8dfce05 100644
--- a/sysdeps/x86/bits/string.h
+++ b/sysdeps/x86/bits/string.h
@@ -23,6 +23,9 @@ 
 /* Use the unaligned string inline ABI.  */
 #define _STRING_INLINE_unaligned 1
 
+/* Don't inline mempcpy into memcpy as x86 has an optimized mempcpy.  */
+#define _HAVE_STRING_ARCH_mempcpy 1
+
 /* Enable inline functions only for i486 or better when compiling for
    ia32.  */
 #if !defined __x86_64__ && (defined __i486__ || defined __pentium__	      \