mirror of
git://sourceware.org/git/glibc.git
synced 2024-12-03 04:01:43 +08:00
powerpc: refactor strcasecmp, strcmp, and strncmp 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/strcasecmp_l-power7.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/strcmp-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcmp-power8.S Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcmp-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-power4.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/power4/strncmp.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
This commit is contained in:
parent
dbcc7d0893
commit
3bc426e156
23
ChangeLog
23
ChangeLog
@ -1,5 +1,28 @@
|
||||
2017-04-11 Wainer dos Santos Moschetta <wainersm@linux.vnet.ibm.com>
|
||||
|
||||
* sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l-power7.S: Define
|
||||
the implementation-specific function name and remove unneeded
|
||||
macros definition.
|
||||
* sysdeps/powerpc/powerpc64/multiarch/strcmp-power7.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/multiarch/strcmp-power8.S Likewise.
|
||||
* sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/multiarch/strcmp-ppc64.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/multiarch/strncmp-power4.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/multiarch/strncmp-power7.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/multiarch/strncmp-power8.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/multiarch/strncmp-ppc64.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/power4/strncmp.S: Set a default function
|
||||
name if not defined and pass as parameter to macros accordingly.
|
||||
* sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/strcmp.S: Likewise.
|
||||
* sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
|
||||
|
||||
* sysdeps/powerpc/powerpc64/multiarch/stpcpy-power8.S: Define the
|
||||
implementation-specific function name and remove unneeded macros
|
||||
definition.
|
||||
|
@ -18,20 +18,7 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#undef ENTRY
|
||||
#define ENTRY(name) \
|
||||
.section ".text"; \
|
||||
ENTRY_2(__strcasecmp_l_power7) \
|
||||
.align ALIGNARG(2); \
|
||||
BODY_LABEL(__strcasecmp_l_power7): \
|
||||
cfi_startproc; \
|
||||
LOCALENTRY(__strcasecmp_l_power7)
|
||||
|
||||
#undef END
|
||||
#define END(name) \
|
||||
cfi_endproc; \
|
||||
TRACEBACK(__strcasecmp_l_power7) \
|
||||
END_2(__strcasecmp_l_power7)
|
||||
#define __strcasecmp __strcasecmp_l_power7
|
||||
|
||||
#undef weak_alias
|
||||
#define weak_alias(name, alias)
|
||||
|
@ -18,21 +18,7 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#undef EALIGN
|
||||
#define EALIGN(name, alignt, words) \
|
||||
.section ".text"; \
|
||||
ENTRY_2(__strcmp_power7) \
|
||||
.align ALIGNARG(alignt); \
|
||||
EALIGN_W_##words; \
|
||||
BODY_LABEL(__strcmp_power7): \
|
||||
cfi_startproc; \
|
||||
LOCALENTRY(__strcmp_power7)
|
||||
|
||||
#undef END
|
||||
#define END(name) \
|
||||
cfi_endproc; \
|
||||
TRACEBACK(__strcmp_power7) \
|
||||
END_2(__strcmp_power7)
|
||||
#define STRCMP __strcmp_power7
|
||||
|
||||
#undef libc_hidden_builtin_def
|
||||
#define libc_hidden_builtin_def(name)
|
||||
|
@ -18,21 +18,7 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#undef EALIGN
|
||||
#define EALIGN(name, alignt, words) \
|
||||
.section ".text"; \
|
||||
ENTRY_2(__strcmp_power8) \
|
||||
.align ALIGNARG(alignt); \
|
||||
EALIGN_W_##words; \
|
||||
BODY_LABEL(__strcmp_power8): \
|
||||
cfi_startproc; \
|
||||
LOCALENTRY(__strcmp_power8)
|
||||
|
||||
#undef END
|
||||
#define END(name) \
|
||||
cfi_endproc; \
|
||||
TRACEBACK(__strcmp_power8) \
|
||||
END_2(__strcmp_power8)
|
||||
#define STRCMP __strcmp_power8
|
||||
|
||||
#undef libc_hidden_builtin_def
|
||||
#define libc_hidden_builtin_def(name)
|
||||
|
@ -18,21 +18,7 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#undef EALIGN
|
||||
#define EALIGN(name, alignt, words) \
|
||||
.section ".text"; \
|
||||
ENTRY_2(__strcmp_power9) \
|
||||
.align ALIGNARG(alignt); \
|
||||
EALIGN_W_##words; \
|
||||
BODY_LABEL(__strcmp_power9): \
|
||||
cfi_startproc; \
|
||||
LOCALENTRY(__strcmp_power9)
|
||||
|
||||
#undef END
|
||||
#define END(name) \
|
||||
cfi_endproc; \
|
||||
TRACEBACK(__strcmp_power9) \
|
||||
END_2(__strcmp_power9)
|
||||
#define STRCMP __strcmp_power9
|
||||
|
||||
#undef libc_hidden_builtin_def
|
||||
#define libc_hidden_builtin_def(name)
|
||||
|
@ -19,25 +19,11 @@
|
||||
#include <sysdep.h>
|
||||
|
||||
#if defined SHARED && IS_IN (libc)
|
||||
# undef EALIGN
|
||||
# define EALIGN(name, alignt, words) \
|
||||
.section ".text"; \
|
||||
ENTRY_2(__strcmp_ppc) \
|
||||
.align ALIGNARG(alignt); \
|
||||
EALIGN_W_##words; \
|
||||
BODY_LABEL(__strcmp_ppc): \
|
||||
cfi_startproc; \
|
||||
LOCALENTRY(__strcmp_ppc)
|
||||
|
||||
# undef END
|
||||
# define END(name) \
|
||||
cfi_endproc; \
|
||||
TRACEBACK(__strcmp_ppc) \
|
||||
END_2(__strcmp_ppc)
|
||||
# define STRCMP __strcmp_ppc
|
||||
|
||||
# undef libc_hidden_builtin_def
|
||||
# define libc_hidden_builtin_def(name) \
|
||||
.globl __GI_strcmp; __GI_strcmp = __strcmp_ppc
|
||||
#endif
|
||||
#endif /* SHARED && IS_IN */
|
||||
|
||||
#include <sysdeps/powerpc/powerpc64/strcmp.S>
|
||||
|
@ -17,21 +17,7 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#undef EALIGN
|
||||
#define EALIGN(name,alignt,words) \
|
||||
.section ".text"; \
|
||||
ENTRY_2(__strncmp_power4) \
|
||||
.align ALIGNARG(alignt); \
|
||||
EALIGN_W_##words; \
|
||||
BODY_LABEL(__strncmp_power4): \
|
||||
cfi_startproc; \
|
||||
LOCALENTRY(__strncmp_power4)
|
||||
|
||||
#undef END
|
||||
#define END(name) \
|
||||
cfi_endproc; \
|
||||
TRACEBACK(__strncmp_power4) \
|
||||
END_2(__strncmp_power4)
|
||||
#define STRNCMP __strncmp_power4
|
||||
|
||||
#undef libc_hidden_builtin_def
|
||||
#define libc_hidden_builtin_def(name)
|
||||
|
@ -17,22 +17,7 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#undef EALIGN
|
||||
#define EALIGN(name,alignt,words) \
|
||||
.section ".text"; \
|
||||
ENTRY_2(__strncmp_power7) \
|
||||
.align ALIGNARG(alignt); \
|
||||
EALIGN_W_##words; \
|
||||
BODY_LABEL(__strncmp_power7): \
|
||||
cfi_startproc; \
|
||||
LOCALENTRY(__strncmp_power7)
|
||||
|
||||
#undef END
|
||||
#define END(name) \
|
||||
cfi_endproc; \
|
||||
TRACEBACK(__strncmp_power7) \
|
||||
END_2(__strncmp_power7)
|
||||
|
||||
#define STRNCMP __strncmp_power7
|
||||
|
||||
#undef libc_hidden_builtin_def
|
||||
#define libc_hidden_builtin_def(name)
|
||||
|
@ -17,22 +17,7 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#undef EALIGN
|
||||
#define EALIGN(name,alignt,words) \
|
||||
.section ".text"; \
|
||||
ENTRY_2(__strncmp_power8) \
|
||||
.align ALIGNARG(alignt); \
|
||||
EALIGN_W_##words; \
|
||||
BODY_LABEL(__strncmp_power8): \
|
||||
cfi_startproc; \
|
||||
LOCALENTRY(__strncmp_power8)
|
||||
|
||||
#undef END
|
||||
#define END(name) \
|
||||
cfi_endproc; \
|
||||
TRACEBACK(__strncmp_power8) \
|
||||
END_2(__strncmp_power8)
|
||||
|
||||
#define STRNCMP __strncmp_power8
|
||||
|
||||
#undef libc_hidden_builtin_def
|
||||
#define libc_hidden_builtin_def(name)
|
||||
|
@ -17,22 +17,7 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#undef EALIGN
|
||||
#define EALIGN(name,alignt,words) \
|
||||
.section ".text"; \
|
||||
ENTRY_2(__strncmp_power9) \
|
||||
.align ALIGNARG(alignt); \
|
||||
EALIGN_W_##words; \
|
||||
BODY_LABEL(__strncmp_power9): \
|
||||
cfi_startproc; \
|
||||
LOCALENTRY(__strncmp_power9)
|
||||
|
||||
#undef END
|
||||
#define END(name) \
|
||||
cfi_endproc; \
|
||||
TRACEBACK(__strncmp_power9) \
|
||||
END_2(__strncmp_power9)
|
||||
|
||||
#define STRNCMP __strncmp_power9
|
||||
|
||||
#undef libc_hidden_builtin_def
|
||||
#define libc_hidden_builtin_def(name)
|
||||
|
@ -18,21 +18,7 @@
|
||||
#include <sysdep.h>
|
||||
|
||||
#if defined SHARED && IS_IN (libc)
|
||||
#undef EALIGN
|
||||
#define EALIGN(name,alignt,words) \
|
||||
.section ".text"; \
|
||||
ENTRY_2(__strncmp_ppc) \
|
||||
.align ALIGNARG(alignt); \
|
||||
EALIGN_W_##words; \
|
||||
BODY_LABEL(__strncmp_ppc): \
|
||||
cfi_startproc; \
|
||||
LOCALENTRY(__strncmp_ppc)
|
||||
|
||||
#undef END
|
||||
#define END(name) \
|
||||
cfi_endproc; \
|
||||
TRACEBACK(__strncmp_ppc) \
|
||||
END_2(__strncmp_ppc)
|
||||
# define STRNCMP __strncmp_ppc
|
||||
|
||||
# undef libc_hidden_builtin_def
|
||||
# define libc_hidden_builtin_def(name) \
|
||||
|
@ -18,11 +18,15 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifndef STRNCMP
|
||||
# define STRNCMP strncmp
|
||||
#endif
|
||||
|
||||
/* See strlen.s for comments on how the end-of-string testing works. */
|
||||
|
||||
/* int [r3] strncmp (const char *s1 [r3], const char *s2 [r4], size_t size [r5]) */
|
||||
|
||||
EALIGN (strncmp, 4, 0)
|
||||
EALIGN (STRNCMP, 4, 0)
|
||||
CALL_MCOUNT 3
|
||||
|
||||
#define rTMP2 r0
|
||||
@ -217,5 +221,5 @@ L(u4): sub rRTN, rWORD1, rWORD2
|
||||
L(ux):
|
||||
li rRTN, 0
|
||||
blr
|
||||
END (strncmp)
|
||||
END (STRNCMP)
|
||||
libc_hidden_builtin_def (strncmp)
|
||||
|
@ -23,10 +23,14 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifndef STRCMP
|
||||
# define STRCMP strcmp
|
||||
#endif
|
||||
|
||||
/* int [r3] strcmp (const char *s1 [r3], const char *s2 [r4]) */
|
||||
|
||||
.machine power7
|
||||
EALIGN (strcmp, 4, 0)
|
||||
EALIGN (STRCMP, 4, 0)
|
||||
CALL_MCOUNT 2
|
||||
|
||||
or r9, r3, r4
|
||||
@ -160,5 +164,5 @@ L(diffOfNULL):
|
||||
extsw r3, r10 /* sign extend result */
|
||||
blr /* return */
|
||||
|
||||
END (strcmp)
|
||||
END (STRCMP)
|
||||
libc_hidden_builtin_def (strcmp)
|
||||
|
@ -18,13 +18,17 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifndef STRNCMP
|
||||
# define STRNCMP strncmp
|
||||
#endif
|
||||
|
||||
/* See strlen.s for comments on how the end-of-string testing works. */
|
||||
|
||||
/* int [r3] strncmp (const char *s1 [r3],
|
||||
const char *s2 [r4],
|
||||
size_t size [r5]) */
|
||||
|
||||
EALIGN (strncmp,5,0)
|
||||
EALIGN (STRNCMP,5,0)
|
||||
CALL_MCOUNT 3
|
||||
|
||||
#define rTMP2 r0
|
||||
@ -219,5 +223,5 @@ L(u4): sub rRTN,rWORD1,rWORD2
|
||||
L(ux):
|
||||
li rRTN,0
|
||||
blr
|
||||
END (strncmp)
|
||||
END (STRNCMP)
|
||||
libc_hidden_builtin_def (strncmp)
|
||||
|
@ -18,6 +18,10 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifndef STRCMP
|
||||
# define STRCMP strcmp
|
||||
#endif
|
||||
|
||||
/* Implements the function
|
||||
|
||||
size_t [r3] strcmp (const char *s1 [r3], const char *s2 [r4])
|
||||
@ -27,7 +31,7 @@
|
||||
64K as default, the page cross handling assumes minimum page size of
|
||||
4k. */
|
||||
|
||||
EALIGN (strcmp, 4, 0)
|
||||
EALIGN (STRCMP, 4, 0)
|
||||
li r0,0
|
||||
|
||||
/* Check if [s1]+16 or [s2]+16 will cross a 4K page boundary using
|
||||
@ -239,5 +243,5 @@ L(pagecross_retdiff):
|
||||
L(pagecross_nullfound):
|
||||
li r3,0
|
||||
b L(pagecross_retdiff)
|
||||
END (strcmp)
|
||||
END (STRCMP)
|
||||
libc_hidden_builtin_def (strcmp)
|
||||
|
@ -18,6 +18,10 @@
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifndef STRNCMP
|
||||
# define STRNCMP strncmp
|
||||
#endif
|
||||
|
||||
/* Implements the function
|
||||
|
||||
int [r3] strncmp (const char *s1 [r3], const char *s2 [r4], size_t [r5] n)
|
||||
@ -28,7 +32,7 @@
|
||||
4k. */
|
||||
|
||||
.machine power7
|
||||
EALIGN (strncmp, 4, 0)
|
||||
EALIGN (STRNCMP, 4, 0)
|
||||
/* Check if size is 0. */
|
||||
mr. r10,r5
|
||||
beq cr0,L(ret0)
|
||||
@ -319,5 +323,5 @@ L(byte_ne_4):
|
||||
extsw r10,r9
|
||||
mr r9,r8
|
||||
b L(size_reached_1)
|
||||
END(strncmp)
|
||||
END(STRNCMP)
|
||||
libc_hidden_builtin_def(strncmp)
|
||||
|
@ -18,6 +18,10 @@
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifndef STRCMP
|
||||
# define STRCMP strcmp
|
||||
#endif
|
||||
|
||||
/* Implements the function
|
||||
|
||||
int [r3] strcmp (const char *s1 [r3], const char *s2 [r4])
|
||||
@ -62,7 +66,7 @@
|
||||
allows it. */
|
||||
|
||||
.machine power7
|
||||
EALIGN (strcmp, 4, 0)
|
||||
EALIGN (STRCMP, 4, 0)
|
||||
li r0, 0
|
||||
|
||||
/* Check if [s1]+16 or [s2]+16 will cross a 4K page boundary using
|
||||
@ -257,7 +261,7 @@ L(pagecross_retdiff):
|
||||
L(pagecross_nullfound):
|
||||
li r3, 0
|
||||
b L(pagecross_retdiff)
|
||||
END (strcmp)
|
||||
END (STRCMP)
|
||||
libc_hidden_builtin_def (strcmp)
|
||||
#else
|
||||
#include <sysdeps/powerpc/powerpc64/power8/strcmp.S>
|
||||
|
@ -26,6 +26,10 @@
|
||||
code paths depending of data alignment for first 32 bytes and uses
|
||||
vectorised loops after that. */
|
||||
|
||||
#ifndef STRNCMP
|
||||
# define STRNCMP strncmp
|
||||
#endif
|
||||
|
||||
/* TODO: Change this to actual instructions when minimum binutils is upgraded
|
||||
to 2.27. Macros are defined below for these newer instructions in order
|
||||
to maintain compatibility. */
|
||||
@ -64,7 +68,7 @@
|
||||
/* TODO: change this to .machine power9 when minimum binutils
|
||||
is upgraded to 2.27. */
|
||||
.machine power7
|
||||
EALIGN (strncmp, 4, 0)
|
||||
EALIGN (STRNCMP, 4, 0)
|
||||
/* Check if size is 0. */
|
||||
cmpdi cr0, r5, 0
|
||||
beq cr0, L(ret0)
|
||||
@ -368,7 +372,7 @@ L(byte_ne_2):
|
||||
L(byte_ne_3):
|
||||
extsw r7, r7
|
||||
b L(byte_ne_1)
|
||||
END(strncmp)
|
||||
END(STRNCMP)
|
||||
libc_hidden_builtin_def(strncmp)
|
||||
#else
|
||||
#include <sysdeps/powerpc/powerpc64/power8/strncmp.S>
|
||||
|
@ -22,7 +22,11 @@
|
||||
|
||||
/* int [r3] strcmp (const char *s1 [r3], const char *s2 [r4]) */
|
||||
|
||||
EALIGN (strcmp, 4, 0)
|
||||
#ifndef STRCMP
|
||||
# define STRCMP strcmp
|
||||
#endif
|
||||
|
||||
EALIGN (STRCMP, 4, 0)
|
||||
CALL_MCOUNT 2
|
||||
|
||||
#define rTMP2 r0
|
||||
@ -172,5 +176,5 @@ L(u3): sub rRTN, rWORD1, rWORD2
|
||||
L(u4): lbz rWORD1, -1(rSTR1)
|
||||
sub rRTN, rWORD1, rWORD2
|
||||
blr
|
||||
END (strcmp)
|
||||
END (STRCMP)
|
||||
libc_hidden_builtin_def (strcmp)
|
||||
|
@ -22,7 +22,11 @@
|
||||
|
||||
/* int [r3] strncmp (const char *s1 [r3], const char *s2 [r4], size_t size [r5]) */
|
||||
|
||||
EALIGN (strncmp, 4, 0)
|
||||
#ifndef STRNCMP
|
||||
# define STRNCMP strncmp
|
||||
#endif
|
||||
|
||||
EALIGN (STRNCMP, 4, 0)
|
||||
CALL_MCOUNT 3
|
||||
|
||||
#define rTMP2 r0
|
||||
@ -202,5 +206,5 @@ L(u1):
|
||||
L(u2): lbzu rWORD1, -1(rSTR1)
|
||||
L(u3): sub rRTN, rWORD1, rWORD2
|
||||
blr
|
||||
END (strncmp)
|
||||
END (STRNCMP)
|
||||
libc_hidden_builtin_def (strncmp)
|
||||
|
Loading…
Reference in New Issue
Block a user