[v2,03/11] i386: Remove bcopy optimizations

Message ID 20220223140921.2768062-4-adhemerval.zanella@linaro.org
State Committed
Commit 8bad328203ee79fbc2e895e2a3f17f6a221d0814
Headers
Series Remove bcopy and bzero optimizations |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Adhemerval Zanella Netto Feb. 23, 2022, 2:09 p.m. UTC
  The symbols is not present in current POSIX specification and compiler
already generates memmove call.
---
 sysdeps/i386/bcopy.S                          |   4 -
 sysdeps/i386/i686/bcopy.S                     |   3 -
 sysdeps/i386/i686/memmove.S                   |  22 +-
 sysdeps/i386/i686/multiarch/Makefile          |   6 +-
 sysdeps/i386/i686/multiarch/bcopy-ia32.S      |  20 --
 .../i686/multiarch/bcopy-sse2-unaligned.S     |   4 -
 sysdeps/i386/i686/multiarch/bcopy-ssse3-rep.S |   4 -
 sysdeps/i386/i686/multiarch/bcopy-ssse3.S     |   4 -
 sysdeps/i386/i686/multiarch/bcopy.c           |  30 ---
 sysdeps/i386/i686/multiarch/ifunc-impl-list.c |  10 -
 .../i686/multiarch/memcpy-sse2-unaligned.S    |  16 +-
 .../i386/i686/multiarch/memcpy-ssse3-rep.S    |  64 ++----
 sysdeps/i386/i686/multiarch/memcpy-ssse3.S    | 202 ++++++------------
 sysdeps/i386/memcpy.S                         |  16 +-
 14 files changed, 100 insertions(+), 305 deletions(-)
 delete mode 100644 sysdeps/i386/bcopy.S
 delete mode 100644 sysdeps/i386/i686/bcopy.S
 delete mode 100644 sysdeps/i386/i686/multiarch/bcopy-ia32.S
 delete mode 100644 sysdeps/i386/i686/multiarch/bcopy-sse2-unaligned.S
 delete mode 100644 sysdeps/i386/i686/multiarch/bcopy-ssse3-rep.S
 delete mode 100644 sysdeps/i386/i686/multiarch/bcopy-ssse3.S
 delete mode 100644 sysdeps/i386/i686/multiarch/bcopy.c
  

Patch

diff --git a/sysdeps/i386/bcopy.S b/sysdeps/i386/bcopy.S
deleted file mode 100644
index 12b8ddb886..0000000000
--- a/sysdeps/i386/bcopy.S
+++ /dev/null
@@ -1,4 +0,0 @@ 
-#define USE_AS_MEMMOVE
-#define USE_AS_BCOPY
-#define MEMCPY		bcopy
-#include "memcpy.S"
diff --git a/sysdeps/i386/i686/bcopy.S b/sysdeps/i386/i686/bcopy.S
deleted file mode 100644
index 15ef9419a4..0000000000
--- a/sysdeps/i386/i686/bcopy.S
+++ /dev/null
@@ -1,3 +0,0 @@ 
-#define USE_AS_BCOPY
-#define memmove bcopy
-#include <sysdeps/i386/i686/memmove.S>
diff --git a/sysdeps/i386/i686/memmove.S b/sysdeps/i386/i686/memmove.S
index 0301560bb8..bdc69d315a 100644
--- a/sysdeps/i386/i686/memmove.S
+++ b/sysdeps/i386/i686/memmove.S
@@ -25,22 +25,16 @@ 
 
 	.text
 
-#ifdef USE_AS_BCOPY
-# define SRC	RTN
-# define DEST	SRC+4
-# define LEN	DEST+4
-#else
-# define DEST	RTN
-# define SRC	DEST+4
-# define LEN	SRC+4
-
-# if defined PIC && IS_IN (libc)
+#define DEST	RTN
+#define SRC	DEST+4
+#define LEN	SRC+4
+
+#if defined PIC && IS_IN (libc)
 ENTRY_CHK (__memmove_chk)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)
 	jb	HIDDEN_JUMPTARGET (__chk_fail)
 END_CHK (__memmove_chk)
-# endif
 #endif
 
 ENTRY (memmove)
@@ -71,9 +65,7 @@  ENTRY (memmove)
 	movsl
 	movl	%edx, %esi
 	cfi_restore (esi)
-#ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-#endif
 
 	popl	%edi
 	cfi_adjust_cfa_offset (-4)
@@ -103,9 +95,7 @@  ENTRY (memmove)
 	movsl
 	movl	%edx, %esi
 	cfi_restore (esi)
-#ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-#endif
 
 	cld
 	popl	%edi
@@ -114,6 +104,4 @@  ENTRY (memmove)
 
 	ret
 END (memmove)
-#ifndef USE_AS_BCOPY
 libc_hidden_builtin_def (memmove)
-#endif
diff --git a/sysdeps/i386/i686/multiarch/Makefile b/sysdeps/i386/i686/multiarch/Makefile
index c4897922d7..02fa02658e 100644
--- a/sysdeps/i386/i686/multiarch/Makefile
+++ b/sysdeps/i386/i686/multiarch/Makefile
@@ -2,7 +2,7 @@  ifeq ($(subdir),string)
 gen-as-const-headers += locale-defines.sym
 sysdep_routines += bzero-sse2 memset-sse2 memcpy-ssse3 mempcpy-ssse3 \
 		   memmove-ssse3 memcpy-ssse3-rep mempcpy-ssse3-rep \
-		   memmove-ssse3-rep bcopy-ssse3 bcopy-ssse3-rep \
+		   memmove-ssse3-rep \
 		   memset-sse2-rep bzero-sse2-rep strcmp-ssse3 \
 		   strcmp-sse4 strncmp-c strncmp-ssse3 strncmp-sse4 \
 		   memcmp-ssse3 memcmp-sse4 varshift \
@@ -18,10 +18,10 @@  sysdep_routines += bzero-sse2 memset-sse2 memcpy-ssse3 mempcpy-ssse3 \
 		   strcasecmp_l-c strcasecmp-c strcasecmp_l-ssse3 \
 		   strncase_l-c strncase-c strncase_l-ssse3 \
 		   strcasecmp_l-sse4 strncase_l-sse4 \
-		   bcopy-sse2-unaligned memcpy-sse2-unaligned \
+		   memcpy-sse2-unaligned \
 		   mempcpy-sse2-unaligned memmove-sse2-unaligned \
 		   strcspn-c strpbrk-c strspn-c \
-		   bcopy-ia32 bzero-ia32 rawmemchr-ia32 \
+		   bzero-ia32 rawmemchr-ia32 \
 		   memchr-ia32 memcmp-ia32 memcpy-ia32 memmove-ia32 \
 		   mempcpy-ia32 memset-ia32 strcat-ia32 strchr-ia32 \
 		   strrchr-ia32 strcpy-ia32 strcmp-ia32 strcspn-ia32 \
diff --git a/sysdeps/i386/i686/multiarch/bcopy-ia32.S b/sysdeps/i386/i686/multiarch/bcopy-ia32.S
deleted file mode 100644
index e0fadc0f3f..0000000000
--- a/sysdeps/i386/i686/multiarch/bcopy-ia32.S
+++ /dev/null
@@ -1,20 +0,0 @@ 
-/* bcopy optimized for i686.
-   Copyright (C) 2017-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#define bcopy __bcopy_ia32
-#include <sysdeps/i386/i686/bcopy.S>
diff --git a/sysdeps/i386/i686/multiarch/bcopy-sse2-unaligned.S b/sysdeps/i386/i686/multiarch/bcopy-sse2-unaligned.S
deleted file mode 100644
index efef2a10dd..0000000000
--- a/sysdeps/i386/i686/multiarch/bcopy-sse2-unaligned.S
+++ /dev/null
@@ -1,4 +0,0 @@ 
-#define USE_AS_MEMMOVE
-#define USE_AS_BCOPY
-#define MEMCPY		__bcopy_sse2_unaligned
-#include "memcpy-sse2-unaligned.S"
diff --git a/sysdeps/i386/i686/multiarch/bcopy-ssse3-rep.S b/sysdeps/i386/i686/multiarch/bcopy-ssse3-rep.S
deleted file mode 100644
index cbc8b420e8..0000000000
--- a/sysdeps/i386/i686/multiarch/bcopy-ssse3-rep.S
+++ /dev/null
@@ -1,4 +0,0 @@ 
-#define USE_AS_MEMMOVE
-#define USE_AS_BCOPY
-#define MEMCPY		__bcopy_ssse3_rep
-#include "memcpy-ssse3-rep.S"
diff --git a/sysdeps/i386/i686/multiarch/bcopy-ssse3.S b/sysdeps/i386/i686/multiarch/bcopy-ssse3.S
deleted file mode 100644
index 36aac44b9c..0000000000
--- a/sysdeps/i386/i686/multiarch/bcopy-ssse3.S
+++ /dev/null
@@ -1,4 +0,0 @@ 
-#define USE_AS_MEMMOVE
-#define USE_AS_BCOPY
-#define MEMCPY		__bcopy_ssse3
-#include "memcpy-ssse3.S"
diff --git a/sysdeps/i386/i686/multiarch/bcopy.c b/sysdeps/i386/i686/multiarch/bcopy.c
deleted file mode 100644
index bc2c2ac55d..0000000000
--- a/sysdeps/i386/i686/multiarch/bcopy.c
+++ /dev/null
@@ -1,30 +0,0 @@ 
-/* Multiple versions of bcopy.
-   All versions must be listed in ifunc-impl-list.c.
-   Copyright (C) 2017-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-/* Define multiple versions only for the definition in libc.  */
-#if IS_IN (libc)
-# define bcopy __redirect_bcopy
-# include <string.h>
-# undef bcopy
-
-# define SYMBOL_NAME bcopy
-# include "ifunc-memmove.h"
-
-libc_ifunc_redirected (__redirect_bcopy, bcopy, IFUNC_SELECTOR ());
-#endif
diff --git a/sysdeps/i386/i686/multiarch/ifunc-impl-list.c b/sysdeps/i386/i686/multiarch/ifunc-impl-list.c
index 6883b3d226..5c7a42dc97 100644
--- a/sysdeps/i386/i686/multiarch/ifunc-impl-list.c
+++ b/sysdeps/i386/i686/multiarch/ifunc-impl-list.c
@@ -36,16 +36,6 @@  __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 
   size_t i = 0;
 
-  /* Support sysdeps/i386/i686/multiarch/bcopy.S.  */
-  IFUNC_IMPL (i, name, bcopy,
-	      IFUNC_IMPL_ADD (array, i, bcopy, CPU_FEATURE_USABLE (SSSE3),
-			      __bcopy_ssse3_rep)
-	      IFUNC_IMPL_ADD (array, i, bcopy, CPU_FEATURE_USABLE (SSSE3),
-			      __bcopy_ssse3)
-	      IFUNC_IMPL_ADD (array, i, bcopy, CPU_FEATURE_USABLE (SSE2),
-			      __bcopy_sse2_unaligned)
-	      IFUNC_IMPL_ADD (array, i, bcopy, 1, __bcopy_ia32))
-
   /* Support sysdeps/i386/i686/multiarch/bzero.S.  */
   IFUNC_IMPL (i, name, bzero,
 	      IFUNC_IMPL_ADD (array, i, bzero, CPU_FEATURE_USABLE (SSE2),
diff --git a/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S b/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
index 72c97a9dbe..ed1f3836a6 100644
--- a/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
+++ b/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
@@ -29,15 +29,9 @@ 
 #  define MEMCPY_CHK	__memcpy_chk_sse2_unaligned
 # endif
 
-# ifdef USE_AS_BCOPY
-#  define SRC		PARMS
-#  define DEST		SRC+4
-#  define LEN		DEST+4
-# else
-#  define DEST		PARMS
-#  define SRC		DEST+4
-#  define LEN		SRC+4
-# endif
+# define DEST		PARMS
+# define SRC		DEST+4
+# define LEN		SRC+4
 
 # define CFI_PUSH(REG)		\
   cfi_adjust_cfa_offset (4);		\
@@ -56,7 +50,7 @@ 
 # define RETURN	RETURN_END; CFI_PUSH (%ebx)
 
 	.section .text.sse2,"ax",@progbits
-# if !defined USE_AS_BCOPY && defined SHARED
+# if defined SHARED
 ENTRY (MEMCPY_CHK)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)
@@ -671,7 +665,7 @@  L(len_5_8_bytes):
 
 L(return):
 	movl	%edx, %eax
-# if !defined USE_AS_BCOPY && defined USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
 # endif
diff --git a/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S b/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
index 38fc56db71..8e3c67d8e1 100644
--- a/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
+++ b/sysdeps/i386/i686/multiarch/memcpy-ssse3-rep.S
@@ -30,15 +30,9 @@ 
 # define MEMCPY_CHK	__memcpy_chk_ssse3_rep
 #endif
 
-#ifdef USE_AS_BCOPY
-# define SRC		PARMS
-# define DEST		SRC+4
-# define LEN		DEST+4
-#else
-# define DEST		PARMS
-# define SRC		DEST+4
-# define LEN		SRC+4
-#endif
+#define DEST		PARMS
+#define SRC		DEST+4
+#define LEN		SRC+4
 
 #define CFI_PUSH(REG)						\
   cfi_adjust_cfa_offset (4);					\
@@ -99,7 +93,7 @@ 
 #endif
 
 	.section .text.ssse3,"ax",@progbits
-#if !defined USE_AS_BCOPY && defined SHARED
+#ifdef SHARED
 ENTRY (MEMCPY_CHK)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)
@@ -1097,12 +1091,10 @@  L(fwd_write_4bytes):
 	movl	-4(%eax), %ecx
 	movl	%ecx, -4(%edx)
 L(fwd_write_0bytes):
-#ifndef USE_AS_BCOPY
-# ifdef USE_AS_MEMPCPY
+#ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-# else
+#else
 	movl	DEST(%esp), %eax
-# endif
 #endif
 	RETURN
 
@@ -1112,12 +1104,10 @@  L(fwd_write_5bytes):
 	movl	-4(%eax), %eax
 	movl	%ecx, -5(%edx)
 	movl	%eax, -4(%edx)
-#ifndef USE_AS_BCOPY
-# ifdef USE_AS_MEMPCPY
+#ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-# else
+#else
 	movl	DEST(%esp), %eax
-# endif
 #endif
 	RETURN
 
@@ -1157,12 +1147,10 @@  L(fwd_write_9bytes):
 L(fwd_write_1bytes):
 	movzbl	-1(%eax), %ecx
 	movb	%cl, -1(%edx)
-#ifndef USE_AS_BCOPY
-# ifdef USE_AS_MEMPCPY
+#ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-# else
+#else
 	movl	DEST(%esp), %eax
-# endif
 #endif
 	RETURN
 
@@ -1203,12 +1191,10 @@  L(fwd_write_6bytes):
 L(fwd_write_2bytes):
 	movzwl	-2(%eax), %ecx
 	movw	%cx, -2(%edx)
-#ifndef USE_AS_BCOPY
-# ifdef USE_AS_MEMPCPY
+#ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-# else
+#else
 	movl	DEST(%esp), %eax
-# endif
 #endif
 	RETURN
 
@@ -1251,12 +1237,10 @@  L(fwd_write_3bytes):
 	movzbl	-1(%eax), %eax
 	movw	%cx, -3(%edx)
 	movb	%al, -1(%edx)
-#ifndef USE_AS_BCOPY
-# ifdef USE_AS_MEMPCPY
+#ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-# else
+#else
 	movl	DEST(%esp), %eax
-# endif
 #endif
 	RETURN_END
 
@@ -1357,12 +1341,10 @@  L(copy_page_by_rep_left_1):
 L(copy_page_by_rep_exit):
 	POP (%esi)
 	POP (%edi)
-#ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-# ifdef USE_AS_MEMPCPY
+#ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-# endif
 #endif
 	RETURN
 
@@ -1401,12 +1383,10 @@  L(bk_write_4bytes):
 	movl	(%eax), %ecx
 	movl	%ecx, (%edx)
 L(bk_write_0bytes):
-#ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-# ifdef USE_AS_MEMPCPY
+#ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-# endif
 #endif
 	RETURN
 
@@ -1447,12 +1427,10 @@  L(bk_write_5bytes):
 L(bk_write_1bytes):
 	movzbl	(%eax), %ecx
 	movb	%cl, (%edx)
-#ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-# ifdef USE_AS_MEMPCPY
+#ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-# endif
 #endif
 	RETURN
 
@@ -1493,12 +1471,10 @@  L(bk_write_6bytes):
 L(bk_write_2bytes):
 	movzwl	(%eax), %ecx
 	movw	%cx, (%edx)
-#ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-# ifdef USE_AS_MEMPCPY
+#ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-# endif
 #endif
 	RETURN
 
@@ -1541,12 +1517,10 @@  L(bk_write_3bytes):
 	movw	%cx, 1(%edx)
 	movzbl	(%eax), %eax
 	movb	%al, (%edx)
-#ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-# ifdef USE_AS_MEMPCPY
+#ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-# endif
 #endif
 	RETURN_END
 
diff --git a/sysdeps/i386/i686/multiarch/memcpy-ssse3.S b/sysdeps/i386/i686/multiarch/memcpy-ssse3.S
index 62ae4a8d65..18c0913e5d 100644
--- a/sysdeps/i386/i686/multiarch/memcpy-ssse3.S
+++ b/sysdeps/i386/i686/multiarch/memcpy-ssse3.S
@@ -29,15 +29,9 @@ 
 #  define MEMCPY_CHK	__memcpy_chk_ssse3
 # endif
 
-# ifdef USE_AS_BCOPY
-#  define SRC		PARMS
-#  define DEST		SRC+4
-#  define LEN		DEST+4
-# else
-#  define DEST		PARMS
-#  define SRC		DEST+4
-#  define LEN		SRC+4
-# endif
+# define DEST		PARMS
+# define SRC		DEST+4
+# define LEN		SRC+4
 
 # define CFI_PUSH(REG)		\
   cfi_adjust_cfa_offset (4);		\
@@ -88,7 +82,7 @@ 
 # endif
 
 	.section .text.ssse3,"ax",@progbits
-# if !defined USE_AS_BCOPY && defined SHARED
+# ifdef SHARED
 ENTRY (MEMCPY_CHK)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)
@@ -1979,12 +1973,10 @@  L(fwd_write_12bytes):
 L(fwd_write_4bytes):
 	movl	-4(%eax), %ecx
 	movl	%ecx, -4(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2005,12 +1997,10 @@  L(fwd_write_8bytes):
 	movq	-8(%eax), %xmm0
 	movq	%xmm0, -8(%edx)
 L(fwd_write_0bytes):
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2020,12 +2010,10 @@  L(fwd_write_5bytes):
 	movl	-4(%eax), %eax
 	movl	%ecx, -5(%edx)
 	movl	%eax, -4(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2049,12 +2037,10 @@  L(fwd_write_13bytes):
 	movl	%ecx, -5(%edx)
 	movzbl	-1(%eax), %ecx
 	movb	%cl, -1(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2077,12 +2063,10 @@  L(fwd_write_9bytes):
 L(fwd_write_1bytes):
 	movzbl	-1(%eax), %ecx
 	movb	%cl, -1(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2107,12 +2091,10 @@  L(fwd_write_6bytes):
 	movl	%ecx, -6(%edx)
 	movzwl	-2(%eax), %ecx
 	movw	%cx, -2(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2135,12 +2117,10 @@  L(fwd_write_10bytes):
 L(fwd_write_2bytes):
 	movzwl	-2(%eax), %ecx
 	movw	%cx, -2(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2167,12 +2147,10 @@  L(fwd_write_7bytes):
 	movzbl	-1(%eax), %eax
 	movw	%cx, -3(%edx)
 	movb	%al, -1(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2197,12 +2175,10 @@  L(fwd_write_3bytes):
 	movzbl	-1(%eax), %eax
 	movw	%cx, -3(%edx)
 	movb	%al, -1(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2217,12 +2193,10 @@  L(fwd_write_8bytes_align):
 	movq	-8(%eax), %xmm0
 	movq	%xmm0, -8(%edx)
 L(fwd_write_0bytes_align):
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2233,12 +2207,10 @@  L(fwd_write_32bytes_align):
 L(fwd_write_16bytes_align):
 	movdqa	-16(%eax), %xmm0
 	movdqa	%xmm0, -16(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2248,12 +2220,10 @@  L(fwd_write_5bytes_align):
 	movl	-4(%eax), %eax
 	movl	%ecx, -5(%edx)
 	movl	%eax, -4(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2271,12 +2241,10 @@  L(fwd_write_13bytes_align):
 	movl	%ecx, -5(%edx)
 	movzbl	-1(%eax), %ecx
 	movb	%cl, -1(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2291,12 +2259,10 @@  L(fwd_write_21bytes_align):
 	movl	%ecx, -5(%edx)
 	movzbl	-1(%eax), %ecx
 	movb	%cl, -1(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2313,12 +2279,10 @@  L(fwd_write_9bytes_align):
 L(fwd_write_1bytes_align):
 	movzbl	-1(%eax), %ecx
 	movb	%cl, -1(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2331,12 +2295,10 @@  L(fwd_write_17bytes_align):
 	movdqa	%xmm0, -17(%edx)
 	movzbl	-1(%eax), %ecx
 	movb	%cl, -1(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2355,12 +2317,10 @@  L(fwd_write_6bytes_align):
 	movl	%ecx, -6(%edx)
 	movzwl	-2(%eax), %ecx
 	movw	%cx, -2(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2375,12 +2335,10 @@  L(fwd_write_22bytes_align):
 	movl	%ecx, -6(%edx)
 	movzwl	-2(%eax), %ecx
 	movw	%cx, -2(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2397,12 +2355,10 @@  L(fwd_write_10bytes_align):
 L(fwd_write_2bytes_align):
 	movzwl	-2(%eax), %ecx
 	movw	%cx, -2(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2415,12 +2371,10 @@  L(fwd_write_18bytes_align):
 	movdqa	%xmm0, -18(%edx)
 	movzwl	-2(%eax), %ecx
 	movw	%cx, -2(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2441,12 +2395,10 @@  L(fwd_write_7bytes_align):
 	movzbl	-1(%eax), %eax
 	movw	%cx, -3(%edx)
 	movb	%al, -1(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2463,12 +2415,10 @@  L(fwd_write_23bytes_align):
 	movzbl	-1(%eax), %eax
 	movw	%cx, -3(%edx)
 	movb	%al, -1(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2487,12 +2437,10 @@  L(fwd_write_3bytes_align):
 	movzbl	-1(%eax), %eax
 	movw	%cx, -3(%edx)
 	movb	%al, -1(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2507,12 +2455,10 @@  L(fwd_write_19bytes_align):
 	movzbl	-1(%eax), %eax
 	movw	%cx, -3(%edx)
 	movb	%al, -1(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2529,12 +2475,10 @@  L(fwd_write_12bytes_align):
 L(fwd_write_4bytes_align):
 	movl	-4(%eax), %ecx
 	movl	%ecx, -4(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN
 
@@ -2547,12 +2491,10 @@  L(fwd_write_20bytes_align):
 	movdqa	%xmm0, -20(%edx)
 	movl	-4(%eax), %ecx
 	movl	%ecx, -4(%edx)
-# ifndef USE_AS_BCOPY
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	%edx, %eax
-#  else
+# else
 	movl	DEST(%esp), %eax
-#  endif
 # endif
 	RETURN_END
 
@@ -2646,12 +2588,10 @@  L(bk_write_4bytes):
 	movl	(%eax), %ecx
 	movl	%ecx, (%edx)
 L(bk_write_0bytes):
-# ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-#  endif
 # endif
 	RETURN
 
@@ -2671,12 +2611,10 @@  L(bk_write_16bytes):
 L(bk_write_8bytes):
 	movq	(%eax), %xmm0
 	movq	%xmm0, (%edx)
-# ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-#  endif
 # endif
 	RETURN
 
@@ -2702,12 +2640,10 @@  L(bk_write_5bytes):
 L(bk_write_1bytes):
 	movzbl	(%eax), %ecx
 	movb	%cl, (%edx)
-# ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-#  endif
 # endif
 	RETURN
 
@@ -2729,12 +2665,10 @@  L(bk_write_9bytes):
 	movq	%xmm0, 1(%edx)
 	movzbl	(%eax), %ecx
 	movb	%cl, (%edx)
-# ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-#  endif
 # endif
 	RETURN
 
@@ -2759,12 +2693,10 @@  L(bk_write_6bytes):
 	movl	%ecx, 2(%edx)
 	movzwl	(%eax), %ecx
 	movw	%cx, (%edx)
-# ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-#  endif
 # endif
 	RETURN
 
@@ -2787,12 +2719,10 @@  L(bk_write_10bytes):
 L(bk_write_2bytes):
 	movzwl	(%eax), %ecx
 	movw	%cx, (%edx)
-# ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-#  endif
 # endif
 	RETURN
 
@@ -2819,12 +2749,10 @@  L(bk_write_7bytes):
 	movw	%cx, 1(%edx)
 	movzbl	(%eax), %eax
 	movb	%al, (%edx)
-# ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-#  endif
 # endif
 	RETURN
 
@@ -2849,12 +2777,10 @@  L(bk_write_3bytes):
 	movw	%cx, 1(%edx)
 	movzbl	(%eax), %eax
 	movb	%al, (%edx)
-# ifndef USE_AS_BCOPY
 	movl	DEST(%esp), %eax
-#  ifdef USE_AS_MEMPCPY
+# ifdef USE_AS_MEMPCPY
 	movl	LEN(%esp), %ecx
 	add	%ecx, %eax
-#  endif
 # endif
 	RETURN_END
 
diff --git a/sysdeps/i386/memcpy.S b/sysdeps/i386/memcpy.S
index 0eca548e3e..fc197e92a8 100644
--- a/sysdeps/i386/memcpy.S
+++ b/sysdeps/i386/memcpy.S
@@ -24,15 +24,9 @@ 
 # define MEMCPY_CHK	__memcpy_chk
 #endif
 
-#ifdef USE_AS_BCOPY
-# define STR2		12
-# define STR1		STR2+4
-# define N     		STR1+4
-#else
-# define STR1		12
-# define STR2		STR1+4
-# define N     		STR2+4
-#endif
+#define STR1		12
+#define STR2		STR1+4
+#define N     		STR2+4
 
 #define CFI_PUSH(REG)						\
   cfi_adjust_cfa_offset (4);					\
@@ -46,7 +40,7 @@ 
 #define POP(REG)	popl REG; CFI_POP (REG)
 
 	.text
-#if defined SHARED && IS_IN (libc) && !defined USE_AS_BCOPY
+#if defined SHARED && IS_IN (libc)
 ENTRY (MEMCPY_CHK)
 	movl	12(%esp), %eax
 	cmpl	%eax, 16(%esp)
@@ -90,6 +84,4 @@  L(bwd_write_0bytes):
 
 END (MEMCPY)
 
-#ifndef USE_AS_BCOPY
 libc_hidden_builtin_def (MEMCPY)
-#endif