From b6a66222096c2c4a93818e86cda1aff1e37ee451 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Tue, 11 Apr 2017 14:18:36 -0300 Subject: [PATCH] powerpc: refactor memcmp and memmove IFUNC. Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memmove-power7.S: Likewise. * sysdeps/powerpc/powerpc64/power4/memcmp.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise. --- ChangeLog | 10 ++++++++++ .../powerpc/powerpc64/multiarch/memcmp-power4.S | 16 +--------------- .../powerpc/powerpc64/multiarch/memcmp-power7.S | 16 +--------------- .../powerpc/powerpc64/multiarch/memmove-power7.S | 16 +--------------- sysdeps/powerpc/powerpc64/power4/memcmp.S | 8 ++++++-- sysdeps/powerpc/powerpc64/power7/memcmp.S | 8 +++++--- sysdeps/powerpc/powerpc64/power7/memmove.S | 7 +++++-- 7 files changed, 29 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index bfdb18c04a..a99770606c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2017-04-11 Wainer dos Santos Moschetta + * sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S: Define the + implementation-specific function name and remove unneeded + macros definition. + * sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S: Likewise. + * sysdeps/powerpc/powerpc64/multiarch/memmove-power7.S: Likewise. + * sysdeps/powerpc/powerpc64/power4/memcmp.S: Set a default function + name if not defined and pass as parameter to macros accordingly. + * sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise. + * sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise. + * sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S: Define the implementation-specific function name and remove unneeded macros definition. diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S b/sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S index fa107f14a9..e38b2a9c44 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S +++ b/sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S @@ -18,21 +18,7 @@ #include -#undef EALIGN -#define EALIGN(name, alignt, words) \ - .section ".text"; \ - ENTRY_2(__memcmp_power4) \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ - BODY_LABEL(__memcmp_power4): \ - cfi_startproc; \ - LOCALENTRY(__memcmp_power4) - -#undef END -#define END(name) \ - cfi_endproc; \ - TRACEBACK(__memcmp_power4) \ - END_2(__memcmp_power4) +#define MEMCMP __memcmp_power4 #undef libc_hidden_builtin_def #define libc_hidden_builtin_def(name) diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S b/sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S index 0fb597d5e1..a9cc979b92 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S +++ b/sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S @@ -18,21 +18,7 @@ #include -#undef EALIGN -#define EALIGN(name, alignt, words) \ - .section ".text"; \ - ENTRY_2(__memcmp_power7) \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ - BODY_LABEL(__memcmp_power7): \ - cfi_startproc; \ - LOCALENTRY(__memcmp_power7) - -#undef END -#define END(name) \ - cfi_endproc; \ - TRACEBACK(__memcmp_power7) \ - END_2(__memcmp_power7) +#define MEMCMP __memcmp_power7 #undef libc_hidden_builtin_def #define libc_hidden_builtin_def(name) diff --git a/sysdeps/powerpc/powerpc64/multiarch/memmove-power7.S b/sysdeps/powerpc/powerpc64/multiarch/memmove-power7.S index 46dddebf1d..a9435fa654 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/memmove-power7.S +++ b/sysdeps/powerpc/powerpc64/multiarch/memmove-power7.S @@ -18,21 +18,7 @@ #include -#undef EALIGN -#define EALIGN(name, alignt, words) \ - .section ".text"; \ - ENTRY_2(__memmove_power7) \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ - BODY_LABEL(__memmove_power7): \ - cfi_startproc; \ - LOCALENTRY(__memmove_power7) - -#undef END_GEN_TB -#define END_GEN_TB(name, mask) \ - cfi_endproc; \ - TRACEBACK_MASK(__memmove_power7,mask) \ - END_2(__memmove_power7) +#define MEMMOVE __memmove_power7 #undef libc_hidden_builtin_def #define libc_hidden_builtin_def(name) diff --git a/sysdeps/powerpc/powerpc64/power4/memcmp.S b/sysdeps/powerpc/powerpc64/power4/memcmp.S index 02e28c45f5..6ca98e909c 100644 --- a/sysdeps/powerpc/powerpc64/power4/memcmp.S +++ b/sysdeps/powerpc/powerpc64/power4/memcmp.S @@ -22,8 +22,12 @@ const char *s2 [r4], size_t size [r5]) */ +#ifndef MEMCMP +# define MEMCMP memcmp +#endif + .machine power4 -EALIGN (memcmp, 4, 0) +EALIGN (MEMCMP, 4, 0) CALL_MCOUNT 3 #define rRTN r3 @@ -1360,6 +1364,6 @@ L(duzeroLength): li rRTN, 0 blr -END (memcmp) +END (MEMCMP) libc_hidden_builtin_def (memcmp) weak_alias (memcmp, bcmp) diff --git a/sysdeps/powerpc/powerpc64/power7/memcmp.S b/sysdeps/powerpc/powerpc64/power7/memcmp.S index 75399cb75a..96ce8cee25 100644 --- a/sysdeps/powerpc/powerpc64/power7/memcmp.S +++ b/sysdeps/powerpc/powerpc64/power7/memcmp.S @@ -21,9 +21,11 @@ /* int [r3] memcmp (const char *s1 [r3], const char *s2 [r4], size_t size [r5]) */ - +#ifndef MEMCMP +# define MEMCMP memcmp +#endif .machine power7 -EALIGN (memcmp, 4, 0) +EALIGN (MEMCMP, 4, 0) CALL_MCOUNT 3 #define rRTN r3 @@ -1054,6 +1056,6 @@ L(duzeroLength): li rRTN, 0 blr -END (memcmp) +END (MEMCMP) libc_hidden_builtin_def (memcmp) weak_alias (memcmp, bcmp) diff --git a/sysdeps/powerpc/powerpc64/power7/memmove.S b/sysdeps/powerpc/powerpc64/power7/memmove.S index 6afe80a3b6..4c0f7c3571 100644 --- a/sysdeps/powerpc/powerpc64/power7/memmove.S +++ b/sysdeps/powerpc/powerpc64/power7/memmove.S @@ -27,8 +27,11 @@ If source and destiny overlaps, a optimized backwards memcpy is used instead. */ +#ifndef MEMMOVE +# define MEMMOVE memmove +#endif .machine power7 -EALIGN (memmove, 5, 0) +EALIGN (MEMMOVE, 5, 0) CALL_MCOUNT 3 L(_memmove): @@ -816,7 +819,7 @@ L(end_unaligned_loop_bwd): stb r8,-7(r11) /* Return original DST pointer. */ blr -END_GEN_TB (memmove, TB_TOCLESS) +END_GEN_TB (MEMMOVE, TB_TOCLESS) libc_hidden_builtin_def (memmove)