#include <sys/types.h>
#undef memchr
-
+#ifdef RAWMEMCHR
+# define __rawmemchr RAWMEMCHR
+#endif
/* Find the first occurrence of C in S. */
__ptr_t
}
}
}
-libc_hidden_def (__rawmemchr)
+#ifndef RAWMEMCHR
weak_alias (__rawmemchr, rawmemchr)
+#endif
+libc_hidden_def (__rawmemchr)
strnlen-power7 strnlen-c \
mempcpy-power7 mempcpy-c \
memchr-power7 memchr-c \
- memrchr-power7 memrchr-c
+ memrchr-power7 memrchr-c \
+ rawmemchr-power7 rawmemchr-c
endif
IFUNC_IMPL_ADD (array, i, memrchr, 1,
__memrchr_ppc32))
+ IFUNC_IMPL (i, name, rawmemchr,
+ IFUNC_IMPL_ADD (array, i, rawmemchr,
+ hwcap & PPC_FEATURE_HAS_VSX,
+ __rawmemchr_power7)
+ IFUNC_IMPL_ADD (array, i, rawmemchr, 1,
+ __rawmemchr_ppc32))
+
IFUNC_IMPL (i, name, strlen,
IFUNC_IMPL_ADD (array, i, strlen, hwcap & PPC_FEATURE_HAS_VSX,
__strlen_power7)
--- /dev/null
+#define RAWMEMCHR __rawmemchr_ppc32
+#ifdef SHARED
+# undef libc_hidden_def
+# define libc_hidden_def(name) \
+ __hidden_ver1 (__rawmemchr_ppc32, __GI___rawmemchr, __rawmemchr_ppc32);
+#endif
+
+#include "string/rawmemchr.c"
/* int [r3] rawmemchr (void *s [r3], int c [r4]) */
.machine power7
-ENTRY (__rawmemchr)
+ENTRY (__rawmemchr_power7)
CALL_MCOUNT
dcbt 0,r3
clrrwi r8,r3,2 /* Align the address to word boundary. */
srwi r0,r0,3 /* Convert leading zeroes to bytes. */
add r3,r8,r0 /* Return address of the matching char. */
blr
-END (__rawmemchr)
-weak_alias (__rawmemchr,rawmemchr)
-libc_hidden_builtin_def (__rawmemchr)
+END (__rawmemchr_power7)
--- /dev/null
+/* Multiple versions of rawmemchr.
+ Copyright (C) 2013 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef NOT_IN_libc
+# include <string.h>
+# include <shlib-compat.h>
+# include "init-arch.h"
+
+extern __typeof (__rawmemchr) __rawmemchr_ppc32 attribute_hidden;
+extern __typeof (__rawmemchr) __rawmemchr_power7 attribute_hidden;
+
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+libc_ifunc (__rawmemchr,
+ (hwcap & PPC_FEATURE_HAS_VSX)
+ ? __rawmemchr_power7
+ : __rawmemchr_ppc32);
+
+weak_alias (__rawmemchr, rawmemchr)
+#else
+#include "string/rawmemchr.c"
+#endif