mirror of
https://sourceware.org/git/glibc.git
synced 2024-09-20 00:19:57 +00:00
wcsmbs: Use loop_unroll on wcsrchr
This allows an architecture to set explicit loop unrolling. Checked on aarch64-linux-gnu. * wcsmbs/wcsrchr.c (WCSRCHR): Use loop_unroll.h to parametrize the loop unroll.
This commit is contained in:
parent
421e3005ca
commit
662c2cc4e9
@ -1,5 +1,8 @@
|
|||||||
2019-04-04 Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
2019-04-04 Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
|
||||||
|
* wcsmbs/wcsrchr.c (WCSRCHR): Use loop_unroll.h to parametrize
|
||||||
|
the loop unroll.
|
||||||
|
|
||||||
* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcschr.c):
|
* sysdeps/powerpc/Makefile [$(subdir) == wcsmbs] (CFLAGS-wcschr.c):
|
||||||
New rule.
|
New rule.
|
||||||
* sysdeps/powerpc/power6/wcschr.c: Remove file.
|
* sysdeps/powerpc/power6/wcschr.c: Remove file.
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
#include <loop_unroll.h>
|
||||||
|
|
||||||
#ifndef WCSRCHR
|
#ifndef WCSRCHR
|
||||||
# define WCSRCHR wcsrchr
|
# define WCSRCHR wcsrchr
|
||||||
@ -26,12 +27,21 @@
|
|||||||
wchar_t *
|
wchar_t *
|
||||||
WCSRCHR (const wchar_t *wcs, const wchar_t wc)
|
WCSRCHR (const wchar_t *wcs, const wchar_t wc)
|
||||||
{
|
{
|
||||||
const wchar_t *retval = NULL;
|
wchar_t *retval = NULL;
|
||||||
|
|
||||||
do
|
#define ITERATION(index) \
|
||||||
if (*wcs == wc)
|
({ \
|
||||||
retval = wcs;
|
if (*wcs == wc) \
|
||||||
while (*wcs++ != L'\0');
|
retval = (wchar_t*) wcs; \
|
||||||
|
*wcs++ != L'\0'; \
|
||||||
|
})
|
||||||
|
|
||||||
return (wchar_t *) retval;
|
#ifndef UNROLL_NTIMES
|
||||||
|
# define UNROLL_NTIMES 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
UNROLL_REPEAT (UNROLL_NTIMES, ITERATION);
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user