[4/9] powerpc: refactor strchr, strchrnul, and strrchr IFUNC.

Submitted by Wainer dos Santos Moschetta on April 3, 2017, 9:19 p.m.

Details

Message ID 7cab5500088837430ef6df3dc7dbb4dd68b66010.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/strchr-power7.S: Define the
	implementation-specific function name and remove unneeded macros definition.
	* sysdeps/powerpc/powerpc64/multiarch/strchr-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strchr-ppc64.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strchrnul-power8.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strrchr-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strchr.S: Set a default function name
	if not defined and pass as parameter to macros accordingly.
	* sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/strchr.S: Likewise.
---
 sysdeps/powerpc/powerpc64/multiarch/strchr-power7.S    | 15 +--------------
 sysdeps/powerpc/powerpc64/multiarch/strchr-power8.S    | 15 +--------------
 sysdeps/powerpc/powerpc64/multiarch/strchr-ppc64.S     | 15 +--------------
 sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S | 15 +--------------
 sysdeps/powerpc/powerpc64/multiarch/strchrnul-power8.S | 15 +--------------
 sysdeps/powerpc/powerpc64/multiarch/strrchr-power7.S   | 15 +--------------
 sysdeps/powerpc/powerpc64/power7/strchr.S              |  8 ++++++--
 sysdeps/powerpc/powerpc64/power7/strchrnul.S           | 11 +++++++----
 sysdeps/powerpc/powerpc64/power7/strrchr.S             |  9 +++++++--
 sysdeps/powerpc/powerpc64/power8/strchr.S              | 15 ++++++++++++---
 sysdeps/powerpc/powerpc64/strchr.S                     |  8 ++++++--
 11 files changed, 44 insertions(+), 97 deletions(-)

Comments

Tulio Magno Quites Machado Filho April 11, 2017, 6:21 p.m.
Wainer dos Santos Moschetta <wainersm@linux.vnet.ibm.com> writes:

> diff --git a/sysdeps/powerpc/powerpc64/power7/strchrnul.S b/sysdeps/powerpc/powerpc64/power7/strchrnul.S
> index 99aa157..8a87aea 100644
> --- a/sysdeps/powerpc/powerpc64/power7/strchrnul.S
> +++ b/sysdeps/powerpc/powerpc64/power7/strchrnul.S
> @@ -19,9 +19,12 @@
>
>  #include <sysdep.h>
>
> +#ifndef STRCHRNUL
> +# def STRCHRNUL __strchrnul

Oops.  There is a typo here.
I'll fix it before pushing it.

Patch hide | download patch | download mbox

diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchr-power7.S b/sysdeps/powerpc/powerpc64/multiarch/strchr-power7.S
index c0228dc..e64c0b7 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strchr-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strchr-power7.S
@@ -18,20 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef ENTRY
-#define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__strchr_power7)					\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__strchr_power7):					\
-  cfi_startproc;						\
-  LOCALENTRY(__strchr_power7)
-
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strchr_power7)					\
-  END_2(__strchr_power7)
+#define STRCHR __strchr_power7
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchr-power8.S b/sysdeps/powerpc/powerpc64/multiarch/strchr-power8.S
index 461b8a9..bbda7b0 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strchr-power8.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strchr-power8.S
@@ -18,20 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef ENTRY
-#define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__strchr_power8)					\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__strchr_power8):					\
-  cfi_startproc;						\
-  LOCALENTRY(__strchr_power8)
-
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strchr_power8)					\
-  END_2(__strchr_power8)
+#define STRCHR __strchr_power8
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchr-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/strchr-ppc64.S
index 9354239..769f9f0 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strchr-ppc64.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strchr-ppc64.S
@@ -19,20 +19,7 @@ 
 #include <sysdep.h>
 
 #ifdef SHARED
-# undef ENTRY
-# define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__strchr_ppc)						\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__strchr_ppc):					\
-  cfi_startproc;						\
-  LOCALENTRY(__strchr_ppc)
-
-# undef END
-# define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strchr_ppc)					\
-  END_2(__strchr_ppc)
+# define STRCHR __strchr_ppc
 
 # undef libc_hidden_builtin_def
 # define libc_hidden_builtin_def(name)				\
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S b/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S
index 57186f2..c8e2872 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S
@@ -18,20 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef ENTRY
-#define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__strchrnul_power7)					\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__strchrnul_power7):				\
-  cfi_startproc;						\
-  LOCALENTRY(__strchrnul_power7)
-
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strchrnul_power7)					\
-  END_2(__strchrnul_power7)
+#define STRCHRNUL __strchrnul_power7
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power8.S b/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power8.S
index 5a701c7..1cd39fc 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power8.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strchrnul-power8.S
@@ -18,20 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef ENTRY
-#define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__strchrnul_power8)					\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__strchrnul_power8):				\
-  cfi_startproc;						\
-  LOCALENTRY(__strchrnul_power8)
-
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strchrnul_power8)					\
-  END_2(__strchrnul_power8)
+#define STRCHRNUL __strchrnul_power8
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strrchr-power7.S b/sysdeps/powerpc/powerpc64/multiarch/strrchr-power7.S
index 841b933..10bab2e 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strrchr-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strrchr-power7.S
@@ -18,20 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef ENTRY
-#define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__strrchr_power7)					\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__strrchr_power7):					\
-  cfi_startproc;						\
-  LOCALENTRY(__strrchr_power7)
-
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strrchr_power7)					\
-  END_2(__strrchr_power7)
+#define STRRCHR __strrchr_power7
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/power7/strchr.S b/sysdeps/powerpc/powerpc64/power7/strchr.S
index 9a210c9..a18e2e1 100644
--- a/sysdeps/powerpc/powerpc64/power7/strchr.S
+++ b/sysdeps/powerpc/powerpc64/power7/strchr.S
@@ -19,9 +19,13 @@ 
 
 #include <sysdep.h>
 
+#ifndef STRCHR
+# define STRCHR strchr
+#endif
+
 /* int [r3] strchr (char *s [r3], int c [r4])  */
 	.machine  power7
-ENTRY (strchr)
+ENTRY (STRCHR)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 	clrrdi	r8,r3,3	      /* Align the address to doubleword boundary.  */
@@ -221,6 +225,6 @@  L(done_null):
 	srdi	r0,r0,3	      /* Convert leading zeros to bytes.  */
 	add	r3,r8,r0      /* Return address of the matching null byte.  */
 	blr
-END (strchr)
+END (STRCHR)
 weak_alias (strchr, index)
 libc_hidden_builtin_def (strchr)
diff --git a/sysdeps/powerpc/powerpc64/power7/strchrnul.S b/sysdeps/powerpc/powerpc64/power7/strchrnul.S
index 99aa157..8a87aea 100644
--- a/sysdeps/powerpc/powerpc64/power7/strchrnul.S
+++ b/sysdeps/powerpc/powerpc64/power7/strchrnul.S
@@ -19,9 +19,12 @@ 
 
 #include <sysdep.h>
 
+#ifndef STRCHRNUL
+# def STRCHRNUL __strchrnul
+#endif
 /* int [r3] strchrnul (char *s [r3], int c [r4])  */
 	.machine  power7
-ENTRY (__strchrnul)
+ENTRY (STRCHRNUL)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 	clrrdi	r8,r3,3	      /* Align the address to doubleword boundary.  */
@@ -123,6 +126,6 @@  L(done):
 	srdi	r0,r0,3	      /* Convert leading zeros to bytes.  */
 	add	r3,r8,r0      /* Return address of matching c/null byte.  */
 	blr
-END (__strchrnul)
-weak_alias (__strchrnul,strchrnul)
-libc_hidden_builtin_def (__strchrnul)
+END (STRCHRNUL)
+weak_alias (STRCHRNUL, strchrnul)
+libc_hidden_builtin_def (STRCHRNUL)
diff --git a/sysdeps/powerpc/powerpc64/power7/strrchr.S b/sysdeps/powerpc/powerpc64/power7/strrchr.S
index ee20122..c22393d 100644
--- a/sysdeps/powerpc/powerpc64/power7/strrchr.S
+++ b/sysdeps/powerpc/powerpc64/power7/strrchr.S
@@ -19,8 +19,13 @@ 
 #include <sysdep.h>
 
 /* int [r3] strrchr (char *s [r3], int c [r4])  */
+
+#ifndef STRRCHR
+# define STRRCHR strrchr
+#endif
+
 	.machine  power7
-ENTRY (strrchr)
+ENTRY (STRRCHR)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 	clrrdi	r8,r3,3	      /* Align the address to doubleword boundary.  */
@@ -250,6 +255,6 @@  L(done_null):
 	srdi	r0,r0,3	      /* Convert trailing zeros to bytes.  */
 	add	r3,r8,r0      /* Return address of the matching null byte.  */
 	blr
-END (strrchr)
+END (STRRCHR)
 weak_alias (strrchr, rindex)
 libc_hidden_builtin_def (strrchr)
diff --git a/sysdeps/powerpc/powerpc64/power8/strchr.S b/sysdeps/powerpc/powerpc64/power8/strchr.S
index 5d6fa5d..e0c185c 100644
--- a/sysdeps/powerpc/powerpc64/power8/strchr.S
+++ b/sysdeps/powerpc/powerpc64/power8/strchr.S
@@ -19,10 +19,19 @@ 
 #include <sysdep.h>
 
 #ifdef USE_AS_STRCHRNUL
-# define FUNC_NAME __strchrnul
+# ifndef STRCHRNUL
+#   define FUNC_NAME __strchrnul
+# else
+#   define FUNC_NAME STRCHRNUL
+# endif
 #else
-# define FUNC_NAME strchr
-#endif
+# ifndef STRCHR
+#  define FUNC_NAME strchr
+# else
+#  define FUNC_NAME STRCHR
+# endif
+#endif  /* !USE_AS_STRCHRNUL  */
+
 /* int [r3] strchr (char *s [r3], int c [r4])  */
 /* TODO: change these to the actual instructions when the minimum required
    binutils allows it.  */
diff --git a/sysdeps/powerpc/powerpc64/strchr.S b/sysdeps/powerpc/powerpc64/strchr.S
index dc5ddb1..cbfcc14 100644
--- a/sysdeps/powerpc/powerpc64/strchr.S
+++ b/sysdeps/powerpc/powerpc64/strchr.S
@@ -22,7 +22,11 @@ 
 
 /* char * [r3] strchr (const char *s [r3] , int c [r4] )  */
 
-ENTRY (strchr)
+#ifndef STRCHR
+# define STRCHR strchr
+#endif
+
+ENTRY (STRCHR)
 	CALL_MCOUNT 2
 
 #define rTMP1	r0
@@ -145,7 +149,7 @@  L(foundit):
 #endif
 	add	rRTN, rSTR, rCLZB
 	blr
-END (strchr)
+END (STRCHR)
 
 weak_alias (strchr, index)
 libc_hidden_builtin_def (strchr)