[3/9] powerpc: refactor strnlen and strlen IFUNC.

Message ID e89b99bd7e48615915dc956ae3621755f974a652.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/strlen-power7.S: Define
	the strlen implementation name and remove unneeded macros definition.
	* sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S: Define
	the strnlen implementation name and remove unneeded macros definition.
	* sysdeps/powerpc/powerpc64/power7/strlen.S: Set a default function
	name if not defined and pass as parameter to macros accordingly.
	* sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise.
	* sysdeps/powerpc/powerpc64/strlen.S: Likewise.
---
 sysdeps/powerpc/powerpc64/multiarch/strlen-power7.S  | 15 +--------------
 sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S  | 15 +--------------
 sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S   | 15 +--------------
 sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S | 15 +--------------
 sysdeps/powerpc/powerpc64/power7/strlen.S            |  8 ++++++--
 sysdeps/powerpc/powerpc64/power7/strnlen.S           |  8 ++++++--
 sysdeps/powerpc/powerpc64/power8/strlen.S            |  8 ++++++--
 sysdeps/powerpc/powerpc64/strlen.S                   |  8 ++++++--
 8 files changed, 28 insertions(+), 64 deletions(-)

Patch

diff --git a/sysdeps/powerpc/powerpc64/multiarch/strlen-power7.S b/sysdeps/powerpc/powerpc64/multiarch/strlen-power7.S
index b3f0536..333496e 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strlen-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strlen-power7.S
@@ -18,20 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef ENTRY
-#define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__strlen_power7)					\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__strlen_power7):					\
-  cfi_startproc;						\
-  LOCALENTRY(__strlen_power7)
-
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strlen_power7)					\
-  END_2(__strlen_power7)
+#define STRLEN __strlen_power7
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S b/sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S
index ff9032f..b4deea5 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S
@@ -18,20 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__strlen_power8)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__strlen_power8):					\
-  cfi_startproc;						\
-  LOCALENTRY(__strlen_power8)
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strlen_power8)					\
-  END_2(__strlen_power8)
+#define STRLEN __strlen_power8
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S
index bec8036..13231b8 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S
@@ -19,20 +19,7 @@ 
 #include <sysdep.h>
 
 #if defined SHARED && IS_IN (libc)
-# undef ENTRY
-# define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__strlen_ppc)						\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__strlen_ppc):					\
-  cfi_startproc;						\
-  LOCALENTRY(__strlen_ppc)
-
-# undef END
-# define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strlen_ppc)					\
-  END_2(__strlen_ppc)
+# define STRLEN __strlen_ppc
 
 # undef libc_hidden_builtin_def
 # define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S b/sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S
index ec6ce38..2f0a183 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S
@@ -18,20 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef ENTRY
-#define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__strnlen_power7)					\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__strnlen_power7):					\
-  cfi_startproc;						\
-  LOCALENTRY(__strnlen_power7)
-
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strnlen_power7)					\
-  END_2(__strnlen_power7)
+#define STRNLEN __strnlen_power7
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/power7/strlen.S b/sysdeps/powerpc/powerpc64/power7/strlen.S
index 62db6d4..63848c4 100644
--- a/sysdeps/powerpc/powerpc64/power7/strlen.S
+++ b/sysdeps/powerpc/powerpc64/power7/strlen.S
@@ -20,8 +20,12 @@ 
 #include <sysdep.h>
 
 /* int [r3] strlen (char *s [r3])  */
+
+#ifndef STRLEN
+# define STRLEN strlen
+#endif
 	.machine  power7
-ENTRY (strlen)
+ENTRY (STRLEN)
 	CALL_MCOUNT 1
 	dcbt	0,r3
 	clrrdi	r4,r3,3	      /* Align the address to doubleword boundary.  */
@@ -99,5 +103,5 @@  L(done):
 	srdi	r0,r0,3	      /* Convert leading/trailing zeros to bytes.  */
 	add	r3,r5,r0      /* Compute final length.  */
 	blr
-END (strlen)
+END (STRLEN)
 libc_hidden_builtin_def (strlen)
diff --git a/sysdeps/powerpc/powerpc64/power7/strnlen.S b/sysdeps/powerpc/powerpc64/power7/strnlen.S
index d066ea7..a970b6c 100644
--- a/sysdeps/powerpc/powerpc64/power7/strnlen.S
+++ b/sysdeps/powerpc/powerpc64/power7/strnlen.S
@@ -19,9 +19,13 @@ 
 
 #include <sysdep.h>
 
+#ifndef STRNLEN
+# define STRNLEN __strnlen
+#endif
+
 /* int [r3] strnlen (char *s [r3], int size [r4])  */
 	.machine  power7
-ENTRY (__strnlen)
+ENTRY (STRNLEN)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 	clrrdi	r8,r3,3
@@ -172,7 +176,7 @@  L(loop_small):
 	mr	r3,r4
 	blr
 
-END (__strnlen)
+END (STRNLEN)
 libc_hidden_def (__strnlen)
 weak_alias (__strnlen, strnlen)
 libc_hidden_def (strnlen)
diff --git a/sysdeps/powerpc/powerpc64/power8/strlen.S b/sysdeps/powerpc/powerpc64/power8/strlen.S
index 2afc6b3..8f4a1fc 100644
--- a/sysdeps/powerpc/powerpc64/power8/strlen.S
+++ b/sysdeps/powerpc/powerpc64/power8/strlen.S
@@ -29,10 +29,14 @@ 
 
 /* int [r3] strlen (char *s [r3])  */
 
+#ifndef STRLEN
+# define STRLEN strlen
+#endif
+
 /* TODO: change this to .machine power8 when the minimum required binutils
    allows it.  */
 	.machine  power7
-EALIGN (strlen, 4, 0)
+EALIGN (STRLEN, 4, 0)
 	CALL_MCOUNT 1
 	dcbt	0,r3
 	clrrdi	r4,r3,3	      /* Align the address to doubleword boundary.  */
@@ -293,5 +297,5 @@  L(vmx_zero):
 	add	r3,r5,r0      /* Compute final length.  */
 	blr
 
-END (strlen)
+END (STRLEN)
 libc_hidden_builtin_def (strlen)
diff --git a/sysdeps/powerpc/powerpc64/strlen.S b/sysdeps/powerpc/powerpc64/strlen.S
index 4bd5db2..1466624 100644
--- a/sysdeps/powerpc/powerpc64/strlen.S
+++ b/sysdeps/powerpc/powerpc64/strlen.S
@@ -80,7 +80,11 @@ 
 
 /* int [r3] strlen (char *s [r3])  */
 
-ENTRY (strlen)
+#ifndef STRLEN
+# define STRLEN strlen
+#endif
+
+ENTRY (STRLEN)
 	CALL_MCOUNT 1
 
 #define rTMP4	r0
@@ -195,5 +199,5 @@  L(done1):
 	blr
 #endif
 
-END (strlen)
+END (STRLEN)
 libc_hidden_builtin_def (strlen)