[7/9] powerpc: refactor memchr, memrchr, and rawmemchr IFUNC.

Message ID 2e2fa7451ff1d6c4cfe5c43d196d7eb770efb46d.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/memchr-power7.S: Define the
        implementation-specific function name and remove unneeded macros definition.
	* sysdeps/powerpc/powerpc64/multiarch/memrchr-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/rawmemchr-power7.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/memchr.S: Set a default function name
	if not defined and pass as parameter to macros accordingly.
	* sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise.
	* sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise.
---
 sysdeps/powerpc/powerpc64/multiarch/memchr-power7.S    | 15 +--------------
 sysdeps/powerpc/powerpc64/multiarch/memrchr-power7.S   | 15 +--------------
 sysdeps/powerpc/powerpc64/multiarch/rawmemchr-power7.S | 15 +--------------
 sysdeps/powerpc/powerpc64/power7/memchr.S              |  8 ++++++--
 sysdeps/powerpc/powerpc64/power7/memrchr.S             |  8 ++++++--
 sysdeps/powerpc/powerpc64/power7/rawmemchr.S           |  8 ++++++--
 6 files changed, 21 insertions(+), 48 deletions(-)

Patch

diff --git a/sysdeps/powerpc/powerpc64/multiarch/memchr-power7.S b/sysdeps/powerpc/powerpc64/multiarch/memchr-power7.S
index 5d783ab..fedca9c 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memchr-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memchr-power7.S
@@ -18,20 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef ENTRY
-#define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__memchr_power7)					\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__memchr_power7):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memchr_power7)
-
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__memchr_power7)					\
-  END_2(__memchr_power7)
+#define MEMCHR __memchr_power7
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memrchr-power7.S b/sysdeps/powerpc/powerpc64/multiarch/memrchr-power7.S
index 9ee6a3b..052aa73 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memrchr-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/memrchr-power7.S
@@ -18,20 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef ENTRY
-#define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__memrchr_power7)					\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__memrchr_power7):					\
-  cfi_startproc;						\
-  LOCALENTRY(__memrchr_power7)
-
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__memrchr_power7)					\
-  END_2(__memrchr_power7)
+#define MEMRCHR __memrchr_power7
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/rawmemchr-power7.S b/sysdeps/powerpc/powerpc64/multiarch/rawmemchr-power7.S
index ad2fd80..d79d728 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/rawmemchr-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/rawmemchr-power7.S
@@ -18,19 +18,6 @@ 
 
 #include <sysdep.h>
 
-#undef ENTRY
-#define ENTRY(name)						\
-  .section ".text";						\
-  ENTRY_2(__rawmemchr_power7)					\
-  .align ALIGNARG(2);						\
-  BODY_LABEL(__rawmemchr_power7):				\
-  cfi_startproc;						\
-  LOCALENTRY(__rawmemchr_power7)
-
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__rawmemchr_power7)					\
-  END_2(__rawmemchr_power7)
+#define RAWMEMCHR __rawmemchr_power7
 
 #include <sysdeps/powerpc/powerpc64/power7/rawmemchr.S>
diff --git a/sysdeps/powerpc/powerpc64/power7/memchr.S b/sysdeps/powerpc/powerpc64/power7/memchr.S
index 6ef665f2..5e9707a 100644
--- a/sysdeps/powerpc/powerpc64/power7/memchr.S
+++ b/sysdeps/powerpc/powerpc64/power7/memchr.S
@@ -20,8 +20,12 @@ 
 #include <sysdep.h>
 
 /* int [r3] memchr (char *s [r3], int byte [r4], int size [r5])  */
+
+#ifndef MEMCHR
+# define MEMCHR __memchr
+#endif
 	.machine  power7
-ENTRY (__memchr)
+ENTRY (MEMCHR)
 	CALL_MCOUNT 3
 	dcbt	0,r3
 	clrrdi  r8,r3,3
@@ -190,6 +194,6 @@  L(small_range):
 	bne	cr6,L(done)
 	blr
 
-END (__memchr)
+END (MEMCHR)
 weak_alias (__memchr, memchr)
 libc_hidden_builtin_def (memchr)
diff --git a/sysdeps/powerpc/powerpc64/power7/memrchr.S b/sysdeps/powerpc/powerpc64/power7/memrchr.S
index 4e86400..4276768 100644
--- a/sysdeps/powerpc/powerpc64/power7/memrchr.S
+++ b/sysdeps/powerpc/powerpc64/power7/memrchr.S
@@ -20,8 +20,12 @@ 
 #include <sysdep.h>
 
 /* int [r3] memrchr (char *s [r3], int byte [r4], int size [r5])  */
+
+#ifndef MEMRCHR
+# define MEMRCHR __memrchr
+#endif
 	.machine  power7
-ENTRY (__memrchr)
+ENTRY (MEMRCHR)
 	CALL_MCOUNT 3
 	add	r7,r3,r5      /* Calculate the last acceptable address.  */
 	neg	r0,r7
@@ -192,6 +196,6 @@  L(loop_small):
 	bne	L(loop_small)
 	blr
 
-END (__memrchr)
+END (MEMRCHR)
 weak_alias (__memrchr, memrchr)
 libc_hidden_builtin_def (memrchr)
diff --git a/sysdeps/powerpc/powerpc64/power7/rawmemchr.S b/sysdeps/powerpc/powerpc64/power7/rawmemchr.S
index b99ad62..48afb75 100644
--- a/sysdeps/powerpc/powerpc64/power7/rawmemchr.S
+++ b/sysdeps/powerpc/powerpc64/power7/rawmemchr.S
@@ -20,8 +20,12 @@ 
 #include <sysdep.h>
 
 /* int [r3] rawmemchr (void *s [r3], int c [r4])  */
+
+#ifndef RAWMEMCHR
+# define RAWMEMCHR __rawmemchr
+#endif
 	.machine  power7
-ENTRY (__rawmemchr)
+ENTRY (RAWMEMCHR)
 	CALL_MCOUNT 2
 	dcbt	0,r3
 	clrrdi	r8,r3,3	      /* Align the address to doubleword boundary.  */
@@ -106,6 +110,6 @@  L(done):
 	srdi	r0,r0,3	      /* Convert leading zeros to bytes.  */
 	add	r3,r8,r0      /* Return address of the matching char.  */
 	blr
-END (__rawmemchr)
+END (RAWMEMCHR)
 weak_alias (__rawmemchr,rawmemchr)
 libc_hidden_builtin_def (__rawmemchr)