[6/9] powerpc: refactor memset IFUNC.

Message ID 05bb871835a2b8c62c228efb8fd204a83f026ea0.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/memset-power4.S: Define the
	implementation-specific function name and remove unneeded macros definition.
	* sysdeps/powerpc/powerpc64/multiarch/memset-power6.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memset-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memset-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/memset.S: Set a default function name if
	not defined and pass as parameter to macros accordingly.
	* sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power6/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memset.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/memset.S: Likewise.
---
 sysdeps/powerpc/powerpc64/memset.S                  |  8 ++++++--
 sysdeps/powerpc/powerpc64/multiarch/memset-power4.S | 16 +---------------
 sysdeps/powerpc/powerpc64/multiarch/memset-power6.S | 16 +---------------
 sysdeps/powerpc/powerpc64/multiarch/memset-power7.S | 16 +---------------
 sysdeps/powerpc/powerpc64/multiarch/memset-power8.S | 16 +---------------
 sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S  | 16 +---------------
 sysdeps/powerpc/powerpc64/power4/memset.S           |  7 +++++--
 sysdeps/powerpc/powerpc64/power6/memset.S           |  7 +++++--
 sysdeps/powerpc/powerpc64/power7/memset.S           |  7 +++++--
 sysdeps/powerpc/powerpc64/power8/memset.S           |  8 ++++++--
 10 files changed, 32 insertions(+), 85 deletions(-)

Patch

diff --git a/sysdeps/powerpc/powerpc64/memset.S b/sysdeps/powerpc/powerpc64/memset.S
index 9a3c31e..f6581b5 100644
--- a/sysdeps/powerpc/powerpc64/memset.S
+++ b/sysdeps/powerpc/powerpc64/memset.S
@@ -31,7 +31,11 @@ 
    cache line (256 bits). There is a special case for setting cache lines
    to 0, to take advantage of the dcbz instruction.  */
 
-EALIGN (memset, 5, 0)
+#ifndef MEMSET
+# define MEMSET memset
+#endif
+
+EALIGN (MEMSET, 5, 0)
 	CALL_MCOUNT 3
 
 #define rTMP	r0
@@ -244,7 +248,7 @@  L(medium_27f):
 L(medium_28t):
 	std	rCHR, -8(rMEMP)
 	blr
-END_GEN_TB (memset,TB_TOCLESS)
+END_GEN_TB (MEMSET,TB_TOCLESS)
 libc_hidden_builtin_def (memset)
 
 #ifndef NO_BZERO_IMPL
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-power4.S b/sysdeps/powerpc/powerpc64/multiarch/memset-power4.S
index 6a11d6d..3908e8e 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-power4.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-power4.S
@@ -18,21 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__memset_power4)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__memset_power4):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memset_power4)
-
-#undef END_GEN_TB
-#define END_GEN_TB(name, mask)					\
-  cfi_endproc;							\
-  TRACEBACK_MASK(__memset_power4,mask)				\
-  END_2(__memset_power4)
+#define MEMSET __memset_power4
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-power6.S b/sysdeps/powerpc/powerpc64/multiarch/memset-power6.S
index 7791c10..4ddbd2e 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-power6.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-power6.S
@@ -18,21 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__memset_power6)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__memset_power6):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memset_power6)
-
-#undef END_GEN_TB
-#define END_GEN_TB(name, mask)					\
-  cfi_endproc;							\
-  TRACEBACK_MASK(__memset_power6,mask)				\
-  END_2(__memset_power6)
+#define MEMSET __memset_power6
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-power7.S b/sysdeps/powerpc/powerpc64/multiarch/memset-power7.S
index 1755503..97f686b 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-power7.S
@@ -18,21 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__memset_power7)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__memset_power7):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memset_power7)
-
-#undef END_GEN_TB
-#define END_GEN_TB(name, mask)					\
-  cfi_endproc;							\
-  TRACEBACK_MASK(__memset_power7,mask)				\
-  END_2(__memset_power7)
+#define MEMSET __memset_power7
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-power8.S b/sysdeps/powerpc/powerpc64/multiarch/memset-power8.S
index 70856cb..ea30353 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-power8.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-power8.S
@@ -18,21 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__memset_power8)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__memset_power8):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memset_power8)
-
-#undef END_GEN_TB
-#define END_GEN_TB(name, mask)					\
-  cfi_endproc;							\
-  TRACEBACK_MASK(__memset_power8,mask)				\
-  END_2(__memset_power8)
+#define MEMSET __memset_power8
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
index aaa2ba9..0f16e21 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S
@@ -30,21 +30,7 @@  END_GEN_TB (__bzero_ppc,TB_TOCLESS)
 
 
 #if defined SHARED && IS_IN (libc)
-# undef EALIGN
-# define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__memset_ppc)						\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__memset_ppc):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memset_ppc)
-
-# undef END_GEN_TB
-# define END_GEN_TB(name, mask)					\
-  cfi_endproc;							\
-  TRACEBACK_MASK(__memset_ppc,mask)				\
-  END_2(__memset_ppc)
+# define MEMSET __memset_ppc
 
 # undef libc_hidden_builtin_def
 # define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/power4/memset.S b/sysdeps/powerpc/powerpc64/power4/memset.S
index 6686005..a57214e 100644
--- a/sysdeps/powerpc/powerpc64/power4/memset.S
+++ b/sysdeps/powerpc/powerpc64/power4/memset.S
@@ -25,8 +25,11 @@ 
    cache line (256 bits). There is a special case for setting cache lines
    to 0, to take advantage of the dcbz instruction.  */
 
+#ifndef MEMSET
+# define MEMSET memset
+#endif
 	.machine power4
-EALIGN (memset, 5, 0)
+EALIGN (MEMSET, 5, 0)
 	CALL_MCOUNT 3
 
 #define rTMP	r0
@@ -232,7 +235,7 @@  L(medium_27f):
 L(medium_28t):
 	std	rCHR, -8(rMEMP)
 	blr
-END_GEN_TB (memset,TB_TOCLESS)
+END_GEN_TB (MEMSET,TB_TOCLESS)
 libc_hidden_builtin_def (memset)
 
 /* Copied from bzero.S to prevent the linker from inserting a stub
diff --git a/sysdeps/powerpc/powerpc64/power6/memset.S b/sysdeps/powerpc/powerpc64/power6/memset.S
index 6130a1c..aee1c8e 100644
--- a/sysdeps/powerpc/powerpc64/power6/memset.S
+++ b/sysdeps/powerpc/powerpc64/power6/memset.S
@@ -25,8 +25,11 @@ 
    cache line (256 bits). There is a special case for setting cache lines
    to 0, to take advantage of the dcbz instruction.  */
 
+#ifndef MEMSET
+# define MEMSET memset
+#endif
 	.machine power6
-EALIGN (memset, 7, 0)
+EALIGN (MEMSET, 7, 0)
 	CALL_MCOUNT 3
 
 #define rTMP	r0
@@ -376,7 +379,7 @@  L(medium_27f):
 L(medium_28t):
 	std	rCHR, -8(rMEMP)
 	blr
-END_GEN_TB (memset,TB_TOCLESS)
+END_GEN_TB (MEMSET,TB_TOCLESS)
 libc_hidden_builtin_def (memset)
 
 /* Copied from bzero.S to prevent the linker from inserting a stub
diff --git a/sysdeps/powerpc/powerpc64/power7/memset.S b/sysdeps/powerpc/powerpc64/power7/memset.S
index 2fe1757..21933c0 100644
--- a/sysdeps/powerpc/powerpc64/power7/memset.S
+++ b/sysdeps/powerpc/powerpc64/power7/memset.S
@@ -22,8 +22,11 @@ 
 /* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
    Returns 's'.  */
 
+#ifndef MEMSET
+# define MEMSET memset
+#endif
 	.machine power7
-EALIGN (memset, 5, 0)
+EALIGN (MEMSET, 5, 0)
 	CALL_MCOUNT 3
 
 L(_memset):
@@ -380,7 +383,7 @@  L(small):
 	stw	4,4(10)
 	blr
 
-END_GEN_TB (memset,TB_TOCLESS)
+END_GEN_TB (MEMSET,TB_TOCLESS)
 libc_hidden_builtin_def (memset)
 
 /* Copied from bzero.S to prevent the linker from inserting a stub
diff --git a/sysdeps/powerpc/powerpc64/power8/memset.S b/sysdeps/powerpc/powerpc64/power8/memset.S
index 5dc257d..bc734c9 100644
--- a/sysdeps/powerpc/powerpc64/power8/memset.S
+++ b/sysdeps/powerpc/powerpc64/power8/memset.S
@@ -23,11 +23,15 @@ 
 /* __ptr_t [r3] memset (__ptr_t s [r3], int c [r4], size_t n [r5]));
    Returns 's'.  */
 
+#ifndef MEMSET
+# define MEMSET memset
+#endif
+
 	/* No need to use .machine power8 since mtvsrd is already
 	   handled by the define.  It avoid breakage on binutils
 	   that does not support this machine specifier.  */
 	.machine power7
-EALIGN (memset, 5, 0)
+EALIGN (MEMSET, 5, 0)
 	CALL_MCOUNT 3
 
 L(_memset):
@@ -438,7 +442,7 @@  L(write_LE_8):
 	stw	r4,0(r10)
 	stw	r4,4(r10)
 	blr
-END_GEN_TB (memset,TB_TOCLESS)
+END_GEN_TB (MEMSET,TB_TOCLESS)
 libc_hidden_builtin_def (memset)
 
 /* Copied from bzero.S to prevent the linker from inserting a stub