mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-08 22:30:07 +00:00
x86: Move strcmp SSE2 implementation to multiarch/strcmp-sse2.S
This commit doesn't affect libc.so.6, its just housekeeping to prepare for adding explicit ISA level support. Because strcmp-sse2.S implements so many functions (more from avx2/evex/sse42) add a new file 'strcmp-naming.h' to assist in getting the correct symbol name for all the function across multiarch/non-multiarch builds. Tested build on x86_64 and x86_32 with/without multiarch.
This commit is contained in:
parent
30e57e0a21
commit
d561fbb041
18
sysdeps/x86_64/multiarch/rtld-strcmp.S
Normal file
18
sysdeps/x86_64/multiarch/rtld-strcmp.S
Normal file
@ -0,0 +1,18 @@
|
||||
/* Copyright (C) 2022 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "../strcmp.S"
|
18
sysdeps/x86_64/multiarch/rtld-strncmp.S
Normal file
18
sysdeps/x86_64/multiarch/rtld-strncmp.S
Normal file
@ -0,0 +1,18 @@
|
||||
/* Copyright (C) 2022 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "../strncmp.S"
|
@ -16,8 +16,5 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#define STRCMP __strcasecmp_l_sse2
|
||||
#define USE_AS_STRCASECMP_L
|
||||
#define NO_NOLOCALE_ALIAS
|
||||
#define __strcasecmp __strcasecmp_sse2
|
||||
#include <sysdeps/x86_64/strcmp.S>
|
||||
#include "strcmp-sse2.S"
|
||||
|
68
sysdeps/x86_64/multiarch/strcmp-naming.h
Normal file
68
sysdeps/x86_64/multiarch/strcmp-naming.h
Normal file
@ -0,0 +1,68 @@
|
||||
#ifndef _STRCMP_NAMING_H_
|
||||
#define _STRCMP_NAMING_H_
|
||||
|
||||
/* Utility macros. */
|
||||
#define STRCMP_SUFFIX(x, y) x##y
|
||||
#define STRCMP_NAME(x, y) STRCMP_SUFFIX (x, y)
|
||||
|
||||
/* Setup base of all definitions. */
|
||||
#define STRNCASECMP_BASE __strncasecmp
|
||||
#define STRCASECMP_BASE __strcasecmp
|
||||
#define WCSCMP_BASE __wcscmp
|
||||
|
||||
#if defined USE_MULTIARCH && IS_IN (libc)
|
||||
# define WCSNCMP_BASE __wcsncmp
|
||||
# define STRNCMP_BASE __strncmp
|
||||
# define STRCMP_BASE __strcmp
|
||||
|
||||
#else
|
||||
/* Covers IS_IN (rtld) or non-multiarch build. */
|
||||
# define WCSNCMP_BASE wcsncmp
|
||||
# define STRNCMP_BASE strncmp
|
||||
# define STRCMP_BASE strcmp
|
||||
|
||||
# undef STRCMP_ISA
|
||||
# define STRCMP_ISA
|
||||
#endif
|
||||
|
||||
#if IS_IN (rtld) || defined USE_MULTIARCH
|
||||
# define ISA_HIDDEN_JUMPTARGET(...) __VA_ARGS__
|
||||
#else
|
||||
# define ISA_HIDDEN_JUMPTARGET(...) HIDDEN_JUMPTARGET (__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
/* Get correct symbol for OVERFLOW_STRCMP, STRCMP, and
|
||||
STRCASECMP. */
|
||||
#if defined USE_AS_STRNCMP || defined USE_AS_STRNCASECMP_L
|
||||
|
||||
# if defined USE_AS_WCSCMP || defined USE_AS_WCSNCMP
|
||||
# define OVERFLOW_STRCMP_SYM WCSCMP_BASE
|
||||
# define STRCMP_SYM WCSNCMP_BASE
|
||||
# elif defined USE_AS_STRCASECMP_L || defined USE_AS_STRNCASECMP_L
|
||||
# define OVERFLOW_STRCMP_SYM STRCMP_NAME (STRCASECMP_BASE, _l)
|
||||
# define STRCMP_SYM STRCMP_NAME (STRNCASECMP_BASE, _l)
|
||||
# else
|
||||
# define OVERFLOW_STRCMP_SYM STRCMP_BASE
|
||||
# define STRCMP_SYM STRNCMP_BASE
|
||||
# endif
|
||||
|
||||
# define STRCASECMP_SYM STRNCASECMP_BASE
|
||||
# define OVERFLOW_STRCMP \
|
||||
ISA_HIDDEN_JUMPTARGET (STRCMP_NAME (OVERFLOW_STRCMP_SYM, STRCMP_ISA))
|
||||
#else
|
||||
# ifdef USE_AS_WCSCMP
|
||||
# define STRCMP_SYM WCSCMP_BASE
|
||||
# elif defined USE_AS_STRCASECMP_L
|
||||
# define STRCMP_SYM STRCMP_NAME (STRCASECMP_BASE, _l)
|
||||
# else
|
||||
# define STRCMP_SYM STRCMP_BASE
|
||||
# endif
|
||||
|
||||
# define STRCASECMP_SYM STRCASECMP_BASE
|
||||
#endif
|
||||
|
||||
#define STRCASECMP_L_NONASCII STRCMP_NAME (STRCASECMP_SYM, _l_nonascii)
|
||||
#define STRCASECMP STRCMP_NAME (STRCASECMP_SYM, STRCMP_ISA)
|
||||
#define STRCMP STRCMP_NAME (STRCMP_SYM, STRCMP_ISA)
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -16,8 +16,5 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#define STRCMP __strncasecmp_l_sse2
|
||||
#define NO_NOLOCALE_ALIAS
|
||||
#define USE_AS_STRNCASECMP_L
|
||||
#define __strncasecmp __strncasecmp_sse2
|
||||
#include <sysdeps/x86_64/strcmp.S>
|
||||
#include "strcmp-sse2.S"
|
||||
|
@ -16,15 +16,5 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
#if IS_IN (libc)
|
||||
# define STRCMP __strncmp_sse2
|
||||
# undef libc_hidden_builtin_def
|
||||
# define libc_hidden_builtin_def(strcmp)
|
||||
#else
|
||||
# define STRCMP strncmp
|
||||
#endif
|
||||
|
||||
#define USE_AS_STRNCMP
|
||||
#include <sysdeps/x86_64/strcmp.S>
|
||||
#include "strcmp-sse2.S"
|
||||
|
@ -1,6 +1,11 @@
|
||||
#define STRCMP __strcasecmp_l
|
||||
#define USE_AS_STRCASECMP_L
|
||||
#include "strcmp.S"
|
||||
/* Symbols = __strcasecmp_l and __strcasecmp. */
|
||||
|
||||
#include "multiarch/strcasecmp_l-sse2.S"
|
||||
|
||||
libc_hidden_builtin_def (__strcasecmp_l)
|
||||
|
||||
weak_alias (__strcasecmp_l, strcasecmp_l)
|
||||
libc_hidden_def (strcasecmp_l)
|
||||
|
||||
weak_alias (__strcasecmp, strcasecmp)
|
||||
libc_hidden_def (__strcasecmp)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,11 @@
|
||||
#define STRCMP __strncasecmp_l
|
||||
#define USE_AS_STRNCASECMP_L
|
||||
#include "strcmp.S"
|
||||
/* Symbols = __strncasecmp_l and __strncasecmp. */
|
||||
|
||||
#include "multiarch/strncase_l-sse2.S"
|
||||
|
||||
libc_hidden_builtin_def (__strncasecmp_l)
|
||||
|
||||
weak_alias (__strncasecmp_l, strncasecmp_l)
|
||||
libc_hidden_def (strncasecmp_l)
|
||||
|
||||
weak_alias (__strncasecmp, strncasecmp)
|
||||
libc_hidden_def (__strncasecmp)
|
||||
|
@ -1,3 +1,4 @@
|
||||
#define STRCMP strncmp
|
||||
#define USE_AS_STRNCMP
|
||||
#include "strcmp.S"
|
||||
/* Symbol = strncmp. */
|
||||
|
||||
#include "multiarch/strncmp-sse2.S"
|
||||
libc_hidden_builtin_def (strncmp)
|
||||
|
Loading…
Reference in New Issue
Block a user