[8/9] powerpc: refactor memcpy and mempcpy IFUNC.

Message ID 5f91c4aa981ac0a2c0747b0e6510eb41707ea87e.1491252969.git.wainersm@linux.vnet.ibm.com
State New
Headers show

Commit Message

Wainer dos Santos Moschetta April 3, 2017, 9:19 p.m.
2017-04-03  Wainer dos Santos Moschetta  <wainersm@linux.vnet.ibm.com>

	* sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S: Define the
	implementation-specific function name and remove unneeded
	macros definition.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/mempcpy-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/a2/memcpy.S: Set a default function
	name if not defined and pass as parameter to macros accordingly.
	* sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise.
---
 sysdeps/powerpc/powerpc64/a2/memcpy.S                |  8 ++++++--
 sysdeps/powerpc/powerpc64/cell/memcpy.S              |  8 ++++++--
 sysdeps/powerpc/powerpc64/memcpy.S                   |  8 ++++++--
 sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S      | 16 +---------------
 sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S    | 16 +---------------
 sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S  | 16 +---------------
 sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S  | 16 +---------------
 sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S  | 16 +---------------
 sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S   | 16 +---------------
 sysdeps/powerpc/powerpc64/multiarch/mempcpy-power7.S | 16 +---------------
 sysdeps/powerpc/powerpc64/power4/memcpy.S            |  7 +++++--
 sysdeps/powerpc/powerpc64/power6/memcpy.S            |  7 +++++--
 sysdeps/powerpc/powerpc64/power7/memcpy.S            |  8 ++++++--
 sysdeps/powerpc/powerpc64/power7/mempcpy.S           |  7 +++++--
 14 files changed, 46 insertions(+), 119 deletions(-)

Patch

diff --git a/sysdeps/powerpc/powerpc64/a2/memcpy.S b/sysdeps/powerpc/powerpc64/a2/memcpy.S
index eb30608..ff30898 100644
--- a/sysdeps/powerpc/powerpc64/a2/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/a2/memcpy.S
@@ -19,6 +19,10 @@ 
 
 #include <sysdep.h>
 
+#ifndef MEMCPY
+# define MEMCPY memcpy
+#endif
+
 #define PREFETCH_AHEAD 4        /* no cache lines SRC prefetching ahead  */
 #define ZERO_AHEAD 2            /* no cache lines DST zeroing ahead  */
 
@@ -30,7 +34,7 @@ 
 
 
 	.machine  a2
-EALIGN (memcpy, 5, 0)
+EALIGN (MEMCPY, 5, 0)
 	CALL_MCOUNT 3
 
 	dcbt    0,r4            /* Prefetch ONE SRC cacheline  */
@@ -520,5 +524,5 @@  L(endloop2_128):
 	b       L(lessthancacheline)
 
 
-END_GEN_TB (memcpy,TB_TOCLESS)
+END_GEN_TB (MEMCPY,TB_TOCLESS)
 libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/powerpc/powerpc64/cell/memcpy.S b/sysdeps/powerpc/powerpc64/cell/memcpy.S
index e163a5c..1cc6645 100644
--- a/sysdeps/powerpc/powerpc64/cell/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/cell/memcpy.S
@@ -18,6 +18,10 @@ 
 
 #include <sysdep.h>
 
+#ifndef MEMCPY
+# define MEMCPY memcpy
+#endif
+
 #define PREFETCH_AHEAD 6	/* no cache lines SRC prefetching ahead  */
 #define ZERO_AHEAD 4		/* no cache lines DST zeroing ahead  */
 
@@ -39,7 +43,7 @@ 
 
 .align  7
 
-EALIGN (memcpy, 5, 0)
+EALIGN (MEMCPY, 5, 0)
 	CALL_MCOUNT 3
 
 	dcbt	0,r4		/* Prefetch ONE SRC cacheline  */
@@ -238,5 +242,5 @@  EALIGN (memcpy, 5, 0)
 	stb	r0,0(r6)
 1:	blr
 
-END_GEN_TB (memcpy,TB_TOCLESS)
+END_GEN_TB (MEMCPY,TB_TOCLESS)
 libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/powerpc/powerpc64/memcpy.S b/sysdeps/powerpc/powerpc64/memcpy.S
index 1b6d806..a4c82c3 100644
--- a/sysdeps/powerpc/powerpc64/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/memcpy.S
@@ -33,7 +33,11 @@ 
    possible when both source and destination are doubleword aligned.
    Each case has a optimized unrolled loop.   */
 
-EALIGN (memcpy, 5, 0)
+#ifndef MEMCPY
+# define MEMCPY memcpy
+#endif
+
+EALIGN (MEMCPY, 5, 0)
 	CALL_MCOUNT 3
 
     cmpldi cr1,5,31
@@ -389,5 +393,5 @@  EALIGN (memcpy, 5, 0)
     ld 31,-8(1)
     ld 3,-16(1)
     blr
-END_GEN_TB (memcpy,TB_TOCLESS)
+END_GEN_TB (MEMCPY,TB_TOCLESS)
 libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S
index 7311762..a942287 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S
@@ -18,21 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__memcpy_a2)						\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__memcpy_a2):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memcpy_a2)
-
-#undef END_GEN_TB
-#define END_GEN_TB(name, mask)					\
-  cfi_endproc;							\
-  TRACEBACK_MASK(__memcpy_a2,mask)				\
-  END_2(__memcpy_a2)
+#define MEMCPY __memcpy_a2
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S
index dd1a7f1..39aa30c 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S
@@ -18,21 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__memcpy_cell)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__memcpy_cell):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memcpy_cell)
-
-#undef END_GEN_TB
-#define END_GEN_TB(name, mask)					\
-  cfi_endproc;							\
-  TRACEBACK_MASK(__memcpy_cell,mask)				\
-  END_2(__memcpy_cell)
+#define MEMCPY __memcpy_cell
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S
index de86da4..6e7fea3 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S
@@ -18,21 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__memcpy_power4)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__memcpy_power4):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memcpy_power4)
-
-#undef END_GEN_TB
-#define END_GEN_TB(name, mask)					\
-  cfi_endproc;							\
-  TRACEBACK_MASK(__memcpy_power4,mask)				\
-  END_2(__memcpy_power4)
+#define MEMCPY __memcpy_power4
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S
index 8c2ef7c..40bcdb1 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S
@@ -18,21 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__memcpy_power6)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__memcpy_power6):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memcpy_power6)
-
-#undef END_GEN_TB
-#define END_GEN_TB(name, mask)					\
-  cfi_endproc;							\
-  TRACEBACK_MASK(__memcpy_power6,mask)				\
-  END_2(__memcpy_power6)
+#define MEMCPY __memcpy_power6
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S
index 7751b33..222936a 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S
@@ -18,21 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__memcpy_power7)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__memcpy_power7):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memcpy_power7)
-
-#undef END_GEN_TB
-#define END_GEN_TB(name, mask)					\
-  cfi_endproc;							\
-  TRACEBACK_MASK(__memcpy_power7,mask)				\
-  END_2(__memcpy_power7)
+#define MEMCPY __memcpy_power7
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S
index 16f9f1b..2dc644c 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S
@@ -19,21 +19,7 @@ 
 #include <sysdep.h>
 
 #if defined SHARED && IS_IN (libc)
-# undef EALIGN
-# define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__memcpy_ppc)						\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__memcpy_ppc):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memcpy_ppc)
-
-# undef END_GEN_TB
-# define END_GEN_TB(name, mask)					\
-   cfi_endproc;							\
-   TRACEBACK_MASK(__memcpy_ppc,mask)				\
-   END_2(__memcpy_ppc)
+# define MEMCPY __memcpy_ppc
 
 # undef libc_hidden_builtin_def
 # define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/mempcpy-power7.S b/sysdeps/powerpc/powerpc64/multiarch/mempcpy-power7.S
index 27fa52c..08f1336 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/mempcpy-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/mempcpy-power7.S
@@ -18,21 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__mempcpy_power7)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__mempcpy_power7):					\
-  cfi_startproc;						\
-  LOCALENTRY(__mempcpy_power7)
-
-#undef END_GEN_TB
-#define END_GEN_TB(name, mask)					\
-  cfi_endproc;							\
-  TRACEBACK_MASK(__mempcpy_power7,mask)				\
-  END_2(__mempcpy_power7)
+#define MEMPCPY __mempcpy_power7
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/power4/memcpy.S b/sysdeps/powerpc/powerpc64/power4/memcpy.S
index ff9db25..2e96376 100644
--- a/sysdeps/powerpc/powerpc64/power4/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/power4/memcpy.S
@@ -33,8 +33,11 @@ 
    possible when both source and destination are doubleword aligned.
    Each case has a optimized unrolled loop.   */
 
+#ifndef MEMCPY
+# define MEMCPY memcpy
+#endif
 	.machine power4
-EALIGN (memcpy, 5, 0)
+EALIGN (MEMCPY, 5, 0)
 	CALL_MCOUNT 3
 
     cmpldi cr1,5,31
@@ -470,5 +473,5 @@  EALIGN (memcpy, 5, 0)
     ld 31,-8(1)
     ld 3,-16(1)
     blr
-END_GEN_TB (memcpy,TB_TOCLESS)
+END_GEN_TB (MEMCPY,TB_TOCLESS)
 libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/powerpc/powerpc64/power6/memcpy.S b/sysdeps/powerpc/powerpc64/power6/memcpy.S
index f5e770a..1f7294b 100644
--- a/sysdeps/powerpc/powerpc64/power6/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/power6/memcpy.S
@@ -40,8 +40,11 @@ 
    the source but may take a risk and only require word alignment
    for the destination.  */
 
+#ifndef MEMCPY
+# define MEMCPY memcpy
+#endif
 	.machine	"power6"
-EALIGN (memcpy, 7, 0)
+EALIGN (MEMCPY, 7, 0)
 	CALL_MCOUNT 3
 
     cmpldi cr1,5,31
@@ -1492,5 +1495,5 @@  L(du_done):
     ld 31,-8(1)
     ld 3,-16(1)
     blr
-END_GEN_TB (memcpy,TB_TOCLESS)
+END_GEN_TB (MEMCPY,TB_TOCLESS)
 libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/powerpc/powerpc64/power7/memcpy.S b/sysdeps/powerpc/powerpc64/power7/memcpy.S
index ae2db21..e08993c 100644
--- a/sysdeps/powerpc/powerpc64/power7/memcpy.S
+++ b/sysdeps/powerpc/powerpc64/power7/memcpy.S
@@ -23,12 +23,16 @@ 
 /* __ptr_t [r3] memcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
    Returns 'dst'.  */
 
+#ifndef MEMCPY
+# define MEMCPY memcpy
+#endif
+
 #define dst 11		/* Use r11 so r3 kept unchanged.  */
 #define src 4
 #define cnt 5
 
 	.machine power7
-EALIGN (memcpy, 5, 0)
+EALIGN (MEMCPY, 5, 0)
 	CALL_MCOUNT 3
 
 	cmpldi	cr1,cnt,31
@@ -422,5 +426,5 @@  L(end_unaligned_loop):
 	/* Return original DST pointer.  */
 	blr
 
-END_GEN_TB (memcpy,TB_TOCLESS)
+END_GEN_TB (MEMCPY,TB_TOCLESS)
 libc_hidden_builtin_def (memcpy)
diff --git a/sysdeps/powerpc/powerpc64/power7/mempcpy.S b/sysdeps/powerpc/powerpc64/power7/mempcpy.S
index fdf6b6f..4e15d1e 100644
--- a/sysdeps/powerpc/powerpc64/power7/mempcpy.S
+++ b/sysdeps/powerpc/powerpc64/power7/mempcpy.S
@@ -23,8 +23,11 @@ 
 /* __ptr_t [r3] __mempcpy (__ptr_t dst [r3], __ptr_t src [r4], size_t len [r5]);
     Returns 'dst' + 'len'.  */
 
+#ifndef MEMPCPY
+# define MEMPCPY __mempcpy
+#endif
 	.machine  power7
-EALIGN (__mempcpy, 5, 0)
+EALIGN (MEMPCPY, 5, 0)
 	CALL_MCOUNT 3
 
 	cmpldi	cr1,5,31
@@ -463,7 +466,7 @@  L(end_unaligned_loop):
 	add	3,3,5
 	blr
 
-END_GEN_TB (__mempcpy,TB_TOCLESS)
+END_GEN_TB (MEMPCPY,TB_TOCLESS)
 libc_hidden_def (__mempcpy)
 weak_alias (__mempcpy, mempcpy)
 libc_hidden_builtin_def (mempcpy)