This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch, hjl/pr14117, created. glibc-2.15-1134-g2e55520
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 1 Jun 2012 18:37:12 -0000
- Subject: GNU C Library master sources branch, hjl/pr14117, created. glibc-2.15-1134-g2e55520
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/pr14117 has been created
at 2e555200f39f76b7e6466e5f7b91a2200042094f (commit)
- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2e555200f39f76b7e6466e5f7b91a2200042094f
commit 2e555200f39f76b7e6466e5f7b91a2200042094f
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu May 31 22:03:16 2012 -0700
Update x86 bits/sigcontext.h from Linux kernel 3.3.0
diff --git a/ChangeLog b/ChangeLog
index ac24644..b595ed1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,18 @@
2012-05-31 H.J. Lu <hongjiu.lu@intel.com>
+ * sysdeps/unix/sysv/linux/x86/bits/sigcontext.h (FP_XSTATE_MAGIC1):
+ New macro from Linux kernel 3.3.0.
+ (FP_XSTATE_MAGIC2): Likewise.
+ (FP_XSTATE_MAGIC2_SIZE): Likewise.
+ (X86_FXSR_MAGIC): New macro from Linux i386 kernel.
+ (struct _fpx_sw_bytes): New struct.
+ (struct _xsave_hdr): Likewise.
+ (struct _ymmh_state): Likewise.
+ (struct _xstate): Likewise.
+
+2012-05-31 H.J. Lu <hongjiu.lu@intel.com>
+
* sysdeps/unix/sysv/linux/i386/bits/wchar.h: Include
<bits/wordsize.h>. Check __WORDSIZE instead of __x86_64__.
diff --git a/sysdeps/unix/sysv/linux/x86/bits/sigcontext.h b/sysdeps/unix/sysv/linux/x86/bits/sigcontext.h
index d9ba716..06f36cb 100644
--- a/sysdeps/unix/sysv/linux/x86/bits/sigcontext.h
+++ b/sysdeps/unix/sysv/linux/x86/bits/sigcontext.h
@@ -22,6 +22,19 @@
# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
#endif
+#define FP_XSTATE_MAGIC1 0x46505853U
+#define FP_XSTATE_MAGIC2 0x46505845U
+#define FP_XSTATE_MAGIC2_SIZE sizeof(FP_XSTATE_MAGIC2)
+
+struct _fpx_sw_bytes
+{
+ __uint32_t magic1;
+ __uint32_t extended_size;
+ __uint64_t xstate_bv;
+ __uint32_t xstate_size;
+ __uint32_t padding[7];
+};
+
struct _fpreg
{
unsigned short significand[4];
@@ -75,6 +88,8 @@ struct _fpstate
# define sigcontext_struct sigcontext
#endif
+#define X86_FXSR_MAGIC 0x0000
+
struct sigcontext
{
unsigned short gs, __gsh;
@@ -157,4 +172,23 @@ struct sigcontext
#endif /* __x86_64__ */
+struct _xsave_hdr
+{
+ __uint64_t xstate_bv;
+ __uint64_t reserved1[2];
+ __uint64_t reserved2[5];
+};
+
+struct _ymmh_state
+{
+ __uint32_t ymmh_space[64];
+};
+
+struct _xstate
+{
+ struct _fpstate fpstate;
+ struct _xsave_hdr xstate_hdr;
+ struct _ymmh_state ymmh;
+};
+
#endif /* _BITS_SIGCONTEXT_H */
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c1cf95755194f12e0b71ed7138b920752adb960a
commit c1cf95755194f12e0b71ed7138b920752adb960a
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu May 31 19:45:45 2012 -0700
Check __WORDSIZE instead of __x86_64__
diff --git a/ChangeLog b/ChangeLog
index 0c6e072..ac24644 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,11 @@
2012-05-31 H.J. Lu <hongjiu.lu@intel.com>
+ * sysdeps/unix/sysv/linux/i386/bits/wchar.h: Include
+ <bits/wordsize.h>. Check __WORDSIZE instead of __x86_64__.
+
+2012-05-31 H.J. Lu <hongjiu.lu@intel.com>
+
* sysdeps/unix/sysv/linux/i386/Makefile (sysdep_headers):
Don't add sys/elf.h sys/perm.h sys/reg.h sys/vm86.h
sys/debugreg.h sys/io.h here.
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=de337384f1ad6e057862f5ee5fd6b71db924109f
commit de337384f1ad6e057862f5ee5fd6b71db924109f
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed May 30 18:09:02 2012 -0700
Add sysdep_headers to linux/x86/Makefile
diff --git a/ChangeLog b/ChangeLog
index c12155c..0c6e072 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,17 @@
2012-05-31 H.J. Lu <hongjiu.lu@intel.com>
+ * sysdeps/unix/sysv/linux/i386/Makefile (sysdep_headers):
+ Don't add sys/elf.h sys/perm.h sys/reg.h sys/vm86.h
+ sys/debugreg.h sys/io.h here.
+ * sysdeps/unix/sysv/linux/x86/Makefile (sysdep_headers): Add
+ sys/elf.h sys/perm.h sys/reg.h sys/vm86.h sys/debugreg.h
+ sys/io.h.
+ * sysdeps/unix/sysv/linux/x86_64/Makefile (sysdep_headers):
+ Don't add sys/perm.h sys/reg.h sys/debugreg.h sys/io.h here.
+
+2012-05-30 H.J. Lu <hongjiu.lu@intel.com>
+
* sysdeps/i386/i486/bits/string.h: Move contents to ...
* sysdeps/x86/bits/string.h: Here.
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index f4585d7..acc3021 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -3,7 +3,6 @@ default-abi := 32
ifeq ($(subdir),misc)
sysdep_routines += ioperm iopl vm86 call_pselect6 call_fallocate
-sysdep_headers += sys/elf.h sys/perm.h sys/reg.h sys/vm86.h sys/debugreg.h sys/io.h
endif
ifeq ($(subdir),elf)
diff --git a/sysdeps/unix/sysv/linux/x86/Makefile b/sysdeps/unix/sysv/linux/x86/Makefile
index cf4a55c..6412a9e 100644
--- a/sysdeps/unix/sysv/linux/x86/Makefile
+++ b/sysdeps/unix/sysv/linux/x86/Makefile
@@ -12,3 +12,7 @@ abi-64-ld-soname := ld-linux-x86-64.so.2
abi-x32-options := -U__i386__ -D__x86_64__ -D__ILP32__ -U__LP64__
abi-x32-condition := defined __x86_64__ && defined __ILP32__
abi-x32-ld-soname := ld-linux-x32.so.2
+
+ifeq ($(subdir),misc)
+sysdep_headers += sys/elf.h sys/perm.h sys/reg.h sys/vm86.h sys/debugreg.h sys/io.h
+endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/Makefile b/sysdeps/unix/sysv/linux/x86_64/Makefile
index dd4ab59..d6a9d36 100644
--- a/sysdeps/unix/sysv/linux/x86_64/Makefile
+++ b/sysdeps/unix/sysv/linux/x86_64/Makefile
@@ -1,6 +1,5 @@
ifeq ($(subdir),misc)
sysdep_routines += ioperm iopl
-sysdep_headers += sys/perm.h sys/reg.h sys/debugreg.h sys/io.h
endif
ifeq ($(subdir),stdlib)
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c45604f1cd1e4686e91e66d813b67c2ab9d488b5
commit c45604f1cd1e4686e91e66d813b67c2ab9d488b5
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed May 30 18:03:17 2012 -0700
Move i486/bits/string.h to x86/bits/string.h
diff --git a/ChangeLog b/ChangeLog
index e8b2d86..c12155c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,11 @@
2012-05-31 H.J. Lu <hongjiu.lu@intel.com>
+ * sysdeps/i386/i486/bits/string.h: Move contents to ...
+ * sysdeps/x86/bits/string.h: Here.
+
+2012-05-30 H.J. Lu <hongjiu.lu@intel.com>
+
[BZ #14117]
* sysdeps/unix/sysv/linux/i386/sys/debugreg.h: Removed.
* sysdeps/unix/sysv/linux/i386/sys/io.h: Likewise.
diff --git a/sysdeps/i386/i486/bits/string.h b/sysdeps/i386/i486/bits/string.h
deleted file mode 100644
index a5edf51..0000000
--- a/sysdeps/i386/i486/bits/string.h
+++ /dev/null
@@ -1,1975 +0,0 @@
-/* Optimized, inlined string functions. i486 version.
- Copyright (C) 1997,1998,1999,2000,2001,2002,2003,2004,2007,2011,2012
- 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 _STRING_H
-# error "Never use <bits/string.h> directly; include <string.h> instead."
-#endif
-
-/* The ix86 processors can access unaligned multi-byte variables. */
-#define _STRING_ARCH_unaligned 1
-
-
-/* We only provide optimizations if the user selects them and if
- GNU CC is used. */
-#if !defined __NO_STRING_INLINES && defined __USE_STRING_INLINES \
- && defined __GNUC__ && __GNUC__ >= 2 && !__BOUNDED_POINTERS__
-
-#ifndef __STRING_INLINE
-# ifndef __extern_inline
-# define __STRING_INLINE inline
-# else
-# define __STRING_INLINE __extern_inline
-# endif
-#endif
-
-/* The macros are used in some of the optimized implementations below. */
-#define __STRING_SMALL_GET16(src, idx) \
- ((((const unsigned char *) (src))[idx + 1] << 8) \
- | ((const unsigned char *) (src))[idx])
-#define __STRING_SMALL_GET32(src, idx) \
- (((((const unsigned char *) (src))[idx + 3] << 8 \
- | ((const unsigned char *) (src))[idx + 2]) << 8 \
- | ((const unsigned char *) (src))[idx + 1]) << 8 \
- | ((const unsigned char *) (src))[idx])
-
-
-/* Copy N bytes of SRC to DEST. */
-#define _HAVE_STRING_ARCH_memcpy 1
-#define memcpy(dest, src, n) \
- (__extension__ (__builtin_constant_p (n) \
- ? __memcpy_c ((dest), (src), (n)) \
- : __memcpy_g ((dest), (src), (n))))
-#define __memcpy_c(dest, src, n) \
- ((n) == 0 \
- ? (dest) \
- : (((n) % 4 == 0) \
- ? __memcpy_by4 (dest, src, n) \
- : (((n) % 2 == 0) \
- ? __memcpy_by2 (dest, src, n) \
- : __memcpy_g (dest, src, n))))
-
-__STRING_INLINE void *__memcpy_by4 (void *__dest, const void *__src,
- size_t __n);
-
-__STRING_INLINE void *
-__memcpy_by4 (void *__dest, const void *__src, size_t __n)
-{
- register unsigned long int __d0, __d1;
- register void *__tmp = __dest;
- __asm__ __volatile__
- ("1:\n\t"
- "movl (%2),%0\n\t"
- "leal 4(%2),%2\n\t"
- "movl %0,(%1)\n\t"
- "leal 4(%1),%1\n\t"
- "decl %3\n\t"
- "jnz 1b"
- : "=&r" (__d0), "=&r" (__tmp), "=&r" (__src), "=&r" (__d1)
- : "1" (__tmp), "2" (__src), "3" (__n / 4)
- : "memory", "cc");
- return __dest;
-}
-
-__STRING_INLINE void *__memcpy_by2 (void *__dest, const void *__src,
- size_t __n);
-
-__STRING_INLINE void *
-__memcpy_by2 (void *__dest, const void *__src, size_t __n)
-{
- register unsigned long int __d0, __d1;
- register void *__tmp = __dest;
- __asm__ __volatile__
- ("shrl $1,%3\n\t"
- "jz 2f\n" /* only a word */
- "1:\n\t"
- "movl (%2),%0\n\t"
- "leal 4(%2),%2\n\t"
- "movl %0,(%1)\n\t"
- "leal 4(%1),%1\n\t"
- "decl %3\n\t"
- "jnz 1b\n"
- "2:\n\t"
- "movw (%2),%w0\n\t"
- "movw %w0,(%1)"
- : "=&q" (__d0), "=&r" (__tmp), "=&r" (__src), "=&r" (__d1)
- : "1" (__tmp), "2" (__src), "3" (__n / 2)
- : "memory", "cc");
- return __dest;
-}
-
-__STRING_INLINE void *__memcpy_g (void *__dest, const void *__src, size_t __n);
-
-__STRING_INLINE void *
-__memcpy_g (void *__dest, const void *__src, size_t __n)
-{
- register unsigned long int __d0, __d1, __d2;
- register void *__tmp = __dest;
- __asm__ __volatile__
- ("cld\n\t"
- "shrl $1,%%ecx\n\t"
- "jnc 1f\n\t"
- "movsb\n"
- "1:\n\t"
- "shrl $1,%%ecx\n\t"
- "jnc 2f\n\t"
- "movsw\n"
- "2:\n\t"
- "rep; movsl"
- : "=&c" (__d0), "=&D" (__d1), "=&S" (__d2),
- "=m" ( *(struct { __extension__ char __x[__n]; } *)__dest)
- : "0" (__n), "1" (__tmp), "2" (__src),
- "m" ( *(struct { __extension__ char __x[__n]; } *)__src)
- : "cc");
- return __dest;
-}
-
-#define _HAVE_STRING_ARCH_memmove 1
-#ifndef _FORCE_INLINES
-/* Copy N bytes of SRC to DEST, guaranteeing
- correct behavior for overlapping strings. */
-#define memmove(dest, src, n) __memmove_g (dest, src, n)
-
-__STRING_INLINE void *__memmove_g (void *, const void *, size_t)
- __asm__ ("memmove");
-
-__STRING_INLINE void *
-__memmove_g (void *__dest, const void *__src, size_t __n)
-{
- register unsigned long int __d0, __d1, __d2;
- register void *__tmp = __dest;
- if (__dest < __src)
- __asm__ __volatile__
- ("cld\n\t"
- "rep; movsb"
- : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2),
- "=m" ( *(struct { __extension__ char __x[__n]; } *)__dest)
- : "0" (__n), "1" (__src), "2" (__tmp),
- "m" ( *(struct { __extension__ char __x[__n]; } *)__src));
- else
- __asm__ __volatile__
- ("std\n\t"
- "rep; movsb\n\t"
- "cld"
- : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2),
- "=m" ( *(struct { __extension__ char __x[__n]; } *)__dest)
- : "0" (__n), "1" (__n - 1 + (const char *) __src),
- "2" (__n - 1 + (char *) __tmp),
- "m" ( *(struct { __extension__ char __x[__n]; } *)__src));
- return __dest;
-}
-#endif
-
-/* Compare N bytes of S1 and S2. */
-#define _HAVE_STRING_ARCH_memcmp 1
-#ifndef _FORCE_INLINES
-# ifndef __PIC__
-/* gcc has problems to spill registers when using PIC. */
-__STRING_INLINE int
-memcmp (const void *__s1, const void *__s2, size_t __n)
-{
- register unsigned long int __d0, __d1, __d2;
- register int __res;
- __asm__ __volatile__
- ("cld\n\t"
- "testl %3,%3\n\t"
- "repe; cmpsb\n\t"
- "je 1f\n\t"
- "sbbl %0,%0\n\t"
- "orl $1,%0\n"
- "1:"
- : "=&a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2)
- : "0" (0), "1" (__s1), "2" (__s2), "3" (__n),
- "m" ( *(struct { __extension__ char __x[__n]; } *)__s1),
- "m" ( *(struct { __extension__ char __x[__n]; } *)__s2)
- : "cc");
- return __res;
-}
-# endif
-#endif
-
-/* Set N bytes of S to C. */
-#define _HAVE_STRING_ARCH_memset 1
-#define _USE_STRING_ARCH_memset 1
-#define memset(s, c, n) \
- (__extension__ (__builtin_constant_p (n) && (n) <= 16 \
- ? ((n) == 1 \
- ? __memset_c1 ((s), (c)) \
- : __memset_gc ((s), (c), (n))) \
- : (__builtin_constant_p (c) \
- ? (__builtin_constant_p (n) \
- ? __memset_ccn ((s), (c), (n)) \
- : memset ((s), (c), (n))) \
- : (__builtin_constant_p (n) \
- ? __memset_gcn ((s), (c), (n)) \
- : memset ((s), (c), (n))))))
-
-#define __memset_c1(s, c) ({ void *__s = (s); \
- *((unsigned char *) __s) = (unsigned char) (c); \
- __s; })
-
-#define __memset_gc(s, c, n) \
- ({ void *__s = (s); \
- union { \
- unsigned int __ui; \
- unsigned short int __usi; \
- unsigned char __uc; \
- } *__u = __s; \
- unsigned int __c = ((unsigned int) ((unsigned char) (c))) * 0x01010101; \
- \
- /* We apply a trick here. `gcc' would implement the following \
- assignments using immediate operands. But this uses to much \
- memory (7, instead of 4 bytes). So we force the value in a \
- registers. */ \
- if ((n) == 3 || (n) >= 5) \
- __asm__ __volatile__ ("" : "=r" (__c) : "0" (__c)); \
- \
- /* This `switch' statement will be removed at compile-time. */ \
- switch (n) \
- { \
- case 15: \
- __u->__ui = __c; \
- __u = __extension__ ((void *) __u + 4); \
- case 11: \
- __u->__ui = __c; \
- __u = __extension__ ((void *) __u + 4); \
- case 7: \
- __u->__ui = __c; \
- __u = __extension__ ((void *) __u + 4); \
- case 3: \
- __u->__usi = (unsigned short int) __c; \
- __u = __extension__ ((void *) __u + 2); \
- __u->__uc = (unsigned char) __c; \
- break; \
- \
- case 14: \
- __u->__ui = __c; \
- __u = __extension__ ((void *) __u + 4); \
- case 10: \
- __u->__ui = __c; \
- __u = __extension__ ((void *) __u + 4); \
- case 6: \
- __u->__ui = __c; \
- __u = __extension__ ((void *) __u + 4); \
- case 2: \
- __u->__usi = (unsigned short int) __c; \
- break; \
- \
- case 13: \
- __u->__ui = __c; \
- __u = __extension__ ((void *) __u + 4); \
- case 9: \
- __u->__ui = __c; \
- __u = __extension__ ((void *) __u + 4); \
- case 5: \
- __u->__ui = __c; \
- __u = __extension__ ((void *) __u + 4); \
- case 1: \
- __u->__uc = (unsigned char) __c; \
- break; \
- \
- case 16: \
- __u->__ui = __c; \
- __u = __extension__ ((void *) __u + 4); \
- case 12: \
- __u->__ui = __c; \
- __u = __extension__ ((void *) __u + 4); \
- case 8: \
- __u->__ui = __c; \
- __u = __extension__ ((void *) __u + 4); \
- case 4: \
- __u->__ui = __c; \
- case 0: \
- break; \
- } \
- \
- __s; })
-
-#define __memset_ccn(s, c, n) \
- (((n) % 4 == 0) \
- ? __memset_ccn_by4 (s, ((unsigned int) ((unsigned char) (c))) * 0x01010101,\
- n) \
- : (((n) % 2 == 0) \
- ? __memset_ccn_by2 (s, \
- ((unsigned int) ((unsigned char) (c))) * 0x01010101,\
- n) \
- : memset (s, c, n)))
-
-__STRING_INLINE void *__memset_ccn_by4 (void *__s, unsigned int __c,
- size_t __n);
-
-__STRING_INLINE void *
-__memset_ccn_by4 (void *__s, unsigned int __c, size_t __n)
-{
- register void *__tmp = __s;
- register unsigned long int __d0;
-#ifdef __i686__
- __asm__ __volatile__
- ("cld\n\t"
- "rep; stosl"
- : "=&a" (__c), "=&D" (__tmp), "=&c" (__d0),
- "=m" ( *(struct { __extension__ char __x[__n]; } *)__s)
- : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
- : "cc");
-#else
- __asm__ __volatile__
- ("1:\n\t"
- "movl %0,(%1)\n\t"
- "addl $4,%1\n\t"
- "decl %2\n\t"
- "jnz 1b\n"
- : "=&r" (__c), "=&r" (__tmp), "=&r" (__d0),
- "=m" ( *(struct { __extension__ char __x[__n]; } *)__s)
- : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
- : "cc");
-#endif
- return __s;
-}
-
-__STRING_INLINE void *__memset_ccn_by2 (void *__s, unsigned int __c,
- size_t __n);
-
-__STRING_INLINE void *
-__memset_ccn_by2 (void *__s, unsigned int __c, size_t __n)
-{
- register unsigned long int __d0, __d1;
- register void *__tmp = __s;
-#ifdef __i686__
- __asm__ __volatile__
- ("cld\n\t"
- "rep; stosl\n"
- "stosw"
- : "=&a" (__d0), "=&D" (__tmp), "=&c" (__d1),
- "=m" ( *(struct { __extension__ char __x[__n]; } *)__s)
- : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
- : "cc");
-#else
- __asm__ __volatile__
- ("1:\tmovl %0,(%1)\n\t"
- "leal 4(%1),%1\n\t"
- "decl %2\n\t"
- "jnz 1b\n"
- "movw %w0,(%1)"
- : "=&q" (__d0), "=&r" (__tmp), "=&r" (__d1),
- "=m" ( *(struct { __extension__ char __x[__n]; } *)__s)
- : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
- : "cc");
-#endif
- return __s;
-}
-
-#define __memset_gcn(s, c, n) \
- (((n) % 4 == 0) \
- ? __memset_gcn_by4 (s, c, n) \
- : (((n) % 2 == 0) \
- ? __memset_gcn_by2 (s, c, n) \
- : memset (s, c, n)))
-
-__STRING_INLINE void *__memset_gcn_by4 (void *__s, int __c, size_t __n);
-
-__STRING_INLINE void *
-__memset_gcn_by4 (void *__s, int __c, size_t __n)
-{
- register void *__tmp = __s;
- register unsigned long int __d0;
- __asm__ __volatile__
- ("movb %b0,%h0\n"
- "pushw %w0\n\t"
- "shll $16,%0\n\t"
- "popw %w0\n"
- "1:\n\t"
- "movl %0,(%1)\n\t"
- "addl $4,%1\n\t"
- "decl %2\n\t"
- "jnz 1b\n"
- : "=&q" (__c), "=&r" (__tmp), "=&r" (__d0),
- "=m" ( *(struct { __extension__ char __x[__n]; } *)__s)
- : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
- : "cc");
- return __s;
-}
-
-__STRING_INLINE void *__memset_gcn_by2 (void *__s, int __c, size_t __n);
-
-__STRING_INLINE void *
-__memset_gcn_by2 (void *__s, int __c, size_t __n)
-{
- register unsigned long int __d0, __d1;
- register void *__tmp = __s;
- __asm__ __volatile__
- ("movb %b0,%h0\n\t"
- "pushw %w0\n\t"
- "shll $16,%0\n\t"
- "popw %w0\n"
- "1:\n\t"
- "movl %0,(%1)\n\t"
- "leal 4(%1),%1\n\t"
- "decl %2\n\t"
- "jnz 1b\n"
- "movw %w0,(%1)"
- : "=&q" (__d0), "=&r" (__tmp), "=&r" (__d1),
- "=m" ( *(struct { __extension__ char __x[__n]; } *)__s)
- : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
- : "cc");
- return __s;
-}
-
-
-/* Search N bytes of S for C. */
-#define _HAVE_STRING_ARCH_memchr 1
-#ifndef _FORCE_INLINES
-__STRING_INLINE void *
-memchr (const void *__s, int __c, size_t __n)
-{
- register unsigned long int __d0;
-#ifdef __i686__
- register unsigned long int __d1;
-#endif
- register unsigned char *__res;
- if (__n == 0)
- return NULL;
-#ifdef __i686__
- __asm__ __volatile__
- ("cld\n\t"
- "repne; scasb\n\t"
- "cmovne %2,%0"
- : "=D" (__res), "=&c" (__d0), "=&r" (__d1)
- : "a" (__c), "0" (__s), "1" (__n), "2" (1),
- "m" ( *(struct { __extension__ char __x[__n]; } *)__s)
- : "cc");
-#else
- __asm__ __volatile__
- ("cld\n\t"
- "repne; scasb\n\t"
- "je 1f\n\t"
- "movl $1,%0\n"
- "1:"
- : "=D" (__res), "=&c" (__d0)
- : "a" (__c), "0" (__s), "1" (__n),
- "m" ( *(struct { __extension__ char __x[__n]; } *)__s)
- : "cc");
-#endif
- return __res - 1;
-}
-#endif
-
-#define _HAVE_STRING_ARCH_memrchr 1
-#ifndef _FORCE_INLINES
-__STRING_INLINE void *__memrchr (const void *__s, int __c, size_t __n);
-
-__STRING_INLINE void *
-__memrchr (const void *__s, int __c, size_t __n)
-{
- register unsigned long int __d0;
-# ifdef __i686__
- register unsigned long int __d1;
-# endif
- register void *__res;
- if (__n == 0)
- return NULL;
-# ifdef __i686__
- __asm__ __volatile__
- ("std\n\t"
- "repne; scasb\n\t"
- "cmovne %2,%0\n\t"
- "cld\n\t"
- "incl %0"
- : "=D" (__res), "=&c" (__d0), "=&r" (__d1)
- : "a" (__c), "0" (__s + __n - 1), "1" (__n), "2" (-1),
- "m" ( *(struct { __extension__ char __x[__n]; } *)__s)
- : "cc");
-# else
- __asm__ __volatile__
- ("std\n\t"
- "repne; scasb\n\t"
- "je 1f\n\t"
- "orl $-1,%0\n"
- "1:\tcld\n\t"
- "incl %0"
- : "=D" (__res), "=&c" (__d0)
- : "a" (__c), "0" (__s + __n - 1), "1" (__n),
- "m" ( *(struct { __extension__ char __x[__n]; } *)__s)
- : "cc");
-# endif
- return __res;
-}
-# ifdef __USE_GNU
-# define memrchr(s, c, n) __memrchr ((s), (c), (n))
-# endif
-#endif
-
-/* Return pointer to C in S. */
-#define _HAVE_STRING_ARCH_rawmemchr 1
-__STRING_INLINE void *__rawmemchr (const void *__s, int __c);
-
-#ifndef _FORCE_INLINES
-__STRING_INLINE void *
-__rawmemchr (const void *__s, int __c)
-{
- register unsigned long int __d0;
- register unsigned char *__res;
- __asm__ __volatile__
- ("cld\n\t"
- "repne; scasb\n\t"
- : "=D" (__res), "=&c" (__d0)
- : "a" (__c), "0" (__s), "1" (0xffffffff),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s)
- : "cc");
- return __res - 1;
-}
-# ifdef __USE_GNU
-__STRING_INLINE void *
-rawmemchr (const void *__s, int __c)
-{
- return __rawmemchr (__s, __c);
-}
-# endif /* use GNU */
-#endif
-
-
-/* Return the length of S. */
-#define _HAVE_STRING_ARCH_strlen 1
-#define strlen(str) \
- (__extension__ (__builtin_constant_p (str) \
- ? __builtin_strlen (str) \
- : __strlen_g (str)))
-__STRING_INLINE size_t __strlen_g (const char *__str);
-
-__STRING_INLINE size_t
-__strlen_g (const char *__str)
-{
- register char __dummy;
- register const char *__tmp = __str;
- __asm__ __volatile__
- ("1:\n\t"
- "movb (%0),%b1\n\t"
- "leal 1(%0),%0\n\t"
- "testb %b1,%b1\n\t"
- "jne 1b"
- : "=r" (__tmp), "=&q" (__dummy)
- : "0" (__str),
- "m" ( *(struct { char __x[0xfffffff]; } *)__str)
- : "cc" );
- return __tmp - __str - 1;
-}
-
-
-/* Copy SRC to DEST. */
-#define _HAVE_STRING_ARCH_strcpy 1
-#define strcpy(dest, src) \
- (__extension__ (__builtin_constant_p (src) \
- ? (sizeof ((src)[0]) == 1 && strlen (src) + 1 <= 8 \
- ? __strcpy_a_small ((dest), (src), strlen (src) + 1) \
- : (char *) memcpy ((char *) (dest), \
- (const char *) (src), \
- strlen (src) + 1)) \
- : __strcpy_g ((dest), (src))))
-
-#define __strcpy_a_small(dest, src, srclen) \
- (__extension__ ({ char *__dest = (dest); \
- union { \
- unsigned int __ui; \
- unsigned short int __usi; \
- unsigned char __uc; \
- char __c; \
- } *__u = (void *) __dest; \
- switch (srclen) \
- { \
- case 1: \
- __u->__uc = '\0'; \
- break; \
- case 2: \
- __u->__usi = __STRING_SMALL_GET16 (src, 0); \
- break; \
- case 3: \
- __u->__usi = __STRING_SMALL_GET16 (src, 0); \
- __u = __extension__ ((void *) __u + 2); \
- __u->__uc = '\0'; \
- break; \
- case 4: \
- __u->__ui = __STRING_SMALL_GET32 (src, 0); \
- break; \
- case 5: \
- __u->__ui = __STRING_SMALL_GET32 (src, 0); \
- __u = __extension__ ((void *) __u + 4); \
- __u->__uc = '\0'; \
- break; \
- case 6: \
- __u->__ui = __STRING_SMALL_GET32 (src, 0); \
- __u = __extension__ ((void *) __u + 4); \
- __u->__usi = __STRING_SMALL_GET16 (src, 4); \
- break; \
- case 7: \
- __u->__ui = __STRING_SMALL_GET32 (src, 0); \
- __u = __extension__ ((void *) __u + 4); \
- __u->__usi = __STRING_SMALL_GET16 (src, 4); \
- __u = __extension__ ((void *) __u + 2); \
- __u->__uc = '\0'; \
- break; \
- case 8: \
- __u->__ui = __STRING_SMALL_GET32 (src, 0); \
- __u = __extension__ ((void *) __u + 4); \
- __u->__ui = __STRING_SMALL_GET32 (src, 4); \
- break; \
- } \
- (char *) __dest; }))
-
-__STRING_INLINE char *__strcpy_g (char *__dest, const char *__src);
-
-__STRING_INLINE char *
-__strcpy_g (char *__dest, const char *__src)
-{
- register char *__tmp = __dest;
- register char __dummy;
- __asm__ __volatile__
- (
- "1:\n\t"
- "movb (%0),%b2\n\t"
- "leal 1(%0),%0\n\t"
- "movb %b2,(%1)\n\t"
- "leal 1(%1),%1\n\t"
- "testb %b2,%b2\n\t"
- "jne 1b"
- : "=&r" (__src), "=&r" (__tmp), "=&q" (__dummy),
- "=m" ( *(struct { char __x[0xfffffff]; } *)__dest)
- : "0" (__src), "1" (__tmp),
- "m" ( *(struct { char __x[0xfffffff]; } *)__src)
- : "cc");
- return __dest;
-}
-
-
-#ifdef __USE_GNU
-# define _HAVE_STRING_ARCH_stpcpy 1
-/* Copy SRC to DEST. */
-# define __stpcpy(dest, src) \
- (__extension__ (__builtin_constant_p (src) \
- ? (strlen (src) + 1 <= 8 \
- ? __stpcpy_a_small ((dest), (src), strlen (src) + 1) \
- : __stpcpy_c ((dest), (src), strlen (src) + 1)) \
- : __stpcpy_g ((dest), (src))))
-# define __stpcpy_c(dest, src, srclen) \
- ((srclen) % 4 == 0 \
- ? __mempcpy_by4 (dest, src, srclen) - 1 \
- : ((srclen) % 2 == 0 \
- ? __mempcpy_by2 (dest, src, srclen) - 1 \
- : __mempcpy_byn (dest, src, srclen) - 1))
-
-/* In glibc itself we use this symbol for namespace reasons. */
-# define stpcpy(dest, src) __stpcpy ((dest), (src))
-
-# define __stpcpy_a_small(dest, src, srclen) \
- (__extension__ ({ union { \
- unsigned int __ui; \
- unsigned short int __usi; \
- unsigned char __uc; \
- char __c; \
- } *__u = (void *) (dest); \
- switch (srclen) \
- { \
- case 1: \
- __u->__uc = '\0'; \
- break; \
- case 2: \
- __u->__usi = __STRING_SMALL_GET16 (src, 0); \
- __u = __extension__ ((void *) __u + 1); \
- break; \
- case 3: \
- __u->__usi = __STRING_SMALL_GET16 (src, 0); \
- __u = __extension__ ((void *) __u + 2); \
- __u->__uc = '\0'; \
- break; \
- case 4: \
- __u->__ui = __STRING_SMALL_GET32 (src, 0); \
- __u = __extension__ ((void *) __u + 3); \
- break; \
- case 5: \
- __u->__ui = __STRING_SMALL_GET32 (src, 0); \
- __u = __extension__ ((void *) __u + 4); \
- __u->__uc = '\0'; \
- break; \
- case 6: \
- __u->__ui = __STRING_SMALL_GET32 (src, 0); \
- __u = __extension__ ((void *) __u + 4); \
- __u->__usi = __STRING_SMALL_GET16 (src, 4); \
- __u = __extension__ ((void *) __u + 1); \
- break; \
- case 7: \
- __u->__ui = __STRING_SMALL_GET32 (src, 0); \
- __u = __extension__ ((void *) __u + 4); \
- __u->__usi = __STRING_SMALL_GET16 (src, 4); \
- __u = __extension__ ((void *) __u + 2); \
- __u->__uc = '\0'; \
- break; \
- case 8: \
- __u->__ui = __STRING_SMALL_GET32 (src, 0); \
- __u = __extension__ ((void *) __u + 4); \
- __u->__ui = __STRING_SMALL_GET32 (src, 4); \
- __u = __extension__ ((void *) __u + 3); \
- break; \
- } \
- (char *) __u; }))
-
-__STRING_INLINE char *__mempcpy_by4 (char *__dest, const char *__src,
- size_t __srclen);
-
-__STRING_INLINE char *
-__mempcpy_by4 (char *__dest, const char *__src, size_t __srclen)
-{
- register char *__tmp = __dest;
- register unsigned long int __d0, __d1;
- __asm__ __volatile__
- ("1:\n\t"
- "movl (%2),%0\n\t"
- "leal 4(%2),%2\n\t"
- "movl %0,(%1)\n\t"
- "leal 4(%1),%1\n\t"
- "decl %3\n\t"
- "jnz 1b"
- : "=&r" (__d0), "=r" (__tmp), "=&r" (__src), "=&r" (__d1)
- : "1" (__tmp), "2" (__src), "3" (__srclen / 4)
- : "memory", "cc");
- return __tmp;
-}
-
-__STRING_INLINE char *__mempcpy_by2 (char *__dest, const char *__src,
- size_t __srclen);
-
-__STRING_INLINE char *
-__mempcpy_by2 (char *__dest, const char *__src, size_t __srclen)
-{
- register char *__tmp = __dest;
- register unsigned long int __d0, __d1;
- __asm__ __volatile__
- ("shrl $1,%3\n\t"
- "jz 2f\n" /* only a word */
- "1:\n\t"
- "movl (%2),%0\n\t"
- "leal 4(%2),%2\n\t"
- "movl %0,(%1)\n\t"
- "leal 4(%1),%1\n\t"
- "decl %3\n\t"
- "jnz 1b\n"
- "2:\n\t"
- "movw (%2),%w0\n\t"
- "movw %w0,(%1)"
- : "=&q" (__d0), "=r" (__tmp), "=&r" (__src), "=&r" (__d1),
- "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest)
- : "1" (__tmp), "2" (__src), "3" (__srclen / 2),
- "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
- : "cc");
- return __tmp + 2;
-}
-
-__STRING_INLINE char *__mempcpy_byn (char *__dest, const char *__src,
- size_t __srclen);
-
-__STRING_INLINE char *
-__mempcpy_byn (char *__dest, const char *__src, size_t __srclen)
-{
- register unsigned long __d0, __d1;
- register char *__tmp = __dest;
- __asm__ __volatile__
- ("cld\n\t"
- "shrl $1,%%ecx\n\t"
- "jnc 1f\n\t"
- "movsb\n"
- "1:\n\t"
- "shrl $1,%%ecx\n\t"
- "jnc 2f\n\t"
- "movsw\n"
- "2:\n\t"
- "rep; movsl"
- : "=D" (__tmp), "=&c" (__d0), "=&S" (__d1),
- "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest)
- : "0" (__tmp), "1" (__srclen), "2" (__src),
- "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
- : "cc");
- return __tmp;
-}
-
-__STRING_INLINE char *__stpcpy_g (char *__dest, const char *__src);
-
-__STRING_INLINE char *
-__stpcpy_g (char *__dest, const char *__src)
-{
- register char *__tmp = __dest;
- register char __dummy;
- __asm__ __volatile__
- (
- "1:\n\t"
- "movb (%0),%b2\n\t"
- "leal 1(%0),%0\n\t"
- "movb %b2,(%1)\n\t"
- "leal 1(%1),%1\n\t"
- "testb %b2,%b2\n\t"
- "jne 1b"
- : "=&r" (__src), "=r" (__tmp), "=&q" (__dummy),
- "=m" ( *(struct { char __x[0xfffffff]; } *)__dest)
- : "0" (__src), "1" (__tmp),
- "m" ( *(struct { char __x[0xfffffff]; } *)__src)
- : "cc");
- return __tmp - 1;
-}
-#endif
-
-
-/* Copy no more than N characters of SRC to DEST. */
-#define _HAVE_STRING_ARCH_strncpy 1
-#define strncpy(dest, src, n) \
- (__extension__ (__builtin_constant_p (src) \
- ? ((strlen (src) + 1 >= ((size_t) (n)) \
- ? (char *) memcpy ((char *) (dest), \
- (const char *) (src), n) \
- : __strncpy_cg ((dest), (src), strlen (src) + 1, n))) \
- : __strncpy_gg ((dest), (src), n)))
-#define __strncpy_cg(dest, src, srclen, n) \
- (((srclen) % 4 == 0) \
- ? __strncpy_by4 (dest, src, srclen, n) \
- : (((srclen) % 2 == 0) \
- ? __strncpy_by2 (dest, src, srclen, n) \
- : __strncpy_byn (dest, src, srclen, n)))
-
-__STRING_INLINE char *__strncpy_by4 (char *__dest, const char __src[],
- size_t __srclen, size_t __n);
-
-__STRING_INLINE char *
-__strncpy_by4 (char *__dest, const char __src[], size_t __srclen, size_t __n)
-{
- register char *__tmp = __dest;
- register int __dummy1, __dummy2;
- __asm__ __volatile__
- ("1:\n\t"
- "movl (%2),%0\n\t"
- "leal 4(%2),%2\n\t"
- "movl %0,(%1)\n\t"
- "leal 4(%1),%1\n\t"
- "decl %3\n\t"
- "jnz 1b"
- : "=&r" (__dummy1), "=r" (__tmp), "=&r" (__src), "=&r" (__dummy2),
- "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest)
- : "1" (__tmp), "2" (__src), "3" (__srclen / 4),
- "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
- : "cc");
- (void) memset (__tmp, '\0', __n - __srclen);
- return __dest;
-}
-
-__STRING_INLINE char *__strncpy_by2 (char *__dest, const char __src[],
- size_t __srclen, size_t __n);
-
-__STRING_INLINE char *
-__strncpy_by2 (char *__dest, const char __src[], size_t __srclen, size_t __n)
-{
- register char *__tmp = __dest;
- register int __dummy1, __dummy2;
- __asm__ __volatile__
- ("shrl $1,%3\n\t"
- "jz 2f\n" /* only a word */
- "1:\n\t"
- "movl (%2),%0\n\t"
- "leal 4(%2),%2\n\t"
- "movl %0,(%1)\n\t"
- "leal 4(%1),%1\n\t"
- "decl %3\n\t"
- "jnz 1b\n"
- "2:\n\t"
- "movw (%2),%w0\n\t"
- "movw %w0,(%1)\n\t"
- : "=&q" (__dummy1), "=r" (__tmp), "=&r" (__src), "=&r" (__dummy2),
- "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest)
- : "1" (__tmp), "2" (__src), "3" (__srclen / 2),
- "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
- : "cc");
- (void) memset (__tmp + 2, '\0', __n - __srclen);
- return __dest;
-}
-
-__STRING_INLINE char *__strncpy_byn (char *__dest, const char __src[],
- size_t __srclen, size_t __n);
-
-__STRING_INLINE char *
-__strncpy_byn (char *__dest, const char __src[], size_t __srclen, size_t __n)
-{
- register unsigned long int __d0, __d1;
- register char *__tmp = __dest;
- __asm__ __volatile__
- ("cld\n\t"
- "shrl $1,%1\n\t"
- "jnc 1f\n\t"
- "movsb\n"
- "1:\n\t"
- "shrl $1,%1\n\t"
- "jnc 2f\n\t"
- "movsw\n"
- "2:\n\t"
- "rep; movsl"
- : "=D" (__tmp), "=&c" (__d0), "=&S" (__d1),
- "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest)
- : "1" (__srclen), "0" (__tmp),"2" (__src),
- "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
- : "cc");
- (void) memset (__tmp, '\0', __n - __srclen);
- return __dest;
-}
-
-__STRING_INLINE char *__strncpy_gg (char *__dest, const char *__src,
- size_t __n);
-
-__STRING_INLINE char *
-__strncpy_gg (char *__dest, const char *__src, size_t __n)
-{
- register char *__tmp = __dest;
- register char __dummy;
- if (__n > 0)
- __asm__ __volatile__
- ("1:\n\t"
- "movb (%0),%2\n\t"
- "incl %0\n\t"
- "movb %2,(%1)\n\t"
- "incl %1\n\t"
- "decl %3\n\t"
- "je 3f\n\t"
- "testb %2,%2\n\t"
- "jne 1b\n\t"
- "2:\n\t"
- "movb %2,(%1)\n\t"
- "incl %1\n\t"
- "decl %3\n\t"
- "jne 2b\n\t"
- "3:"
- : "=&r" (__src), "=&r" (__tmp), "=&q" (__dummy), "=&r" (__n)
- : "0" (__src), "1" (__tmp), "3" (__n)
- : "memory", "cc");
-
- return __dest;
-}
-
-
-/* Append SRC onto DEST. */
-#define _HAVE_STRING_ARCH_strcat 1
-#define strcat(dest, src) \
- (__extension__ (__builtin_constant_p (src) \
- ? __strcat_c ((dest), (src), strlen (src) + 1) \
- : __strcat_g ((dest), (src))))
-
-__STRING_INLINE char *__strcat_c (char *__dest, const char __src[],
- size_t __srclen);
-
-__STRING_INLINE char *
-__strcat_c (char *__dest, const char __src[], size_t __srclen)
-{
-#ifdef __i686__
- register unsigned long int __d0;
- register char *__tmp;
- __asm__ __volatile__
- ("repne; scasb"
- : "=D" (__tmp), "=&c" (__d0),
- "=m" ( *(struct { char __x[0xfffffff]; } *)__dest)
- : "0" (__dest), "1" (0xffffffff), "a" (0),
- "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
- : "cc");
- --__tmp;
-#else
- register char *__tmp = __dest - 1;
- __asm__ __volatile__
- ("1:\n\t"
- "incl %0\n\t"
- "cmpb $0,(%0)\n\t"
- "jne 1b\n"
- : "=r" (__tmp),
- "=m" ( *(struct { char __x[0xfffffff]; } *)__dest)
- : "0" (__tmp),
- "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
- : "cc");
-#endif
- (void) memcpy (__tmp, __src, __srclen);
- return __dest;
-}
-
-__STRING_INLINE char *__strcat_g (char *__dest, const char *__src);
-
-__STRING_INLINE char *
-__strcat_g (char *__dest, const char *__src)
-{
- register char *__tmp = __dest - 1;
- register char __dummy;
- __asm__ __volatile__
- ("1:\n\t"
- "incl %1\n\t"
- "cmpb $0,(%1)\n\t"
- "jne 1b\n"
- "2:\n\t"
- "movb (%2),%b0\n\t"
- "incl %2\n\t"
- "movb %b0,(%1)\n\t"
- "incl %1\n\t"
- "testb %b0,%b0\n\t"
- "jne 2b\n"
- : "=&q" (__dummy), "=&r" (__tmp), "=&r" (__src),
- "=m" ( *(struct { char __x[0xfffffff]; } *)__dest)
- : "1" (__tmp), "2" (__src),
- "m" ( *(struct { char __x[0xfffffff]; } *)__src)
- : "memory", "cc");
- return __dest;
-}
-
-
-/* Append no more than N characters from SRC onto DEST. */
-#define _HAVE_STRING_ARCH_strncat 1
-#define strncat(dest, src, n) \
- (__extension__ ({ char *__dest = (dest); \
- __builtin_constant_p (src) && __builtin_constant_p (n) \
- ? (strlen (src) < ((size_t) (n)) \
- ? strcat (__dest, (src)) \
- : (*(char *)__mempcpy (strchr (__dest, '\0'), \
- (const char *) (src), \
- (n)) = 0, __dest)) \
- : __strncat_g (__dest, (src), (n)); }))
-
-__STRING_INLINE char *__strncat_g (char *__dest, const char __src[],
- size_t __n);
-
-__STRING_INLINE char *
-__strncat_g (char *__dest, const char __src[], size_t __n)
-{
- register char *__tmp = __dest;
- register char __dummy;
-#ifdef __i686__
- __asm__ __volatile__
- ("repne; scasb\n"
- "movl %4, %3\n\t"
- "decl %1\n\t"
- "1:\n\t"
- "subl $1,%3\n\t"
- "jc 2f\n\t"
- "movb (%2),%b0\n\t"
- "movsb\n\t"
- "testb %b0,%b0\n\t"
- "jne 1b\n\t"
- "decl %1\n"
- "2:\n\t"
- "movb $0,(%1)"
- : "=&a" (__dummy), "=&D" (__tmp), "=&S" (__src), "=&c" (__n)
- : "g" (__n), "0" (0), "1" (__tmp), "2" (__src), "3" (0xffffffff)
- : "memory", "cc");
-#else
- --__tmp;
- __asm__ __volatile__
- ("1:\n\t"
- "cmpb $0,1(%1)\n\t"
- "leal 1(%1),%1\n\t"
- "jne 1b\n"
- "2:\n\t"
- "subl $1,%3\n\t"
- "jc 3f\n\t"
- "movb (%2),%b0\n\t"
- "leal 1(%2),%2\n\t"
- "movb %b0,(%1)\n\t"
- "leal 1(%1),%1\n\t"
- "testb %b0,%b0\n\t"
- "jne 2b\n\t"
- "decl %1\n"
- "3:\n\t"
- "movb $0,(%1)"
- : "=&q" (__dummy), "=&r" (__tmp), "=&r" (__src), "=&r" (__n)
- : "1" (__tmp), "2" (__src), "3" (__n)
- : "memory", "cc");
-#endif
- return __dest;
-}
-
-
-/* Compare S1 and S2. */
-#define _HAVE_STRING_ARCH_strcmp 1
-#define strcmp(s1, s2) \
- (__extension__ (__builtin_constant_p (s1) && __builtin_constant_p (s2) \
- && (sizeof ((s1)[0]) != 1 || strlen (s1) >= 4) \
- && (sizeof ((s2)[0]) != 1 || strlen (s2) >= 4) \
- ? memcmp ((const char *) (s1), (const char *) (s2), \
- (strlen (s1) < strlen (s2) \
- ? strlen (s1) : strlen (s2)) + 1) \
- : (__builtin_constant_p (s1) && sizeof ((s1)[0]) == 1 \
- && sizeof ((s2)[0]) == 1 && strlen (s1) < 4 \
- ? (__builtin_constant_p (s2) && sizeof ((s2)[0]) == 1 \
- ? __strcmp_cc ((const unsigned char *) (s1), \
- (const unsigned char *) (s2), \
- strlen (s1)) \
- : __strcmp_cg ((const unsigned char *) (s1), \
- (const unsigned char *) (s2), \
- strlen (s1))) \
- : (__builtin_constant_p (s2) && sizeof ((s1)[0]) == 1 \
- && sizeof ((s2)[0]) == 1 && strlen (s2) < 4 \
- ? (__builtin_constant_p (s1) \
- ? __strcmp_cc ((const unsigned char *) (s1), \
- (const unsigned char *) (s2), \
- strlen (s2)) \
- : __strcmp_gc ((const unsigned char *) (s1), \
- (const unsigned char *) (s2), \
- strlen (s2))) \
- : __strcmp_gg ((s1), (s2))))))
-
-#define __strcmp_cc(s1, s2, l) \
- (__extension__ ({ register int __result = (s1)[0] - (s2)[0]; \
- if (l > 0 && __result == 0) \
- { \
- __result = (s1)[1] - (s2)[1]; \
- if (l > 1 && __result == 0) \
- { \
- __result = (s1)[2] - (s2)[2]; \
- if (l > 2 && __result == 0) \
- __result = (s1)[3] - (s2)[3]; \
- } \
- } \
- __result; }))
-
-#define __strcmp_cg(s1, s2, l1) \
- (__extension__ ({ const unsigned char *__s2 = (s2); \
- register int __result = (s1)[0] - __s2[0]; \
- if (l1 > 0 && __result == 0) \
- { \
- __result = (s1)[1] - __s2[1]; \
- if (l1 > 1 && __result == 0) \
- { \
- __result = (s1)[2] - __s2[2]; \
- if (l1 > 2 && __result == 0) \
- __result = (s1)[3] - __s2[3]; \
- } \
- } \
- __result; }))
-
-#define __strcmp_gc(s1, s2, l2) \
- (__extension__ ({ const unsigned char *__s1 = (s1); \
- register int __result = __s1[0] - (s2)[0]; \
- if (l2 > 0 && __result == 0) \
- { \
- __result = __s1[1] - (s2)[1]; \
- if (l2 > 1 && __result == 0) \
- { \
- __result = __s1[2] - (s2)[2]; \
- if (l2 > 2 && __result == 0) \
- __result = __s1[3] - (s2)[3]; \
- } \
- } \
- __result; }))
-
-__STRING_INLINE int __strcmp_gg (const char *__s1, const char *__s2);
-
-__STRING_INLINE int
-__strcmp_gg (const char *__s1, const char *__s2)
-{
- register int __res;
- __asm__ __volatile__
- ("1:\n\t"
- "movb (%1),%b0\n\t"
- "leal 1(%1),%1\n\t"
- "cmpb %b0,(%2)\n\t"
- "jne 2f\n\t"
- "leal 1(%2),%2\n\t"
- "testb %b0,%b0\n\t"
- "jne 1b\n\t"
- "xorl %0,%0\n\t"
- "jmp 3f\n"
- "2:\n\t"
- "movl $1,%0\n\t"
- "jb 3f\n\t"
- "negl %0\n"
- "3:"
- : "=q" (__res), "=&r" (__s1), "=&r" (__s2)
- : "1" (__s1), "2" (__s2),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s1),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s2)
- : "cc");
- return __res;
-}
-
-
-/* Compare N characters of S1 and S2. */
-#define _HAVE_STRING_ARCH_strncmp 1
-#define strncmp(s1, s2, n) \
- (__extension__ (__builtin_constant_p (s1) && strlen (s1) < ((size_t) (n)) \
- ? strcmp ((s1), (s2)) \
- : (__builtin_constant_p (s2) && strlen (s2) < ((size_t) (n))\
- ? strcmp ((s1), (s2)) \
- : __strncmp_g ((s1), (s2), (n)))))
-
-__STRING_INLINE int __strncmp_g (const char *__s1, const char *__s2,
- size_t __n);
-
-__STRING_INLINE int
-__strncmp_g (const char *__s1, const char *__s2, size_t __n)
-{
- register int __res;
- __asm__ __volatile__
- ("1:\n\t"
- "subl $1,%3\n\t"
- "jc 2f\n\t"
- "movb (%1),%b0\n\t"
- "incl %1\n\t"
- "cmpb %b0,(%2)\n\t"
- "jne 3f\n\t"
- "incl %2\n\t"
- "testb %b0,%b0\n\t"
- "jne 1b\n"
- "2:\n\t"
- "xorl %0,%0\n\t"
- "jmp 4f\n"
- "3:\n\t"
- "movl $1,%0\n\t"
- "jb 4f\n\t"
- "negl %0\n"
- "4:"
- : "=q" (__res), "=&r" (__s1), "=&r" (__s2), "=&r" (__n)
- : "1" (__s1), "2" (__s2), "3" (__n),
- "m" ( *(struct { __extension__ char __x[__n]; } *)__s1),
- "m" ( *(struct { __extension__ char __x[__n]; } *)__s2)
- : "cc");
- return __res;
-}
-
-
-/* Find the first occurrence of C in S. */
-#define _HAVE_STRING_ARCH_strchr 1
-#define _USE_STRING_ARCH_strchr 1
-#define strchr(s, c) \
- (__extension__ (__builtin_constant_p (c) \
- ? ((c) == '\0' \
- ? (char *) __rawmemchr ((s), (c)) \
- : __strchr_c ((s), ((c) & 0xff) << 8)) \
- : __strchr_g ((s), (c))))
-
-__STRING_INLINE char *__strchr_c (const char *__s, int __c);
-
-__STRING_INLINE char *
-__strchr_c (const char *__s, int __c)
-{
- register unsigned long int __d0;
- register char *__res;
- __asm__ __volatile__
- ("1:\n\t"
- "movb (%0),%%al\n\t"
- "cmpb %%ah,%%al\n\t"
- "je 2f\n\t"
- "leal 1(%0),%0\n\t"
- "testb %%al,%%al\n\t"
- "jne 1b\n\t"
- "xorl %0,%0\n"
- "2:"
- : "=r" (__res), "=&a" (__d0)
- : "0" (__s), "1" (__c),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s)
- : "cc");
- return __res;
-}
-
-__STRING_INLINE char *__strchr_g (const char *__s, int __c);
-
-__STRING_INLINE char *
-__strchr_g (const char *__s, int __c)
-{
- register unsigned long int __d0;
- register char *__res;
- __asm__ __volatile__
- ("movb %%al,%%ah\n"
- "1:\n\t"
- "movb (%0),%%al\n\t"
- "cmpb %%ah,%%al\n\t"
- "je 2f\n\t"
- "leal 1(%0),%0\n\t"
- "testb %%al,%%al\n\t"
- "jne 1b\n\t"
- "xorl %0,%0\n"
- "2:"
- : "=r" (__res), "=&a" (__d0)
- : "0" (__s), "1" (__c),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s)
- : "cc");
- return __res;
-}
-
-
-/* Find the first occurrence of C in S or the final NUL byte. */
-#define _HAVE_STRING_ARCH_strchrnul 1
-#define __strchrnul(s, c) \
- (__extension__ (__builtin_constant_p (c) \
- ? ((c) == '\0' \
- ? (char *) __rawmemchr ((s), c) \
- : __strchrnul_c ((s), ((c) & 0xff) << 8)) \
- : __strchrnul_g ((s), c)))
-
-__STRING_INLINE char *__strchrnul_c (const char *__s, int __c);
-
-__STRING_INLINE char *
-__strchrnul_c (const char *__s, int __c)
-{
- register unsigned long int __d0;
- register char *__res;
- __asm__ __volatile__
- ("1:\n\t"
- "movb (%0),%%al\n\t"
- "cmpb %%ah,%%al\n\t"
- "je 2f\n\t"
- "leal 1(%0),%0\n\t"
- "testb %%al,%%al\n\t"
- "jne 1b\n\t"
- "decl %0\n"
- "2:"
- : "=r" (__res), "=&a" (__d0)
- : "0" (__s), "1" (__c),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s)
- : "cc");
- return __res;
-}
-
-__STRING_INLINE char *__strchrnul_g (const char *__s, int __c);
-
-__STRING_INLINE char *
-__strchrnul_g (const char *__s, int __c)
-{
- register unsigned long int __d0;
- register char *__res;
- __asm__ __volatile__
- ("movb %%al,%%ah\n"
- "1:\n\t"
- "movb (%0),%%al\n\t"
- "cmpb %%ah,%%al\n\t"
- "je 2f\n\t"
- "leal 1(%0),%0\n\t"
- "testb %%al,%%al\n\t"
- "jne 1b\n\t"
- "decl %0\n"
- "2:"
- : "=r" (__res), "=&a" (__d0)
- : "0" (__s), "1" (__c),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s)
- : "cc");
- return __res;
-}
-#ifdef __USE_GNU
-# define strchrnul(s, c) __strchrnul ((s), (c))
-#endif
-
-
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
-/* Find the first occurrence of C in S. This is the BSD name. */
-# define _HAVE_STRING_ARCH_index 1
-# define index(s, c) \
- (__extension__ (__builtin_constant_p (c) \
- ? __strchr_c ((s), ((c) & 0xff) << 8) \
- : __strchr_g ((s), (c))))
-#endif
-
-
-/* Find the last occurrence of C in S. */
-#define _HAVE_STRING_ARCH_strrchr 1
-#define strrchr(s, c) \
- (__extension__ (__builtin_constant_p (c) \
- ? __strrchr_c ((s), ((c) & 0xff) << 8) \
- : __strrchr_g ((s), (c))))
-
-#ifdef __i686__
-__STRING_INLINE char *__strrchr_c (const char *__s, int __c);
-
-__STRING_INLINE char *
-__strrchr_c (const char *__s, int __c)
-{
- register unsigned long int __d0, __d1;
- register char *__res;
- __asm__ __volatile__
- ("cld\n"
- "1:\n\t"
- "lodsb\n\t"
- "cmpb %h2,%b2\n\t"
- "cmove %1,%0\n\t"
- "testb %b2,%b2\n\t"
- "jne 1b"
- : "=d" (__res), "=&S" (__d0), "=&a" (__d1)
- : "0" (1), "1" (__s), "2" (__c),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s)
- : "cc");
- return __res - 1;
-}
-
-__STRING_INLINE char *__strrchr_g (const char *__s, int __c);
-
-__STRING_INLINE char *
-__strrchr_g (const char *__s, int __c)
-{
- register unsigned long int __d0, __d1;
- register char *__res;
- __asm__ __volatile__
- ("movb %b2,%h2\n"
- "cld\n\t"
- "1:\n\t"
- "lodsb\n\t"
- "cmpb %h2,%b2\n\t"
- "cmove %1,%0\n\t"
- "testb %b2,%b2\n\t"
- "jne 1b"
- : "=d" (__res), "=&S" (__d0), "=&a" (__d1)
- : "0" (1), "1" (__s), "2" (__c),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s)
- : "cc");
- return __res - 1;
-}
-#else
-__STRING_INLINE char *__strrchr_c (const char *__s, int __c);
-
-__STRING_INLINE char *
-__strrchr_c (const char *__s, int __c)
-{
- register unsigned long int __d0, __d1;
- register char *__res;
- __asm__ __volatile__
- ("cld\n"
- "1:\n\t"
- "lodsb\n\t"
- "cmpb %%ah,%%al\n\t"
- "jne 2f\n\t"
- "leal -1(%%esi),%0\n"
- "2:\n\t"
- "testb %%al,%%al\n\t"
- "jne 1b"
- : "=d" (__res), "=&S" (__d0), "=&a" (__d1)
- : "0" (0), "1" (__s), "2" (__c),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s)
- : "cc");
- return __res;
-}
-
-__STRING_INLINE char *__strrchr_g (const char *__s, int __c);
-
-__STRING_INLINE char *
-__strrchr_g (const char *__s, int __c)
-{
- register unsigned long int __d0, __d1;
- register char *__res;
- __asm__ __volatile__
- ("movb %%al,%%ah\n"
- "cld\n\t"
- "1:\n\t"
- "lodsb\n\t"
- "cmpb %%ah,%%al\n\t"
- "jne 2f\n\t"
- "leal -1(%%esi),%0\n"
- "2:\n\t"
- "testb %%al,%%al\n\t"
- "jne 1b"
- : "=r" (__res), "=&S" (__d0), "=&a" (__d1)
- : "0" (0), "1" (__s), "2" (__c),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s)
- : "cc");
- return __res;
-}
-#endif
-
-
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
-/* Find the last occurrence of C in S. This is the BSD name. */
-# define _HAVE_STRING_ARCH_rindex 1
-# define rindex(s, c) \
- (__extension__ (__builtin_constant_p (c) \
- ? __strrchr_c ((s), ((c) & 0xff) << 8) \
- : __strrchr_g ((s), (c))))
-#endif
-
-
-/* Return the length of the initial segment of S which
- consists entirely of characters not in REJECT. */
-#define _HAVE_STRING_ARCH_strcspn 1
-#define strcspn(s, reject) \
- (__extension__ (__builtin_constant_p (reject) && sizeof ((reject)[0]) == 1 \
- ? ((reject)[0] == '\0' \
- ? strlen (s) \
- : ((reject)[1] == '\0' \
- ? __strcspn_c1 ((s), (((reject)[0] << 8) & 0xff00)) \
- : __strcspn_cg ((s), (reject), strlen (reject)))) \
- : __strcspn_g ((s), (reject))))
-
-__STRING_INLINE size_t __strcspn_c1 (const char *__s, int __reject);
-
-#ifndef _FORCE_INLINES
-__STRING_INLINE size_t
-__strcspn_c1 (const char *__s, int __reject)
-{
- register unsigned long int __d0;
- register char *__res;
- __asm__ __volatile__
- ("1:\n\t"
- "movb (%0),%%al\n\t"
- "leal 1(%0),%0\n\t"
- "cmpb %%ah,%%al\n\t"
- "je 2f\n\t"
- "testb %%al,%%al\n\t"
- "jne 1b\n"
- "2:"
- : "=r" (__res), "=&a" (__d0)
- : "0" (__s), "1" (__reject),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s)
- : "cc");
- return (__res - 1) - __s;
-}
-#endif
-
-__STRING_INLINE size_t __strcspn_cg (const char *__s, const char __reject[],
- size_t __reject_len);
-
-__STRING_INLINE size_t
-__strcspn_cg (const char *__s, const char __reject[], size_t __reject_len)
-{
- register unsigned long int __d0, __d1, __d2;
- register const char *__res;
- __asm__ __volatile__
- ("cld\n"
- "1:\n\t"
- "lodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 2f\n\t"
- "movl %5,%%edi\n\t"
- "movl %6,%%ecx\n\t"
- "repne; scasb\n\t"
- "jne 1b\n"
- "2:"
- : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
- : "0" (__s), "d" (__reject), "g" (__reject_len)
- : "memory", "cc");
- return (__res - 1) - __s;
-}
-
-__STRING_INLINE size_t __strcspn_g (const char *__s, const char *__reject);
-#ifdef __PIC__
-
-__STRING_INLINE size_t
-__strcspn_g (const char *__s, const char *__reject)
-{
- register unsigned long int __d0, __d1, __d2;
- register const char *__res;
- __asm__ __volatile__
- ("pushl %%ebx\n\t"
- "movl %4,%%edi\n\t"
- "cld\n\t"
- "repne; scasb\n\t"
- "notl %%ecx\n\t"
- "leal -1(%%ecx),%%ebx\n"
- "1:\n\t"
- "lodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 2f\n\t"
- "movl %4,%%edi\n\t"
- "movl %%ebx,%%ecx\n\t"
- "repne; scasb\n\t"
- "jne 1b\n"
- "2:\n\t"
- "popl %%ebx"
- : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
- : "r" (__reject), "0" (__s), "1" (0), "2" (0xffffffff)
- : "memory", "cc");
- return (__res - 1) - __s;
-}
-#else
-__STRING_INLINE size_t
-__strcspn_g (const char *__s, const char *__reject)
-{
- register unsigned long int __d0, __d1, __d2, __d3;
- register const char *__res;
- __asm__ __volatile__
- ("cld\n\t"
- "repne; scasb\n\t"
- "notl %%ecx\n\t"
- "leal -1(%%ecx),%%edx\n"
- "1:\n\t"
- "lodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 2f\n\t"
- "movl %%ebx,%%edi\n\t"
- "movl %%edx,%%ecx\n\t"
- "repne; scasb\n\t"
- "jne 1b\n"
- "2:"
- : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2), "=&d" (__d3)
- : "0" (__s), "1" (0), "2" (0xffffffff), "3" (__reject), "b" (__reject)
- /* Clobber memory, otherwise GCC cannot handle this. */
- : "memory", "cc");
- return (__res - 1) - __s;
-}
-#endif
-
-
-/* Return the length of the initial segment of S which
- consists entirely of characters in ACCEPT. */
-#define _HAVE_STRING_ARCH_strspn 1
-#define strspn(s, accept) \
- (__extension__ (__builtin_constant_p (accept) && sizeof ((accept)[0]) == 1 \
- ? ((accept)[0] == '\0' \
- ? ((void) (s), 0) \
- : ((accept)[1] == '\0' \
- ? __strspn_c1 ((s), (((accept)[0] << 8 ) & 0xff00)) \
- : __strspn_cg ((s), (accept), strlen (accept)))) \
- : __strspn_g ((s), (accept))))
-
-#ifndef _FORCE_INLINES
-__STRING_INLINE size_t __strspn_c1 (const char *__s, int __accept);
-
-__STRING_INLINE size_t
-__strspn_c1 (const char *__s, int __accept)
-{
- register unsigned long int __d0;
- register char *__res;
- /* Please note that __accept never can be '\0'. */
- __asm__ __volatile__
- ("1:\n\t"
- "movb (%0),%b1\n\t"
- "leal 1(%0),%0\n\t"
- "cmpb %h1,%b1\n\t"
- "je 1b"
- : "=r" (__res), "=&q" (__d0)
- : "0" (__s), "1" (__accept),
- "m" ( *(struct { char __x[0xfffffff]; } *)__s)
- : "cc");
- return (__res - 1) - __s;
-}
-#endif
-
-__STRING_INLINE size_t __strspn_cg (const char *__s, const char __accept[],
- size_t __accept_len);
-
-__STRING_INLINE size_t
-__strspn_cg (const char *__s, const char __accept[], size_t __accept_len)
-{
- register unsigned long int __d0, __d1, __d2;
- register const char *__res;
- __asm__ __volatile__
- ("cld\n"
- "1:\n\t"
- "lodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 2f\n\t"
- "movl %5,%%edi\n\t"
- "movl %6,%%ecx\n\t"
- "repne; scasb\n\t"
- "je 1b\n"
- "2:"
- : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
- : "0" (__s), "g" (__accept), "g" (__accept_len),
- /* Since we do not know how large the memory we access it, use a
- really large amount. */
- "m" ( *(struct { char __x[0xfffffff]; } *)__s),
- "m" ( *(struct { __extension__ char __x[__accept_len]; } *)__accept)
- : "cc");
- return (__res - 1) - __s;
-}
-
-__STRING_INLINE size_t __strspn_g (const char *__s, const char *__accept);
-#ifdef __PIC__
-
-__STRING_INLINE size_t
-__strspn_g (const char *__s, const char *__accept)
-{
- register unsigned long int __d0, __d1, __d2;
- register const char *__res;
- __asm__ __volatile__
- ("pushl %%ebx\n\t"
- "cld\n\t"
- "repne; scasb\n\t"
- "notl %%ecx\n\t"
- "leal -1(%%ecx),%%ebx\n"
- "1:\n\t"
- "lodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 2f\n\t"
- "movl %%edx,%%edi\n\t"
- "movl %%ebx,%%ecx\n\t"
- "repne; scasb\n\t"
- "je 1b\n"
- "2:\n\t"
- "popl %%ebx"
- : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
- : "d" (__accept), "0" (__s), "1" (0), "2" (0xffffffff), "3" (__accept)
- : "memory", "cc");
- return (__res - 1) - __s;
-}
-#else
-__STRING_INLINE size_t
-__strspn_g (const char *__s, const char *__accept)
-{
- register unsigned long int __d0, __d1, __d2, __d3;
- register const char *__res;
- __asm__ __volatile__
- ("cld\n\t"
- "repne; scasb\n\t"
- "notl %%ecx\n\t"
- "leal -1(%%ecx),%%edx\n"
- "1:\n\t"
- "lodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 2f\n\t"
- "movl %%ebx,%%edi\n\t"
- "movl %%edx,%%ecx\n\t"
- "repne; scasb\n\t"
- "je 1b\n"
- "2:"
- : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2), "=&d" (__d3)
- : "0" (__s), "1" (0), "2" (0xffffffff), "3" (__accept), "b" (__accept)
- : "memory", "cc");
- return (__res - 1) - __s;
-}
-#endif
-
-
-/* Find the first occurrence in S of any character in ACCEPT. */
-#define _HAVE_STRING_ARCH_strpbrk 1
-#define strpbrk(s, accept) \
- (__extension__ (__builtin_constant_p (accept) && sizeof ((accept)[0]) == 1 \
- ? ((accept)[0] == '\0' \
- ? ((void) (s), (char *) 0) \
- : ((accept)[1] == '\0' \
- ? strchr ((s), (accept)[0]) \
- : __strpbrk_cg ((s), (accept), strlen (accept)))) \
- : __strpbrk_g ((s), (accept))))
-
-__STRING_INLINE char *__strpbrk_cg (const char *__s, const char __accept[],
- size_t __accept_len);
-
-__STRING_INLINE char *
-__strpbrk_cg (const char *__s, const char __accept[], size_t __accept_len)
-{
- register unsigned long int __d0, __d1, __d2;
- register char *__res;
- __asm__ __volatile__
- ("cld\n"
- "1:\n\t"
- "lodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 2f\n\t"
- "movl %5,%%edi\n\t"
- "movl %6,%%ecx\n\t"
- "repne; scasb\n\t"
- "jne 1b\n\t"
- "decl %0\n\t"
- "jmp 3f\n"
- "2:\n\t"
- "xorl %0,%0\n"
- "3:"
- : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
- : "0" (__s), "d" (__accept), "g" (__accept_len)
- : "memory", "cc");
- return __res;
-}
-
-__STRING_INLINE char *__strpbrk_g (const char *__s, const char *__accept);
-#ifdef __PIC__
-
-__STRING_INLINE char *
-__strpbrk_g (const char *__s, const char *__accept)
-{
- register unsigned long int __d0, __d1, __d2;
- register char *__res;
- __asm__ __volatile__
- ("pushl %%ebx\n\t"
- "movl %%edx,%%edi\n\t"
- "cld\n\t"
- "repne; scasb\n\t"
- "notl %%ecx\n\t"
- "leal -1(%%ecx),%%ebx\n"
- "1:\n\t"
- "lodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 2f\n\t"
- "movl %%edx,%%edi\n\t"
- "movl %%ebx,%%ecx\n\t"
- "repne; scasb\n\t"
- "jne 1b\n\t"
- "decl %0\n\t"
- "jmp 3f\n"
- "2:\n\t"
- "xorl %0,%0\n"
- "3:\n\t"
- "popl %%ebx"
- : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
- : "d" (__accept), "0" (__s), "1" (0), "2" (0xffffffff)
- : "memory", "cc");
- return __res;
-}
-#else
-__STRING_INLINE char *
-__strpbrk_g (const char *__s, const char *__accept)
-{
- register unsigned long int __d0, __d1, __d2, __d3;
- register char *__res;
- __asm__ __volatile__
- ("movl %%ebx,%%edi\n\t"
- "cld\n\t"
- "repne; scasb\n\t"
- "notl %%ecx\n\t"
- "leal -1(%%ecx),%%edx\n"
- "1:\n\t"
- "lodsb\n\t"
- "testb %%al,%%al\n\t"
- "je 2f\n\t"
- "movl %%ebx,%%edi\n\t"
- "movl %%edx,%%ecx\n\t"
- "repne; scasb\n\t"
- "jne 1b\n\t"
- "decl %0\n\t"
- "jmp 3f\n"
- "2:\n\t"
- "xorl %0,%0\n"
- "3:"
- : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3)
- : "0" (__s), "1" (0), "2" (0xffffffff), "b" (__accept)
- : "memory", "cc");
- return __res;
-}
-#endif
-
-
-/* Find the first occurrence of NEEDLE in HAYSTACK. */
-#define _HAVE_STRING_ARCH_strstr 1
-#define strstr(haystack, needle) \
- (__extension__ (__builtin_constant_p (needle) && sizeof ((needle)[0]) == 1 \
- ? ((needle)[0] == '\0' \
- ? (haystack) \
- : ((needle)[1] == '\0' \
- ? strchr ((haystack), (needle)[0]) \
- : __strstr_cg ((haystack), (needle), \
- strlen (needle)))) \
- : __strstr_g ((haystack), (needle))))
-
-/* Please note that this function need not handle NEEDLEs with a
- length shorter than two. */
-__STRING_INLINE char *__strstr_cg (const char *__haystack,
- const char __needle[],
- size_t __needle_len);
-
-__STRING_INLINE char *
-__strstr_cg (const char *__haystack, const char __needle[],
- size_t __needle_len)
-{
- register unsigned long int __d0, __d1, __d2;
- register char *__res;
- __asm__ __volatile__
- ("cld\n" \
- "1:\n\t"
- "movl %6,%%edi\n\t"
- "movl %5,%%eax\n\t"
- "movl %4,%%ecx\n\t"
- "repe; cmpsb\n\t"
- "je 2f\n\t"
- "cmpb $0,-1(%%esi)\n\t"
- "leal 1(%%eax),%5\n\t"
- "jne 1b\n\t"
- "xorl %%eax,%%eax\n"
- "2:"
- : "=&a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2)
- : "g" (__needle_len), "1" (__haystack), "d" (__needle)
- : "memory", "cc");
- return __res;
-}
-
-__STRING_INLINE char *__strstr_g (const char *__haystack,
- const char *__needle);
-#ifdef __PIC__
-
-__STRING_INLINE char *
-__strstr_g (const char *__haystack, const char *__needle)
-{
- register unsigned long int __d0, __d1, __d2;
- register char *__res;
- __asm__ __volatile__
- ("cld\n\t"
- "repne; scasb\n\t"
- "notl %%ecx\n\t"
- "pushl %%ebx\n\t"
- "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
- "movl %%ecx,%%ebx\n"
- "1:\n\t"
- "movl %%edx,%%edi\n\t"
- "movl %%esi,%%eax\n\t"
- "movl %%ebx,%%ecx\n\t"
- "repe; cmpsb\n\t"
- "je 2f\n\t" /* also works for empty string, see above */
- "cmpb $0,-1(%%esi)\n\t"
- "leal 1(%%eax),%%esi\n\t"
- "jne 1b\n\t"
- "xorl %%eax,%%eax\n"
- "2:\n\t"
- "popl %%ebx"
- : "=&a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
- : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (__needle),
- "d" (__needle)
- : "memory", "cc");
- return __res;
-}
-#else
-__STRING_INLINE char *
-__strstr_g (const char *__haystack, const char *__needle)
-{
- register unsigned long int __d0, __d1, __d2, __d3;
- register char *__res;
- __asm__ __volatile__
- ("cld\n\t"
- "repne; scasb\n\t"
- "notl %%ecx\n\t"
- "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
- "movl %%ecx,%%edx\n"
- "1:\n\t"
- "movl %%ebx,%%edi\n\t"
- "movl %%esi,%%eax\n\t"
- "movl %%edx,%%ecx\n\t"
- "repe; cmpsb\n\t"
- "je 2f\n\t" /* also works for empty string, see above */
- "cmpb $0,-1(%%esi)\n\t"
- "leal 1(%%eax),%%esi\n\t"
- "jne 1b\n\t"
- "xorl %%eax,%%eax\n"
- "2:"
- : "=&a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2), "=&d" (__d3)
- : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (__needle),
- "b" (__needle)
- : "memory", "cc");
- return __res;
-}
-#endif
-
-
-/* Bit find functions. We define only the i686 version since for the other
- processors gcc generates good code. */
-#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
-# ifdef __i686__
-# define _HAVE_STRING_ARCH_ffs 1
-# define ffs(word) (__builtin_constant_p (word) \
- ? __builtin_ffs (word) \
- : ({ int __cnt, __tmp; \
- __asm__ __volatile__ \
- ("bsfl %2,%0\n\t" \
- "cmovel %1,%0" \
- : "=&r" (__cnt), "=r" (__tmp) \
- : "rm" (word), "1" (-1)); \
- __cnt + 1; }))
-
-# ifndef ffsl
-# define ffsl(word) ffs(word)
-# endif
-# endif /* i686 */
-#endif /* BSD || X/Open */
-
-#ifndef _FORCE_INLINES
-# undef __STRING_INLINE
-#endif
-
-#endif /* use string inlines && GNU CC */
diff --git a/sysdeps/x86/bits/string.h b/sysdeps/x86/bits/string.h
index 0ca5fe2..e7ee1cc 100644
--- a/sysdeps/x86/bits/string.h
+++ b/sysdeps/x86/bits/string.h
@@ -1,5 +1,5 @@
-/* Optimized, inlined string functions. AMD x86-64 version.
- Copyright (C) 2001 Free Software Foundation, Inc.
+/* Optimized, inlined string functions. i486/x86-64 version.
+ Copyright (C) 2001-2012 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
@@ -23,3 +23,1962 @@
/* Currently the only purpose of this file is to tell the generic inline
macros that unaligned memory access is possible for x86-64. */
#define _STRING_ARCH_unaligned 1
+
+#if !defined __x86_64__ && (defined __i486__ || defined __pentium__ \
+ || defined __pentiumpro__ || defined __pentium4__ \
+ || defined __nocona__ || defined __atom__ \
+ || defined __core2__ || defined __corei7__ \
+ || defined __k6__ || defined __geode__ \
+ || defined __k8__ || defined __athlon__ \
+ || defined __amdfam10__)
+
+/* We only provide optimizations if the user selects them and if
+ GNU CC is used. */
+# if !defined __NO_STRING_INLINES && defined __USE_STRING_INLINES \
+ && defined __GNUC__ && __GNUC__ >= 2 && !__BOUNDED_POINTERS__
+
+# ifndef __STRING_INLINE
+# ifndef __extern_inline
+# define __STRING_INLINE inline
+# else
+# define __STRING_INLINE __extern_inline
+# endif
+# endif
+
+/* The macros are used in some of the optimized implementations below. */
+# define __STRING_SMALL_GET16(src, idx) \
+ ((((const unsigned char *) (src))[idx + 1] << 8) \
+ | ((const unsigned char *) (src))[idx])
+# define __STRING_SMALL_GET32(src, idx) \
+ (((((const unsigned char *) (src))[idx + 3] << 8 \
+ | ((const unsigned char *) (src))[idx + 2]) << 8 \
+ | ((const unsigned char *) (src))[idx + 1]) << 8 \
+ | ((const unsigned char *) (src))[idx])
+
+
+/* Copy N bytes of SRC to DEST. */
+# define _HAVE_STRING_ARCH_memcpy 1
+# define memcpy(dest, src, n) \
+ (__extension__ (__builtin_constant_p (n) \
+ ? __memcpy_c ((dest), (src), (n)) \
+ : __memcpy_g ((dest), (src), (n))))
+# define __memcpy_c(dest, src, n) \
+ ((n) == 0 \
+ ? (dest) \
+ : (((n) % 4 == 0) \
+ ? __memcpy_by4 (dest, src, n) \
+ : (((n) % 2 == 0) \
+ ? __memcpy_by2 (dest, src, n) \
+ : __memcpy_g (dest, src, n))))
+
+__STRING_INLINE void *__memcpy_by4 (void *__dest, const void *__src,
+ size_t __n);
+
+__STRING_INLINE void *
+__memcpy_by4 (void *__dest, const void *__src, size_t __n)
+{
+ register unsigned long int __d0, __d1;
+ register void *__tmp = __dest;
+ __asm__ __volatile__
+ ("1:\n\t"
+ "movl (%2),%0\n\t"
+ "leal 4(%2),%2\n\t"
+ "movl %0,(%1)\n\t"
+ "leal 4(%1),%1\n\t"
+ "decl %3\n\t"
+ "jnz 1b"
+ : "=&r" (__d0), "=&r" (__tmp), "=&r" (__src), "=&r" (__d1)
+ : "1" (__tmp), "2" (__src), "3" (__n / 4)
+ : "memory", "cc");
+ return __dest;
+}
+
+__STRING_INLINE void *__memcpy_by2 (void *__dest, const void *__src,
+ size_t __n);
+
+__STRING_INLINE void *
+__memcpy_by2 (void *__dest, const void *__src, size_t __n)
+{
+ register unsigned long int __d0, __d1;
+ register void *__tmp = __dest;
+ __asm__ __volatile__
+ ("shrl $1,%3\n\t"
+ "jz 2f\n" /* only a word */
+ "1:\n\t"
+ "movl (%2),%0\n\t"
+ "leal 4(%2),%2\n\t"
+ "movl %0,(%1)\n\t"
+ "leal 4(%1),%1\n\t"
+ "decl %3\n\t"
+ "jnz 1b\n"
+ "2:\n\t"
+ "movw (%2),%w0\n\t"
+ "movw %w0,(%1)"
+ : "=&q" (__d0), "=&r" (__tmp), "=&r" (__src), "=&r" (__d1)
+ : "1" (__tmp), "2" (__src), "3" (__n / 2)
+ : "memory", "cc");
+ return __dest;
+}
+
+__STRING_INLINE void *__memcpy_g (void *__dest, const void *__src, size_t __n);
+
+__STRING_INLINE void *
+__memcpy_g (void *__dest, const void *__src, size_t __n)
+{
+ register unsigned long int __d0, __d1, __d2;
+ register void *__tmp = __dest;
+ __asm__ __volatile__
+ ("cld\n\t"
+ "shrl $1,%%ecx\n\t"
+ "jnc 1f\n\t"
+ "movsb\n"
+ "1:\n\t"
+ "shrl $1,%%ecx\n\t"
+ "jnc 2f\n\t"
+ "movsw\n"
+ "2:\n\t"
+ "rep; movsl"
+ : "=&c" (__d0), "=&D" (__d1), "=&S" (__d2),
+ "=m" ( *(struct { __extension__ char __x[__n]; } *)__dest)
+ : "0" (__n), "1" (__tmp), "2" (__src),
+ "m" ( *(struct { __extension__ char __x[__n]; } *)__src)
+ : "cc");
+ return __dest;
+}
+
+# define _HAVE_STRING_ARCH_memmove 1
+# ifndef _FORCE_INLINES
+/* Copy N bytes of SRC to DEST, guaranteeing
+ correct behavior for overlapping strings. */
+# define memmove(dest, src, n) __memmove_g (dest, src, n)
+
+__STRING_INLINE void *__memmove_g (void *, const void *, size_t)
+ __asm__ ("memmove");
+
+__STRING_INLINE void *
+__memmove_g (void *__dest, const void *__src, size_t __n)
+{
+ register unsigned long int __d0, __d1, __d2;
+ register void *__tmp = __dest;
+ if (__dest < __src)
+ __asm__ __volatile__
+ ("cld\n\t"
+ "rep; movsb"
+ : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2),
+ "=m" ( *(struct { __extension__ char __x[__n]; } *)__dest)
+ : "0" (__n), "1" (__src), "2" (__tmp),
+ "m" ( *(struct { __extension__ char __x[__n]; } *)__src));
+ else
+ __asm__ __volatile__
+ ("std\n\t"
+ "rep; movsb\n\t"
+ "cld"
+ : "=&c" (__d0), "=&S" (__d1), "=&D" (__d2),
+ "=m" ( *(struct { __extension__ char __x[__n]; } *)__dest)
+ : "0" (__n), "1" (__n - 1 + (const char *) __src),
+ "2" (__n - 1 + (char *) __tmp),
+ "m" ( *(struct { __extension__ char __x[__n]; } *)__src));
+ return __dest;
+}
+# endif
+
+/* Compare N bytes of S1 and S2. */
+# define _HAVE_STRING_ARCH_memcmp 1
+# ifndef _FORCE_INLINES
+# ifndef __PIC__
+/* gcc has problems to spill registers when using PIC. */
+__STRING_INLINE int
+memcmp (const void *__s1, const void *__s2, size_t __n)
+{
+ register unsigned long int __d0, __d1, __d2;
+ register int __res;
+ __asm__ __volatile__
+ ("cld\n\t"
+ "testl %3,%3\n\t"
+ "repe; cmpsb\n\t"
+ "je 1f\n\t"
+ "sbbl %0,%0\n\t"
+ "orl $1,%0\n"
+ "1:"
+ : "=&a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2)
+ : "0" (0), "1" (__s1), "2" (__s2), "3" (__n),
+ "m" ( *(struct { __extension__ char __x[__n]; } *)__s1),
+ "m" ( *(struct { __extension__ char __x[__n]; } *)__s2)
+ : "cc");
+ return __res;
+}
+# endif
+# endif
+
+/* Set N bytes of S to C. */
+# define _HAVE_STRING_ARCH_memset 1
+# define _USE_STRING_ARCH_memset 1
+# define memset(s, c, n) \
+ (__extension__ (__builtin_constant_p (n) && (n) <= 16 \
+ ? ((n) == 1 \
+ ? __memset_c1 ((s), (c)) \
+ : __memset_gc ((s), (c), (n))) \
+ : (__builtin_constant_p (c) \
+ ? (__builtin_constant_p (n) \
+ ? __memset_ccn ((s), (c), (n)) \
+ : memset ((s), (c), (n))) \
+ : (__builtin_constant_p (n) \
+ ? __memset_gcn ((s), (c), (n)) \
+ : memset ((s), (c), (n))))))
+
+# define __memset_c1(s, c) ({ void *__s = (s); \
+ *((unsigned char *) __s) = (unsigned char) (c); \
+ __s; })
+
+# define __memset_gc(s, c, n) \
+ ({ void *__s = (s); \
+ union { \
+ unsigned int __ui; \
+ unsigned short int __usi; \
+ unsigned char __uc; \
+ } *__u = __s; \
+ unsigned int __c = ((unsigned int) ((unsigned char) (c))) * 0x01010101; \
+ \
+ /* We apply a trick here. `gcc' would implement the following \
+ assignments using immediate operands. But this uses to much \
+ memory (7, instead of 4 bytes). So we force the value in a \
+ registers. */ \
+ if ((n) == 3 || (n) >= 5) \
+ __asm__ __volatile__ ("" : "=r" (__c) : "0" (__c)); \
+ \
+ /* This `switch' statement will be removed at compile-time. */ \
+ switch (n) \
+ { \
+ case 15: \
+ __u->__ui = __c; \
+ __u = __extension__ ((void *) __u + 4); \
+ case 11: \
+ __u->__ui = __c; \
+ __u = __extension__ ((void *) __u + 4); \
+ case 7: \
+ __u->__ui = __c; \
+ __u = __extension__ ((void *) __u + 4); \
+ case 3: \
+ __u->__usi = (unsigned short int) __c; \
+ __u = __extension__ ((void *) __u + 2); \
+ __u->__uc = (unsigned char) __c; \
+ break; \
+ \
+ case 14: \
+ __u->__ui = __c; \
+ __u = __extension__ ((void *) __u + 4); \
+ case 10: \
+ __u->__ui = __c; \
+ __u = __extension__ ((void *) __u + 4); \
+ case 6: \
+ __u->__ui = __c; \
+ __u = __extension__ ((void *) __u + 4); \
+ case 2: \
+ __u->__usi = (unsigned short int) __c; \
+ break; \
+ \
+ case 13: \
+ __u->__ui = __c; \
+ __u = __extension__ ((void *) __u + 4); \
+ case 9: \
+ __u->__ui = __c; \
+ __u = __extension__ ((void *) __u + 4); \
+ case 5: \
+ __u->__ui = __c; \
+ __u = __extension__ ((void *) __u + 4); \
+ case 1: \
+ __u->__uc = (unsigned char) __c; \
+ break; \
+ \
+ case 16: \
+ __u->__ui = __c; \
+ __u = __extension__ ((void *) __u + 4); \
+ case 12: \
+ __u->__ui = __c; \
+ __u = __extension__ ((void *) __u + 4); \
+ case 8: \
+ __u->__ui = __c; \
+ __u = __extension__ ((void *) __u + 4); \
+ case 4: \
+ __u->__ui = __c; \
+ case 0: \
+ break; \
+ } \
+ \
+ __s; })
+
+# define __memset_ccn(s, c, n) \
+ (((n) % 4 == 0) \
+ ? __memset_ccn_by4 (s, ((unsigned int) ((unsigned char) (c))) * 0x01010101,\
+ n) \
+ : (((n) % 2 == 0) \
+ ? __memset_ccn_by2 (s, \
+ ((unsigned int) ((unsigned char) (c))) * 0x01010101,\
+ n) \
+ : memset (s, c, n)))
+
+__STRING_INLINE void *__memset_ccn_by4 (void *__s, unsigned int __c,
+ size_t __n);
+
+__STRING_INLINE void *
+__memset_ccn_by4 (void *__s, unsigned int __c, size_t __n)
+{
+ register void *__tmp = __s;
+ register unsigned long int __d0;
+# ifdef __i686__
+ __asm__ __volatile__
+ ("cld\n\t"
+ "rep; stosl"
+ : "=&a" (__c), "=&D" (__tmp), "=&c" (__d0),
+ "=m" ( *(struct { __extension__ char __x[__n]; } *)__s)
+ : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
+ : "cc");
+# else
+ __asm__ __volatile__
+ ("1:\n\t"
+ "movl %0,(%1)\n\t"
+ "addl $4,%1\n\t"
+ "decl %2\n\t"
+ "jnz 1b\n"
+ : "=&r" (__c), "=&r" (__tmp), "=&r" (__d0),
+ "=m" ( *(struct { __extension__ char __x[__n]; } *)__s)
+ : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
+ : "cc");
+# endif
+ return __s;
+}
+
+__STRING_INLINE void *__memset_ccn_by2 (void *__s, unsigned int __c,
+ size_t __n);
+
+__STRING_INLINE void *
+__memset_ccn_by2 (void *__s, unsigned int __c, size_t __n)
+{
+ register unsigned long int __d0, __d1;
+ register void *__tmp = __s;
+# ifdef __i686__
+ __asm__ __volatile__
+ ("cld\n\t"
+ "rep; stosl\n"
+ "stosw"
+ : "=&a" (__d0), "=&D" (__tmp), "=&c" (__d1),
+ "=m" ( *(struct { __extension__ char __x[__n]; } *)__s)
+ : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
+ : "cc");
+# else
+ __asm__ __volatile__
+ ("1:\tmovl %0,(%1)\n\t"
+ "leal 4(%1),%1\n\t"
+ "decl %2\n\t"
+ "jnz 1b\n"
+ "movw %w0,(%1)"
+ : "=&q" (__d0), "=&r" (__tmp), "=&r" (__d1),
+ "=m" ( *(struct { __extension__ char __x[__n]; } *)__s)
+ : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
+ : "cc");
+#endif
+ return __s;
+}
+
+# define __memset_gcn(s, c, n) \
+ (((n) % 4 == 0) \
+ ? __memset_gcn_by4 (s, c, n) \
+ : (((n) % 2 == 0) \
+ ? __memset_gcn_by2 (s, c, n) \
+ : memset (s, c, n)))
+
+__STRING_INLINE void *__memset_gcn_by4 (void *__s, int __c, size_t __n);
+
+__STRING_INLINE void *
+__memset_gcn_by4 (void *__s, int __c, size_t __n)
+{
+ register void *__tmp = __s;
+ register unsigned long int __d0;
+ __asm__ __volatile__
+ ("movb %b0,%h0\n"
+ "pushw %w0\n\t"
+ "shll $16,%0\n\t"
+ "popw %w0\n"
+ "1:\n\t"
+ "movl %0,(%1)\n\t"
+ "addl $4,%1\n\t"
+ "decl %2\n\t"
+ "jnz 1b\n"
+ : "=&q" (__c), "=&r" (__tmp), "=&r" (__d0),
+ "=m" ( *(struct { __extension__ char __x[__n]; } *)__s)
+ : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
+ : "cc");
+ return __s;
+}
+
+__STRING_INLINE void *__memset_gcn_by2 (void *__s, int __c, size_t __n);
+
+__STRING_INLINE void *
+__memset_gcn_by2 (void *__s, int __c, size_t __n)
+{
+ register unsigned long int __d0, __d1;
+ register void *__tmp = __s;
+ __asm__ __volatile__
+ ("movb %b0,%h0\n\t"
+ "pushw %w0\n\t"
+ "shll $16,%0\n\t"
+ "popw %w0\n"
+ "1:\n\t"
+ "movl %0,(%1)\n\t"
+ "leal 4(%1),%1\n\t"
+ "decl %2\n\t"
+ "jnz 1b\n"
+ "movw %w0,(%1)"
+ : "=&q" (__d0), "=&r" (__tmp), "=&r" (__d1),
+ "=m" ( *(struct { __extension__ char __x[__n]; } *)__s)
+ : "0" ((unsigned int) __c), "1" (__tmp), "2" (__n / 4)
+ : "cc");
+ return __s;
+}
+
+
+/* Search N bytes of S for C. */
+# define _HAVE_STRING_ARCH_memchr 1
+# ifndef _FORCE_INLINES
+__STRING_INLINE void *
+memchr (const void *__s, int __c, size_t __n)
+{
+ register unsigned long int __d0;
+# ifdef __i686__
+ register unsigned long int __d1;
+# endif
+ register unsigned char *__res;
+ if (__n == 0)
+ return NULL;
+# ifdef __i686__
+ __asm__ __volatile__
+ ("cld\n\t"
+ "repne; scasb\n\t"
+ "cmovne %2,%0"
+ : "=D" (__res), "=&c" (__d0), "=&r" (__d1)
+ : "a" (__c), "0" (__s), "1" (__n), "2" (1),
+ "m" ( *(struct { __extension__ char __x[__n]; } *)__s)
+ : "cc");
+# else
+ __asm__ __volatile__
+ ("cld\n\t"
+ "repne; scasb\n\t"
+ "je 1f\n\t"
+ "movl $1,%0\n"
+ "1:"
+ : "=D" (__res), "=&c" (__d0)
+ : "a" (__c), "0" (__s), "1" (__n),
+ "m" ( *(struct { __extension__ char __x[__n]; } *)__s)
+ : "cc");
+# endif
+ return __res - 1;
+}
+# endif
+
+# define _HAVE_STRING_ARCH_memrchr 1
+# ifndef _FORCE_INLINES
+__STRING_INLINE void *__memrchr (const void *__s, int __c, size_t __n);
+
+__STRING_INLINE void *
+__memrchr (const void *__s, int __c, size_t __n)
+{
+ register unsigned long int __d0;
+# ifdef __i686__
+ register unsigned long int __d1;
+# endif
+ register void *__res;
+ if (__n == 0)
+ return NULL;
+# ifdef __i686__
+ __asm__ __volatile__
+ ("std\n\t"
+ "repne; scasb\n\t"
+ "cmovne %2,%0\n\t"
+ "cld\n\t"
+ "incl %0"
+ : "=D" (__res), "=&c" (__d0), "=&r" (__d1)
+ : "a" (__c), "0" (__s + __n - 1), "1" (__n), "2" (-1),
+ "m" ( *(struct { __extension__ char __x[__n]; } *)__s)
+ : "cc");
+# else
+ __asm__ __volatile__
+ ("std\n\t"
+ "repne; scasb\n\t"
+ "je 1f\n\t"
+ "orl $-1,%0\n"
+ "1:\tcld\n\t"
+ "incl %0"
+ : "=D" (__res), "=&c" (__d0)
+ : "a" (__c), "0" (__s + __n - 1), "1" (__n),
+ "m" ( *(struct { __extension__ char __x[__n]; } *)__s)
+ : "cc");
+# endif
+ return __res;
+}
+# ifdef __USE_GNU
+# define memrchr(s, c, n) __memrchr ((s), (c), (n))
+# endif
+# endif
+
+/* Return pointer to C in S. */
+# define _HAVE_STRING_ARCH_rawmemchr 1
+__STRING_INLINE void *__rawmemchr (const void *__s, int __c);
+
+# ifndef _FORCE_INLINES
+__STRING_INLINE void *
+__rawmemchr (const void *__s, int __c)
+{
+ register unsigned long int __d0;
+ register unsigned char *__res;
+ __asm__ __volatile__
+ ("cld\n\t"
+ "repne; scasb\n\t"
+ : "=D" (__res), "=&c" (__d0)
+ : "a" (__c), "0" (__s), "1" (0xffffffff),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s)
+ : "cc");
+ return __res - 1;
+}
+# ifdef __USE_GNU
+__STRING_INLINE void *
+rawmemchr (const void *__s, int __c)
+{
+ return __rawmemchr (__s, __c);
+}
+# endif /* use GNU */
+# endif
+
+
+/* Return the length of S. */
+# define _HAVE_STRING_ARCH_strlen 1
+# define strlen(str) \
+ (__extension__ (__builtin_constant_p (str) \
+ ? __builtin_strlen (str) \
+ : __strlen_g (str)))
+__STRING_INLINE size_t __strlen_g (const char *__str);
+
+__STRING_INLINE size_t
+__strlen_g (const char *__str)
+{
+ register char __dummy;
+ register const char *__tmp = __str;
+ __asm__ __volatile__
+ ("1:\n\t"
+ "movb (%0),%b1\n\t"
+ "leal 1(%0),%0\n\t"
+ "testb %b1,%b1\n\t"
+ "jne 1b"
+ : "=r" (__tmp), "=&q" (__dummy)
+ : "0" (__str),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__str)
+ : "cc" );
+ return __tmp - __str - 1;
+}
+
+
+/* Copy SRC to DEST. */
+# define _HAVE_STRING_ARCH_strcpy 1
+# define strcpy(dest, src) \
+ (__extension__ (__builtin_constant_p (src) \
+ ? (sizeof ((src)[0]) == 1 && strlen (src) + 1 <= 8 \
+ ? __strcpy_a_small ((dest), (src), strlen (src) + 1) \
+ : (char *) memcpy ((char *) (dest), \
+ (const char *) (src), \
+ strlen (src) + 1)) \
+ : __strcpy_g ((dest), (src))))
+
+# define __strcpy_a_small(dest, src, srclen) \
+ (__extension__ ({ char *__dest = (dest); \
+ union { \
+ unsigned int __ui; \
+ unsigned short int __usi; \
+ unsigned char __uc; \
+ char __c; \
+ } *__u = (void *) __dest; \
+ switch (srclen) \
+ { \
+ case 1: \
+ __u->__uc = '\0'; \
+ break; \
+ case 2: \
+ __u->__usi = __STRING_SMALL_GET16 (src, 0); \
+ break; \
+ case 3: \
+ __u->__usi = __STRING_SMALL_GET16 (src, 0); \
+ __u = __extension__ ((void *) __u + 2); \
+ __u->__uc = '\0'; \
+ break; \
+ case 4: \
+ __u->__ui = __STRING_SMALL_GET32 (src, 0); \
+ break; \
+ case 5: \
+ __u->__ui = __STRING_SMALL_GET32 (src, 0); \
+ __u = __extension__ ((void *) __u + 4); \
+ __u->__uc = '\0'; \
+ break; \
+ case 6: \
+ __u->__ui = __STRING_SMALL_GET32 (src, 0); \
+ __u = __extension__ ((void *) __u + 4); \
+ __u->__usi = __STRING_SMALL_GET16 (src, 4); \
+ break; \
+ case 7: \
+ __u->__ui = __STRING_SMALL_GET32 (src, 0); \
+ __u = __extension__ ((void *) __u + 4); \
+ __u->__usi = __STRING_SMALL_GET16 (src, 4); \
+ __u = __extension__ ((void *) __u + 2); \
+ __u->__uc = '\0'; \
+ break; \
+ case 8: \
+ __u->__ui = __STRING_SMALL_GET32 (src, 0); \
+ __u = __extension__ ((void *) __u + 4); \
+ __u->__ui = __STRING_SMALL_GET32 (src, 4); \
+ break; \
+ } \
+ (char *) __dest; }))
+
+__STRING_INLINE char *__strcpy_g (char *__dest, const char *__src);
+
+__STRING_INLINE char *
+__strcpy_g (char *__dest, const char *__src)
+{
+ register char *__tmp = __dest;
+ register char __dummy;
+ __asm__ __volatile__
+ (
+ "1:\n\t"
+ "movb (%0),%b2\n\t"
+ "leal 1(%0),%0\n\t"
+ "movb %b2,(%1)\n\t"
+ "leal 1(%1),%1\n\t"
+ "testb %b2,%b2\n\t"
+ "jne 1b"
+ : "=&r" (__src), "=&r" (__tmp), "=&q" (__dummy),
+ "=m" ( *(struct { char __x[0xfffffff]; } *)__dest)
+ : "0" (__src), "1" (__tmp),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__src)
+ : "cc");
+ return __dest;
+}
+
+
+# ifdef __USE_GNU
+# define _HAVE_STRING_ARCH_stpcpy 1
+/* Copy SRC to DEST. */
+# define __stpcpy(dest, src) \
+ (__extension__ (__builtin_constant_p (src) \
+ ? (strlen (src) + 1 <= 8 \
+ ? __stpcpy_a_small ((dest), (src), strlen (src) + 1) \
+ : __stpcpy_c ((dest), (src), strlen (src) + 1)) \
+ : __stpcpy_g ((dest), (src))))
+# define __stpcpy_c(dest, src, srclen) \
+ ((srclen) % 4 == 0 \
+ ? __mempcpy_by4 (dest, src, srclen) - 1 \
+ : ((srclen) % 2 == 0 \
+ ? __mempcpy_by2 (dest, src, srclen) - 1 \
+ : __mempcpy_byn (dest, src, srclen) - 1))
+
+/* In glibc itself we use this symbol for namespace reasons. */
+# define stpcpy(dest, src) __stpcpy ((dest), (src))
+
+# define __stpcpy_a_small(dest, src, srclen) \
+ (__extension__ ({ union { \
+ unsigned int __ui; \
+ unsigned short int __usi; \
+ unsigned char __uc; \
+ char __c; \
+ } *__u = (void *) (dest); \
+ switch (srclen) \
+ { \
+ case 1: \
+ __u->__uc = '\0'; \
+ break; \
+ case 2: \
+ __u->__usi = __STRING_SMALL_GET16 (src, 0); \
+ __u = __extension__ ((void *) __u + 1); \
+ break; \
+ case 3: \
+ __u->__usi = __STRING_SMALL_GET16 (src, 0); \
+ __u = __extension__ ((void *) __u + 2); \
+ __u->__uc = '\0'; \
+ break; \
+ case 4: \
+ __u->__ui = __STRING_SMALL_GET32 (src, 0); \
+ __u = __extension__ ((void *) __u + 3); \
+ break; \
+ case 5: \
+ __u->__ui = __STRING_SMALL_GET32 (src, 0); \
+ __u = __extension__ ((void *) __u + 4); \
+ __u->__uc = '\0'; \
+ break; \
+ case 6: \
+ __u->__ui = __STRING_SMALL_GET32 (src, 0); \
+ __u = __extension__ ((void *) __u + 4); \
+ __u->__usi = __STRING_SMALL_GET16 (src, 4); \
+ __u = __extension__ ((void *) __u + 1); \
+ break; \
+ case 7: \
+ __u->__ui = __STRING_SMALL_GET32 (src, 0); \
+ __u = __extension__ ((void *) __u + 4); \
+ __u->__usi = __STRING_SMALL_GET16 (src, 4); \
+ __u = __extension__ ((void *) __u + 2); \
+ __u->__uc = '\0'; \
+ break; \
+ case 8: \
+ __u->__ui = __STRING_SMALL_GET32 (src, 0); \
+ __u = __extension__ ((void *) __u + 4); \
+ __u->__ui = __STRING_SMALL_GET32 (src, 4); \
+ __u = __extension__ ((void *) __u + 3); \
+ break; \
+ } \
+ (char *) __u; }))
+
+__STRING_INLINE char *__mempcpy_by4 (char *__dest, const char *__src,
+ size_t __srclen);
+
+__STRING_INLINE char *
+__mempcpy_by4 (char *__dest, const char *__src, size_t __srclen)
+{
+ register char *__tmp = __dest;
+ register unsigned long int __d0, __d1;
+ __asm__ __volatile__
+ ("1:\n\t"
+ "movl (%2),%0\n\t"
+ "leal 4(%2),%2\n\t"
+ "movl %0,(%1)\n\t"
+ "leal 4(%1),%1\n\t"
+ "decl %3\n\t"
+ "jnz 1b"
+ : "=&r" (__d0), "=r" (__tmp), "=&r" (__src), "=&r" (__d1)
+ : "1" (__tmp), "2" (__src), "3" (__srclen / 4)
+ : "memory", "cc");
+ return __tmp;
+}
+
+__STRING_INLINE char *__mempcpy_by2 (char *__dest, const char *__src,
+ size_t __srclen);
+
+__STRING_INLINE char *
+__mempcpy_by2 (char *__dest, const char *__src, size_t __srclen)
+{
+ register char *__tmp = __dest;
+ register unsigned long int __d0, __d1;
+ __asm__ __volatile__
+ ("shrl $1,%3\n\t"
+ "jz 2f\n" /* only a word */
+ "1:\n\t"
+ "movl (%2),%0\n\t"
+ "leal 4(%2),%2\n\t"
+ "movl %0,(%1)\n\t"
+ "leal 4(%1),%1\n\t"
+ "decl %3\n\t"
+ "jnz 1b\n"
+ "2:\n\t"
+ "movw (%2),%w0\n\t"
+ "movw %w0,(%1)"
+ : "=&q" (__d0), "=r" (__tmp), "=&r" (__src), "=&r" (__d1),
+ "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest)
+ : "1" (__tmp), "2" (__src), "3" (__srclen / 2),
+ "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
+ : "cc");
+ return __tmp + 2;
+}
+
+__STRING_INLINE char *__mempcpy_byn (char *__dest, const char *__src,
+ size_t __srclen);
+
+__STRING_INLINE char *
+__mempcpy_byn (char *__dest, const char *__src, size_t __srclen)
+{
+ register unsigned long __d0, __d1;
+ register char *__tmp = __dest;
+ __asm__ __volatile__
+ ("cld\n\t"
+ "shrl $1,%%ecx\n\t"
+ "jnc 1f\n\t"
+ "movsb\n"
+ "1:\n\t"
+ "shrl $1,%%ecx\n\t"
+ "jnc 2f\n\t"
+ "movsw\n"
+ "2:\n\t"
+ "rep; movsl"
+ : "=D" (__tmp), "=&c" (__d0), "=&S" (__d1),
+ "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest)
+ : "0" (__tmp), "1" (__srclen), "2" (__src),
+ "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
+ : "cc");
+ return __tmp;
+}
+
+__STRING_INLINE char *__stpcpy_g (char *__dest, const char *__src);
+
+__STRING_INLINE char *
+__stpcpy_g (char *__dest, const char *__src)
+{
+ register char *__tmp = __dest;
+ register char __dummy;
+ __asm__ __volatile__
+ (
+ "1:\n\t"
+ "movb (%0),%b2\n\t"
+ "leal 1(%0),%0\n\t"
+ "movb %b2,(%1)\n\t"
+ "leal 1(%1),%1\n\t"
+ "testb %b2,%b2\n\t"
+ "jne 1b"
+ : "=&r" (__src), "=r" (__tmp), "=&q" (__dummy),
+ "=m" ( *(struct { char __x[0xfffffff]; } *)__dest)
+ : "0" (__src), "1" (__tmp),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__src)
+ : "cc");
+ return __tmp - 1;
+}
+# endif
+
+
+/* Copy no more than N characters of SRC to DEST. */
+# define _HAVE_STRING_ARCH_strncpy 1
+# define strncpy(dest, src, n) \
+ (__extension__ (__builtin_constant_p (src) \
+ ? ((strlen (src) + 1 >= ((size_t) (n)) \
+ ? (char *) memcpy ((char *) (dest), \
+ (const char *) (src), n) \
+ : __strncpy_cg ((dest), (src), strlen (src) + 1, n))) \
+ : __strncpy_gg ((dest), (src), n)))
+# define __strncpy_cg(dest, src, srclen, n) \
+ (((srclen) % 4 == 0) \
+ ? __strncpy_by4 (dest, src, srclen, n) \
+ : (((srclen) % 2 == 0) \
+ ? __strncpy_by2 (dest, src, srclen, n) \
+ : __strncpy_byn (dest, src, srclen, n)))
+
+__STRING_INLINE char *__strncpy_by4 (char *__dest, const char __src[],
+ size_t __srclen, size_t __n);
+
+__STRING_INLINE char *
+__strncpy_by4 (char *__dest, const char __src[], size_t __srclen, size_t __n)
+{
+ register char *__tmp = __dest;
+ register int __dummy1, __dummy2;
+ __asm__ __volatile__
+ ("1:\n\t"
+ "movl (%2),%0\n\t"
+ "leal 4(%2),%2\n\t"
+ "movl %0,(%1)\n\t"
+ "leal 4(%1),%1\n\t"
+ "decl %3\n\t"
+ "jnz 1b"
+ : "=&r" (__dummy1), "=r" (__tmp), "=&r" (__src), "=&r" (__dummy2),
+ "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest)
+ : "1" (__tmp), "2" (__src), "3" (__srclen / 4),
+ "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
+ : "cc");
+ (void) memset (__tmp, '\0', __n - __srclen);
+ return __dest;
+}
+
+__STRING_INLINE char *__strncpy_by2 (char *__dest, const char __src[],
+ size_t __srclen, size_t __n);
+
+__STRING_INLINE char *
+__strncpy_by2 (char *__dest, const char __src[], size_t __srclen, size_t __n)
+{
+ register char *__tmp = __dest;
+ register int __dummy1, __dummy2;
+ __asm__ __volatile__
+ ("shrl $1,%3\n\t"
+ "jz 2f\n" /* only a word */
+ "1:\n\t"
+ "movl (%2),%0\n\t"
+ "leal 4(%2),%2\n\t"
+ "movl %0,(%1)\n\t"
+ "leal 4(%1),%1\n\t"
+ "decl %3\n\t"
+ "jnz 1b\n"
+ "2:\n\t"
+ "movw (%2),%w0\n\t"
+ "movw %w0,(%1)\n\t"
+ : "=&q" (__dummy1), "=r" (__tmp), "=&r" (__src), "=&r" (__dummy2),
+ "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest)
+ : "1" (__tmp), "2" (__src), "3" (__srclen / 2),
+ "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
+ : "cc");
+ (void) memset (__tmp + 2, '\0', __n - __srclen);
+ return __dest;
+}
+
+__STRING_INLINE char *__strncpy_byn (char *__dest, const char __src[],
+ size_t __srclen, size_t __n);
+
+__STRING_INLINE char *
+__strncpy_byn (char *__dest, const char __src[], size_t __srclen, size_t __n)
+{
+ register unsigned long int __d0, __d1;
+ register char *__tmp = __dest;
+ __asm__ __volatile__
+ ("cld\n\t"
+ "shrl $1,%1\n\t"
+ "jnc 1f\n\t"
+ "movsb\n"
+ "1:\n\t"
+ "shrl $1,%1\n\t"
+ "jnc 2f\n\t"
+ "movsw\n"
+ "2:\n\t"
+ "rep; movsl"
+ : "=D" (__tmp), "=&c" (__d0), "=&S" (__d1),
+ "=m" ( *(struct { __extension__ char __x[__srclen]; } *)__dest)
+ : "1" (__srclen), "0" (__tmp),"2" (__src),
+ "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
+ : "cc");
+ (void) memset (__tmp, '\0', __n - __srclen);
+ return __dest;
+}
+
+__STRING_INLINE char *__strncpy_gg (char *__dest, const char *__src,
+ size_t __n);
+
+__STRING_INLINE char *
+__strncpy_gg (char *__dest, const char *__src, size_t __n)
+{
+ register char *__tmp = __dest;
+ register char __dummy;
+ if (__n > 0)
+ __asm__ __volatile__
+ ("1:\n\t"
+ "movb (%0),%2\n\t"
+ "incl %0\n\t"
+ "movb %2,(%1)\n\t"
+ "incl %1\n\t"
+ "decl %3\n\t"
+ "je 3f\n\t"
+ "testb %2,%2\n\t"
+ "jne 1b\n\t"
+ "2:\n\t"
+ "movb %2,(%1)\n\t"
+ "incl %1\n\t"
+ "decl %3\n\t"
+ "jne 2b\n\t"
+ "3:"
+ : "=&r" (__src), "=&r" (__tmp), "=&q" (__dummy), "=&r" (__n)
+ : "0" (__src), "1" (__tmp), "3" (__n)
+ : "memory", "cc");
+
+ return __dest;
+}
+
+
+/* Append SRC onto DEST. */
+# define _HAVE_STRING_ARCH_strcat 1
+# define strcat(dest, src) \
+ (__extension__ (__builtin_constant_p (src) \
+ ? __strcat_c ((dest), (src), strlen (src) + 1) \
+ : __strcat_g ((dest), (src))))
+
+__STRING_INLINE char *__strcat_c (char *__dest, const char __src[],
+ size_t __srclen);
+
+__STRING_INLINE char *
+__strcat_c (char *__dest, const char __src[], size_t __srclen)
+{
+# ifdef __i686__
+ register unsigned long int __d0;
+ register char *__tmp;
+ __asm__ __volatile__
+ ("repne; scasb"
+ : "=D" (__tmp), "=&c" (__d0),
+ "=m" ( *(struct { char __x[0xfffffff]; } *)__dest)
+ : "0" (__dest), "1" (0xffffffff), "a" (0),
+ "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
+ : "cc");
+ --__tmp;
+# else
+ register char *__tmp = __dest - 1;
+ __asm__ __volatile__
+ ("1:\n\t"
+ "incl %0\n\t"
+ "cmpb $0,(%0)\n\t"
+ "jne 1b\n"
+ : "=r" (__tmp),
+ "=m" ( *(struct { char __x[0xfffffff]; } *)__dest)
+ : "0" (__tmp),
+ "m" ( *(struct { __extension__ char __x[__srclen]; } *)__src)
+ : "cc");
+# endif
+ (void) memcpy (__tmp, __src, __srclen);
+ return __dest;
+}
+
+__STRING_INLINE char *__strcat_g (char *__dest, const char *__src);
+
+__STRING_INLINE char *
+__strcat_g (char *__dest, const char *__src)
+{
+ register char *__tmp = __dest - 1;
+ register char __dummy;
+ __asm__ __volatile__
+ ("1:\n\t"
+ "incl %1\n\t"
+ "cmpb $0,(%1)\n\t"
+ "jne 1b\n"
+ "2:\n\t"
+ "movb (%2),%b0\n\t"
+ "incl %2\n\t"
+ "movb %b0,(%1)\n\t"
+ "incl %1\n\t"
+ "testb %b0,%b0\n\t"
+ "jne 2b\n"
+ : "=&q" (__dummy), "=&r" (__tmp), "=&r" (__src),
+ "=m" ( *(struct { char __x[0xfffffff]; } *)__dest)
+ : "1" (__tmp), "2" (__src),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__src)
+ : "memory", "cc");
+ return __dest;
+}
+
+
+/* Append no more than N characters from SRC onto DEST. */
+# define _HAVE_STRING_ARCH_strncat 1
+# define strncat(dest, src, n) \
+ (__extension__ ({ char *__dest = (dest); \
+ __builtin_constant_p (src) && __builtin_constant_p (n) \
+ ? (strlen (src) < ((size_t) (n)) \
+ ? strcat (__dest, (src)) \
+ : (*(char *)__mempcpy (strchr (__dest, '\0'), \
+ (const char *) (src), \
+ (n)) = 0, __dest)) \
+ : __strncat_g (__dest, (src), (n)); }))
+
+__STRING_INLINE char *__strncat_g (char *__dest, const char __src[],
+ size_t __n);
+
+__STRING_INLINE char *
+__strncat_g (char *__dest, const char __src[], size_t __n)
+{
+ register char *__tmp = __dest;
+ register char __dummy;
+# ifdef __i686__
+ __asm__ __volatile__
+ ("repne; scasb\n"
+ "movl %4, %3\n\t"
+ "decl %1\n\t"
+ "1:\n\t"
+ "subl $1,%3\n\t"
+ "jc 2f\n\t"
+ "movb (%2),%b0\n\t"
+ "movsb\n\t"
+ "testb %b0,%b0\n\t"
+ "jne 1b\n\t"
+ "decl %1\n"
+ "2:\n\t"
+ "movb $0,(%1)"
+ : "=&a" (__dummy), "=&D" (__tmp), "=&S" (__src), "=&c" (__n)
+ : "g" (__n), "0" (0), "1" (__tmp), "2" (__src), "3" (0xffffffff)
+ : "memory", "cc");
+# else
+ --__tmp;
+ __asm__ __volatile__
+ ("1:\n\t"
+ "cmpb $0,1(%1)\n\t"
+ "leal 1(%1),%1\n\t"
+ "jne 1b\n"
+ "2:\n\t"
+ "subl $1,%3\n\t"
+ "jc 3f\n\t"
+ "movb (%2),%b0\n\t"
+ "leal 1(%2),%2\n\t"
+ "movb %b0,(%1)\n\t"
+ "leal 1(%1),%1\n\t"
+ "testb %b0,%b0\n\t"
+ "jne 2b\n\t"
+ "decl %1\n"
+ "3:\n\t"
+ "movb $0,(%1)"
+ : "=&q" (__dummy), "=&r" (__tmp), "=&r" (__src), "=&r" (__n)
+ : "1" (__tmp), "2" (__src), "3" (__n)
+ : "memory", "cc");
+#endif
+ return __dest;
+}
+
+
+/* Compare S1 and S2. */
+# define _HAVE_STRING_ARCH_strcmp 1
+# define strcmp(s1, s2) \
+ (__extension__ (__builtin_constant_p (s1) && __builtin_constant_p (s2) \
+ && (sizeof ((s1)[0]) != 1 || strlen (s1) >= 4) \
+ && (sizeof ((s2)[0]) != 1 || strlen (s2) >= 4) \
+ ? memcmp ((const char *) (s1), (const char *) (s2), \
+ (strlen (s1) < strlen (s2) \
+ ? strlen (s1) : strlen (s2)) + 1) \
+ : (__builtin_constant_p (s1) && sizeof ((s1)[0]) == 1 \
+ && sizeof ((s2)[0]) == 1 && strlen (s1) < 4 \
+ ? (__builtin_constant_p (s2) && sizeof ((s2)[0]) == 1 \
+ ? __strcmp_cc ((const unsigned char *) (s1), \
+ (const unsigned char *) (s2), \
+ strlen (s1)) \
+ : __strcmp_cg ((const unsigned char *) (s1), \
+ (const unsigned char *) (s2), \
+ strlen (s1))) \
+ : (__builtin_constant_p (s2) && sizeof ((s1)[0]) == 1 \
+ && sizeof ((s2)[0]) == 1 && strlen (s2) < 4 \
+ ? (__builtin_constant_p (s1) \
+ ? __strcmp_cc ((const unsigned char *) (s1), \
+ (const unsigned char *) (s2), \
+ strlen (s2)) \
+ : __strcmp_gc ((const unsigned char *) (s1), \
+ (const unsigned char *) (s2), \
+ strlen (s2))) \
+ : __strcmp_gg ((s1), (s2))))))
+
+# define __strcmp_cc(s1, s2, l) \
+ (__extension__ ({ register int __result = (s1)[0] - (s2)[0]; \
+ if (l > 0 && __result == 0) \
+ { \
+ __result = (s1)[1] - (s2)[1]; \
+ if (l > 1 && __result == 0) \
+ { \
+ __result = (s1)[2] - (s2)[2]; \
+ if (l > 2 && __result == 0) \
+ __result = (s1)[3] - (s2)[3]; \
+ } \
+ } \
+ __result; }))
+
+# define __strcmp_cg(s1, s2, l1) \
+ (__extension__ ({ const unsigned char *__s2 = (s2); \
+ register int __result = (s1)[0] - __s2[0]; \
+ if (l1 > 0 && __result == 0) \
+ { \
+ __result = (s1)[1] - __s2[1]; \
+ if (l1 > 1 && __result == 0) \
+ { \
+ __result = (s1)[2] - __s2[2]; \
+ if (l1 > 2 && __result == 0) \
+ __result = (s1)[3] - __s2[3]; \
+ } \
+ } \
+ __result; }))
+
+# define __strcmp_gc(s1, s2, l2) \
+ (__extension__ ({ const unsigned char *__s1 = (s1); \
+ register int __result = __s1[0] - (s2)[0]; \
+ if (l2 > 0 && __result == 0) \
+ { \
+ __result = __s1[1] - (s2)[1]; \
+ if (l2 > 1 && __result == 0) \
+ { \
+ __result = __s1[2] - (s2)[2]; \
+ if (l2 > 2 && __result == 0) \
+ __result = __s1[3] - (s2)[3]; \
+ } \
+ } \
+ __result; }))
+
+__STRING_INLINE int __strcmp_gg (const char *__s1, const char *__s2);
+
+__STRING_INLINE int
+__strcmp_gg (const char *__s1, const char *__s2)
+{
+ register int __res;
+ __asm__ __volatile__
+ ("1:\n\t"
+ "movb (%1),%b0\n\t"
+ "leal 1(%1),%1\n\t"
+ "cmpb %b0,(%2)\n\t"
+ "jne 2f\n\t"
+ "leal 1(%2),%2\n\t"
+ "testb %b0,%b0\n\t"
+ "jne 1b\n\t"
+ "xorl %0,%0\n\t"
+ "jmp 3f\n"
+ "2:\n\t"
+ "movl $1,%0\n\t"
+ "jb 3f\n\t"
+ "negl %0\n"
+ "3:"
+ : "=q" (__res), "=&r" (__s1), "=&r" (__s2)
+ : "1" (__s1), "2" (__s2),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s1),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s2)
+ : "cc");
+ return __res;
+}
+
+
+/* Compare N characters of S1 and S2. */
+# define _HAVE_STRING_ARCH_strncmp 1
+# define strncmp(s1, s2, n) \
+ (__extension__ (__builtin_constant_p (s1) && strlen (s1) < ((size_t) (n)) \
+ ? strcmp ((s1), (s2)) \
+ : (__builtin_constant_p (s2) && strlen (s2) < ((size_t) (n))\
+ ? strcmp ((s1), (s2)) \
+ : __strncmp_g ((s1), (s2), (n)))))
+
+__STRING_INLINE int __strncmp_g (const char *__s1, const char *__s2,
+ size_t __n);
+
+__STRING_INLINE int
+__strncmp_g (const char *__s1, const char *__s2, size_t __n)
+{
+ register int __res;
+ __asm__ __volatile__
+ ("1:\n\t"
+ "subl $1,%3\n\t"
+ "jc 2f\n\t"
+ "movb (%1),%b0\n\t"
+ "incl %1\n\t"
+ "cmpb %b0,(%2)\n\t"
+ "jne 3f\n\t"
+ "incl %2\n\t"
+ "testb %b0,%b0\n\t"
+ "jne 1b\n"
+ "2:\n\t"
+ "xorl %0,%0\n\t"
+ "jmp 4f\n"
+ "3:\n\t"
+ "movl $1,%0\n\t"
+ "jb 4f\n\t"
+ "negl %0\n"
+ "4:"
+ : "=q" (__res), "=&r" (__s1), "=&r" (__s2), "=&r" (__n)
+ : "1" (__s1), "2" (__s2), "3" (__n),
+ "m" ( *(struct { __extension__ char __x[__n]; } *)__s1),
+ "m" ( *(struct { __extension__ char __x[__n]; } *)__s2)
+ : "cc");
+ return __res;
+}
+
+
+/* Find the first occurrence of C in S. */
+# define _HAVE_STRING_ARCH_strchr 1
+# define _USE_STRING_ARCH_strchr 1
+# define strchr(s, c) \
+ (__extension__ (__builtin_constant_p (c) \
+ ? ((c) == '\0' \
+ ? (char *) __rawmemchr ((s), (c)) \
+ : __strchr_c ((s), ((c) & 0xff) << 8)) \
+ : __strchr_g ((s), (c))))
+
+__STRING_INLINE char *__strchr_c (const char *__s, int __c);
+
+__STRING_INLINE char *
+__strchr_c (const char *__s, int __c)
+{
+ register unsigned long int __d0;
+ register char *__res;
+ __asm__ __volatile__
+ ("1:\n\t"
+ "movb (%0),%%al\n\t"
+ "cmpb %%ah,%%al\n\t"
+ "je 2f\n\t"
+ "leal 1(%0),%0\n\t"
+ "testb %%al,%%al\n\t"
+ "jne 1b\n\t"
+ "xorl %0,%0\n"
+ "2:"
+ : "=r" (__res), "=&a" (__d0)
+ : "0" (__s), "1" (__c),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s)
+ : "cc");
+ return __res;
+}
+
+__STRING_INLINE char *__strchr_g (const char *__s, int __c);
+
+__STRING_INLINE char *
+__strchr_g (const char *__s, int __c)
+{
+ register unsigned long int __d0;
+ register char *__res;
+ __asm__ __volatile__
+ ("movb %%al,%%ah\n"
+ "1:\n\t"
+ "movb (%0),%%al\n\t"
+ "cmpb %%ah,%%al\n\t"
+ "je 2f\n\t"
+ "leal 1(%0),%0\n\t"
+ "testb %%al,%%al\n\t"
+ "jne 1b\n\t"
+ "xorl %0,%0\n"
+ "2:"
+ : "=r" (__res), "=&a" (__d0)
+ : "0" (__s), "1" (__c),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s)
+ : "cc");
+ return __res;
+}
+
+
+/* Find the first occurrence of C in S or the final NUL byte. */
+# define _HAVE_STRING_ARCH_strchrnul 1
+# define __strchrnul(s, c) \
+ (__extension__ (__builtin_constant_p (c) \
+ ? ((c) == '\0' \
+ ? (char *) __rawmemchr ((s), c) \
+ : __strchrnul_c ((s), ((c) & 0xff) << 8)) \
+ : __strchrnul_g ((s), c)))
+
+__STRING_INLINE char *__strchrnul_c (const char *__s, int __c);
+
+__STRING_INLINE char *
+__strchrnul_c (const char *__s, int __c)
+{
+ register unsigned long int __d0;
+ register char *__res;
+ __asm__ __volatile__
+ ("1:\n\t"
+ "movb (%0),%%al\n\t"
+ "cmpb %%ah,%%al\n\t"
+ "je 2f\n\t"
+ "leal 1(%0),%0\n\t"
+ "testb %%al,%%al\n\t"
+ "jne 1b\n\t"
+ "decl %0\n"
+ "2:"
+ : "=r" (__res), "=&a" (__d0)
+ : "0" (__s), "1" (__c),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s)
+ : "cc");
+ return __res;
+}
+
+__STRING_INLINE char *__strchrnul_g (const char *__s, int __c);
+
+__STRING_INLINE char *
+__strchrnul_g (const char *__s, int __c)
+{
+ register unsigned long int __d0;
+ register char *__res;
+ __asm__ __volatile__
+ ("movb %%al,%%ah\n"
+ "1:\n\t"
+ "movb (%0),%%al\n\t"
+ "cmpb %%ah,%%al\n\t"
+ "je 2f\n\t"
+ "leal 1(%0),%0\n\t"
+ "testb %%al,%%al\n\t"
+ "jne 1b\n\t"
+ "decl %0\n"
+ "2:"
+ : "=r" (__res), "=&a" (__d0)
+ : "0" (__s), "1" (__c),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s)
+ : "cc");
+ return __res;
+}
+# ifdef __USE_GNU
+# define strchrnul(s, c) __strchrnul ((s), (c))
+# endif
+
+
+# if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+/* Find the first occurrence of C in S. This is the BSD name. */
+# define _HAVE_STRING_ARCH_index 1
+# define index(s, c) \
+ (__extension__ (__builtin_constant_p (c) \
+ ? __strchr_c ((s), ((c) & 0xff) << 8) \
+ : __strchr_g ((s), (c))))
+# endif
+
+
+/* Find the last occurrence of C in S. */
+# define _HAVE_STRING_ARCH_strrchr 1
+# define strrchr(s, c) \
+ (__extension__ (__builtin_constant_p (c) \
+ ? __strrchr_c ((s), ((c) & 0xff) << 8) \
+ : __strrchr_g ((s), (c))))
+
+# ifdef __i686__
+__STRING_INLINE char *__strrchr_c (const char *__s, int __c);
+
+__STRING_INLINE char *
+__strrchr_c (const char *__s, int __c)
+{
+ register unsigned long int __d0, __d1;
+ register char *__res;
+ __asm__ __volatile__
+ ("cld\n"
+ "1:\n\t"
+ "lodsb\n\t"
+ "cmpb %h2,%b2\n\t"
+ "cmove %1,%0\n\t"
+ "testb %b2,%b2\n\t"
+ "jne 1b"
+ : "=d" (__res), "=&S" (__d0), "=&a" (__d1)
+ : "0" (1), "1" (__s), "2" (__c),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s)
+ : "cc");
+ return __res - 1;
+}
+
+__STRING_INLINE char *__strrchr_g (const char *__s, int __c);
+
+__STRING_INLINE char *
+__strrchr_g (const char *__s, int __c)
+{
+ register unsigned long int __d0, __d1;
+ register char *__res;
+ __asm__ __volatile__
+ ("movb %b2,%h2\n"
+ "cld\n\t"
+ "1:\n\t"
+ "lodsb\n\t"
+ "cmpb %h2,%b2\n\t"
+ "cmove %1,%0\n\t"
+ "testb %b2,%b2\n\t"
+ "jne 1b"
+ : "=d" (__res), "=&S" (__d0), "=&a" (__d1)
+ : "0" (1), "1" (__s), "2" (__c),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s)
+ : "cc");
+ return __res - 1;
+}
+# else
+__STRING_INLINE char *__strrchr_c (const char *__s, int __c);
+
+__STRING_INLINE char *
+__strrchr_c (const char *__s, int __c)
+{
+ register unsigned long int __d0, __d1;
+ register char *__res;
+ __asm__ __volatile__
+ ("cld\n"
+ "1:\n\t"
+ "lodsb\n\t"
+ "cmpb %%ah,%%al\n\t"
+ "jne 2f\n\t"
+ "leal -1(%%esi),%0\n"
+ "2:\n\t"
+ "testb %%al,%%al\n\t"
+ "jne 1b"
+ : "=d" (__res), "=&S" (__d0), "=&a" (__d1)
+ : "0" (0), "1" (__s), "2" (__c),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s)
+ : "cc");
+ return __res;
+}
+
+__STRING_INLINE char *__strrchr_g (const char *__s, int __c);
+
+__STRING_INLINE char *
+__strrchr_g (const char *__s, int __c)
+{
+ register unsigned long int __d0, __d1;
+ register char *__res;
+ __asm__ __volatile__
+ ("movb %%al,%%ah\n"
+ "cld\n\t"
+ "1:\n\t"
+ "lodsb\n\t"
+ "cmpb %%ah,%%al\n\t"
+ "jne 2f\n\t"
+ "leal -1(%%esi),%0\n"
+ "2:\n\t"
+ "testb %%al,%%al\n\t"
+ "jne 1b"
+ : "=r" (__res), "=&S" (__d0), "=&a" (__d1)
+ : "0" (0), "1" (__s), "2" (__c),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s)
+ : "cc");
+ return __res;
+}
+# endif
+
+
+# if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+/* Find the last occurrence of C in S. This is the BSD name. */
+# define _HAVE_STRING_ARCH_rindex 1
+# define rindex(s, c) \
+ (__extension__ (__builtin_constant_p (c) \
+ ? __strrchr_c ((s), ((c) & 0xff) << 8) \
+ : __strrchr_g ((s), (c))))
+# endif
+
+
+/* Return the length of the initial segment of S which
+ consists entirely of characters not in REJECT. */
+# define _HAVE_STRING_ARCH_strcspn 1
+# define strcspn(s, reject) \
+ (__extension__ (__builtin_constant_p (reject) && sizeof ((reject)[0]) == 1 \
+ ? ((reject)[0] == '\0' \
+ ? strlen (s) \
+ : ((reject)[1] == '\0' \
+ ? __strcspn_c1 ((s), (((reject)[0] << 8) & 0xff00)) \
+ : __strcspn_cg ((s), (reject), strlen (reject)))) \
+ : __strcspn_g ((s), (reject))))
+
+__STRING_INLINE size_t __strcspn_c1 (const char *__s, int __reject);
+
+# ifndef _FORCE_INLINES
+__STRING_INLINE size_t
+__strcspn_c1 (const char *__s, int __reject)
+{
+ register unsigned long int __d0;
+ register char *__res;
+ __asm__ __volatile__
+ ("1:\n\t"
+ "movb (%0),%%al\n\t"
+ "leal 1(%0),%0\n\t"
+ "cmpb %%ah,%%al\n\t"
+ "je 2f\n\t"
+ "testb %%al,%%al\n\t"
+ "jne 1b\n"
+ "2:"
+ : "=r" (__res), "=&a" (__d0)
+ : "0" (__s), "1" (__reject),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s)
+ : "cc");
+ return (__res - 1) - __s;
+}
+# endif
+
+__STRING_INLINE size_t __strcspn_cg (const char *__s, const char __reject[],
+ size_t __reject_len);
+
+__STRING_INLINE size_t
+__strcspn_cg (const char *__s, const char __reject[], size_t __reject_len)
+{
+ register unsigned long int __d0, __d1, __d2;
+ register const char *__res;
+ __asm__ __volatile__
+ ("cld\n"
+ "1:\n\t"
+ "lodsb\n\t"
+ "testb %%al,%%al\n\t"
+ "je 2f\n\t"
+ "movl %5,%%edi\n\t"
+ "movl %6,%%ecx\n\t"
+ "repne; scasb\n\t"
+ "jne 1b\n"
+ "2:"
+ : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
+ : "0" (__s), "d" (__reject), "g" (__reject_len)
+ : "memory", "cc");
+ return (__res - 1) - __s;
+}
+
+__STRING_INLINE size_t __strcspn_g (const char *__s, const char *__reject);
+# ifdef __PIC__
+
+__STRING_INLINE size_t
+__strcspn_g (const char *__s, const char *__reject)
+{
+ register unsigned long int __d0, __d1, __d2;
+ register const char *__res;
+ __asm__ __volatile__
+ ("pushl %%ebx\n\t"
+ "movl %4,%%edi\n\t"
+ "cld\n\t"
+ "repne; scasb\n\t"
+ "notl %%ecx\n\t"
+ "leal -1(%%ecx),%%ebx\n"
+ "1:\n\t"
+ "lodsb\n\t"
+ "testb %%al,%%al\n\t"
+ "je 2f\n\t"
+ "movl %4,%%edi\n\t"
+ "movl %%ebx,%%ecx\n\t"
+ "repne; scasb\n\t"
+ "jne 1b\n"
+ "2:\n\t"
+ "popl %%ebx"
+ : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
+ : "r" (__reject), "0" (__s), "1" (0), "2" (0xffffffff)
+ : "memory", "cc");
+ return (__res - 1) - __s;
+}
+# else
+__STRING_INLINE size_t
+__strcspn_g (const char *__s, const char *__reject)
+{
+ register unsigned long int __d0, __d1, __d2, __d3;
+ register const char *__res;
+ __asm__ __volatile__
+ ("cld\n\t"
+ "repne; scasb\n\t"
+ "notl %%ecx\n\t"
+ "leal -1(%%ecx),%%edx\n"
+ "1:\n\t"
+ "lodsb\n\t"
+ "testb %%al,%%al\n\t"
+ "je 2f\n\t"
+ "movl %%ebx,%%edi\n\t"
+ "movl %%edx,%%ecx\n\t"
+ "repne; scasb\n\t"
+ "jne 1b\n"
+ "2:"
+ : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2), "=&d" (__d3)
+ : "0" (__s), "1" (0), "2" (0xffffffff), "3" (__reject), "b" (__reject)
+ /* Clobber memory, otherwise GCC cannot handle this. */
+ : "memory", "cc");
+ return (__res - 1) - __s;
+}
+# endif
+
+
+/* Return the length of the initial segment of S which
+ consists entirely of characters in ACCEPT. */
+# define _HAVE_STRING_ARCH_strspn 1
+# define strspn(s, accept) \
+ (__extension__ (__builtin_constant_p (accept) && sizeof ((accept)[0]) == 1 \
+ ? ((accept)[0] == '\0' \
+ ? ((void) (s), 0) \
+ : ((accept)[1] == '\0' \
+ ? __strspn_c1 ((s), (((accept)[0] << 8 ) & 0xff00)) \
+ : __strspn_cg ((s), (accept), strlen (accept)))) \
+ : __strspn_g ((s), (accept))))
+
+# ifndef _FORCE_INLINES
+__STRING_INLINE size_t __strspn_c1 (const char *__s, int __accept);
+
+__STRING_INLINE size_t
+__strspn_c1 (const char *__s, int __accept)
+{
+ register unsigned long int __d0;
+ register char *__res;
+ /* Please note that __accept never can be '\0'. */
+ __asm__ __volatile__
+ ("1:\n\t"
+ "movb (%0),%b1\n\t"
+ "leal 1(%0),%0\n\t"
+ "cmpb %h1,%b1\n\t"
+ "je 1b"
+ : "=r" (__res), "=&q" (__d0)
+ : "0" (__s), "1" (__accept),
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s)
+ : "cc");
+ return (__res - 1) - __s;
+}
+# endif
+
+__STRING_INLINE size_t __strspn_cg (const char *__s, const char __accept[],
+ size_t __accept_len);
+
+__STRING_INLINE size_t
+__strspn_cg (const char *__s, const char __accept[], size_t __accept_len)
+{
+ register unsigned long int __d0, __d1, __d2;
+ register const char *__res;
+ __asm__ __volatile__
+ ("cld\n"
+ "1:\n\t"
+ "lodsb\n\t"
+ "testb %%al,%%al\n\t"
+ "je 2f\n\t"
+ "movl %5,%%edi\n\t"
+ "movl %6,%%ecx\n\t"
+ "repne; scasb\n\t"
+ "je 1b\n"
+ "2:"
+ : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
+ : "0" (__s), "g" (__accept), "g" (__accept_len),
+ /* Since we do not know how large the memory we access it, use a
+ really large amount. */
+ "m" ( *(struct { char __x[0xfffffff]; } *)__s),
+ "m" ( *(struct { __extension__ char __x[__accept_len]; } *)__accept)
+ : "cc");
+ return (__res - 1) - __s;
+}
+
+__STRING_INLINE size_t __strspn_g (const char *__s, const char *__accept);
+# ifdef __PIC__
+
+__STRING_INLINE size_t
+__strspn_g (const char *__s, const char *__accept)
+{
+ register unsigned long int __d0, __d1, __d2;
+ register const char *__res;
+ __asm__ __volatile__
+ ("pushl %%ebx\n\t"
+ "cld\n\t"
+ "repne; scasb\n\t"
+ "notl %%ecx\n\t"
+ "leal -1(%%ecx),%%ebx\n"
+ "1:\n\t"
+ "lodsb\n\t"
+ "testb %%al,%%al\n\t"
+ "je 2f\n\t"
+ "movl %%edx,%%edi\n\t"
+ "movl %%ebx,%%ecx\n\t"
+ "repne; scasb\n\t"
+ "je 1b\n"
+ "2:\n\t"
+ "popl %%ebx"
+ : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
+ : "d" (__accept), "0" (__s), "1" (0), "2" (0xffffffff), "3" (__accept)
+ : "memory", "cc");
+ return (__res - 1) - __s;
+}
+# else
+__STRING_INLINE size_t
+__strspn_g (const char *__s, const char *__accept)
+{
+ register unsigned long int __d0, __d1, __d2, __d3;
+ register const char *__res;
+ __asm__ __volatile__
+ ("cld\n\t"
+ "repne; scasb\n\t"
+ "notl %%ecx\n\t"
+ "leal -1(%%ecx),%%edx\n"
+ "1:\n\t"
+ "lodsb\n\t"
+ "testb %%al,%%al\n\t"
+ "je 2f\n\t"
+ "movl %%ebx,%%edi\n\t"
+ "movl %%edx,%%ecx\n\t"
+ "repne; scasb\n\t"
+ "je 1b\n"
+ "2:"
+ : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2), "=&d" (__d3)
+ : "0" (__s), "1" (0), "2" (0xffffffff), "3" (__accept), "b" (__accept)
+ : "memory", "cc");
+ return (__res - 1) - __s;
+}
+# endif
+
+
+/* Find the first occurrence in S of any character in ACCEPT. */
+# define _HAVE_STRING_ARCH_strpbrk 1
+# define strpbrk(s, accept) \
+ (__extension__ (__builtin_constant_p (accept) && sizeof ((accept)[0]) == 1 \
+ ? ((accept)[0] == '\0' \
+ ? ((void) (s), (char *) 0) \
+ : ((accept)[1] == '\0' \
+ ? strchr ((s), (accept)[0]) \
+ : __strpbrk_cg ((s), (accept), strlen (accept)))) \
+ : __strpbrk_g ((s), (accept))))
+
+__STRING_INLINE char *__strpbrk_cg (const char *__s, const char __accept[],
+ size_t __accept_len);
+
+__STRING_INLINE char *
+__strpbrk_cg (const char *__s, const char __accept[], size_t __accept_len)
+{
+ register unsigned long int __d0, __d1, __d2;
+ register char *__res;
+ __asm__ __volatile__
+ ("cld\n"
+ "1:\n\t"
+ "lodsb\n\t"
+ "testb %%al,%%al\n\t"
+ "je 2f\n\t"
+ "movl %5,%%edi\n\t"
+ "movl %6,%%ecx\n\t"
+ "repne; scasb\n\t"
+ "jne 1b\n\t"
+ "decl %0\n\t"
+ "jmp 3f\n"
+ "2:\n\t"
+ "xorl %0,%0\n"
+ "3:"
+ : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
+ : "0" (__s), "d" (__accept), "g" (__accept_len)
+ : "memory", "cc");
+ return __res;
+}
+
+__STRING_INLINE char *__strpbrk_g (const char *__s, const char *__accept);
+# ifdef __PIC__
+
+__STRING_INLINE char *
+__strpbrk_g (const char *__s, const char *__accept)
+{
+ register unsigned long int __d0, __d1, __d2;
+ register char *__res;
+ __asm__ __volatile__
+ ("pushl %%ebx\n\t"
+ "movl %%edx,%%edi\n\t"
+ "cld\n\t"
+ "repne; scasb\n\t"
+ "notl %%ecx\n\t"
+ "leal -1(%%ecx),%%ebx\n"
+ "1:\n\t"
+ "lodsb\n\t"
+ "testb %%al,%%al\n\t"
+ "je 2f\n\t"
+ "movl %%edx,%%edi\n\t"
+ "movl %%ebx,%%ecx\n\t"
+ "repne; scasb\n\t"
+ "jne 1b\n\t"
+ "decl %0\n\t"
+ "jmp 3f\n"
+ "2:\n\t"
+ "xorl %0,%0\n"
+ "3:\n\t"
+ "popl %%ebx"
+ : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
+ : "d" (__accept), "0" (__s), "1" (0), "2" (0xffffffff)
+ : "memory", "cc");
+ return __res;
+}
+# else
+__STRING_INLINE char *
+__strpbrk_g (const char *__s, const char *__accept)
+{
+ register unsigned long int __d0, __d1, __d2, __d3;
+ register char *__res;
+ __asm__ __volatile__
+ ("movl %%ebx,%%edi\n\t"
+ "cld\n\t"
+ "repne; scasb\n\t"
+ "notl %%ecx\n\t"
+ "leal -1(%%ecx),%%edx\n"
+ "1:\n\t"
+ "lodsb\n\t"
+ "testb %%al,%%al\n\t"
+ "je 2f\n\t"
+ "movl %%ebx,%%edi\n\t"
+ "movl %%edx,%%ecx\n\t"
+ "repne; scasb\n\t"
+ "jne 1b\n\t"
+ "decl %0\n\t"
+ "jmp 3f\n"
+ "2:\n\t"
+ "xorl %0,%0\n"
+ "3:"
+ : "=S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3)
+ : "0" (__s), "1" (0), "2" (0xffffffff), "b" (__accept)
+ : "memory", "cc");
+ return __res;
+}
+# endif
+
+
+/* Find the first occurrence of NEEDLE in HAYSTACK. */
+# define _HAVE_STRING_ARCH_strstr 1
+# define strstr(haystack, needle) \
+ (__extension__ (__builtin_constant_p (needle) && sizeof ((needle)[0]) == 1 \
+ ? ((needle)[0] == '\0' \
+ ? (haystack) \
+ : ((needle)[1] == '\0' \
+ ? strchr ((haystack), (needle)[0]) \
+ : __strstr_cg ((haystack), (needle), \
+ strlen (needle)))) \
+ : __strstr_g ((haystack), (needle))))
+
+/* Please note that this function need not handle NEEDLEs with a
+ length shorter than two. */
+__STRING_INLINE char *__strstr_cg (const char *__haystack,
+ const char __needle[],
+ size_t __needle_len);
+
+__STRING_INLINE char *
+__strstr_cg (const char *__haystack, const char __needle[],
+ size_t __needle_len)
+{
+ register unsigned long int __d0, __d1, __d2;
+ register char *__res;
+ __asm__ __volatile__
+ ("cld\n" \
+ "1:\n\t"
+ "movl %6,%%edi\n\t"
+ "movl %5,%%eax\n\t"
+ "movl %4,%%ecx\n\t"
+ "repe; cmpsb\n\t"
+ "je 2f\n\t"
+ "cmpb $0,-1(%%esi)\n\t"
+ "leal 1(%%eax),%5\n\t"
+ "jne 1b\n\t"
+ "xorl %%eax,%%eax\n"
+ "2:"
+ : "=&a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2)
+ : "g" (__needle_len), "1" (__haystack), "d" (__needle)
+ : "memory", "cc");
+ return __res;
+}
+
+__STRING_INLINE char *__strstr_g (const char *__haystack,
+ const char *__needle);
+# ifdef __PIC__
+
+__STRING_INLINE char *
+__strstr_g (const char *__haystack, const char *__needle)
+{
+ register unsigned long int __d0, __d1, __d2;
+ register char *__res;
+ __asm__ __volatile__
+ ("cld\n\t"
+ "repne; scasb\n\t"
+ "notl %%ecx\n\t"
+ "pushl %%ebx\n\t"
+ "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
+ "movl %%ecx,%%ebx\n"
+ "1:\n\t"
+ "movl %%edx,%%edi\n\t"
+ "movl %%esi,%%eax\n\t"
+ "movl %%ebx,%%ecx\n\t"
+ "repe; cmpsb\n\t"
+ "je 2f\n\t" /* also works for empty string, see above */
+ "cmpb $0,-1(%%esi)\n\t"
+ "leal 1(%%eax),%%esi\n\t"
+ "jne 1b\n\t"
+ "xorl %%eax,%%eax\n"
+ "2:\n\t"
+ "popl %%ebx"
+ : "=&a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
+ : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (__needle),
+ "d" (__needle)
+ : "memory", "cc");
+ return __res;
+}
+# else
+__STRING_INLINE char *
+__strstr_g (const char *__haystack, const char *__needle)
+{
+ register unsigned long int __d0, __d1, __d2, __d3;
+ register char *__res;
+ __asm__ __volatile__
+ ("cld\n\t"
+ "repne; scasb\n\t"
+ "notl %%ecx\n\t"
+ "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
+ "movl %%ecx,%%edx\n"
+ "1:\n\t"
+ "movl %%ebx,%%edi\n\t"
+ "movl %%esi,%%eax\n\t"
+ "movl %%edx,%%ecx\n\t"
+ "repe; cmpsb\n\t"
+ "je 2f\n\t" /* also works for empty string, see above */
+ "cmpb $0,-1(%%esi)\n\t"
+ "leal 1(%%eax),%%esi\n\t"
+ "jne 1b\n\t"
+ "xorl %%eax,%%eax\n"
+ "2:"
+ : "=&a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2), "=&d" (__d3)
+ : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (__needle),
+ "b" (__needle)
+ : "memory", "cc");
+ return __res;
+}
+# endif
+
+
+/* Bit find functions. We define only the i686 version since for the other
+ processors gcc generates good code. */
+# if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+# ifdef __i686__
+# define _HAVE_STRING_ARCH_ffs 1
+# define ffs(word) (__builtin_constant_p (word) \
+ ? __builtin_ffs (word) \
+ : ({ int __cnt, __tmp; \
+ __asm__ __volatile__ \
+ ("bsfl %2,%0\n\t" \
+ "cmovel %1,%0" \
+ : "=&r" (__cnt), "=r" (__tmp) \
+ : "rm" (word), "1" (-1)); \
+ __cnt + 1; }))
+
+# ifndef ffsl
+# define ffsl(word) ffs(word)
+# endif
+# endif /* i686 */
+# endif /* BSD || X/Open */
+
+# ifndef _FORCE_INLINES
+# undef __STRING_INLINE
+# endif
+
+# endif /* use string inlines && GNU CC */
+
+#endif
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=add10d1bb9cdd7f4cfdc8c1cd2f4b97f5b0a0c67
commit add10d1bb9cdd7f4cfdc8c1cd2f4b97f5b0a0c67
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed May 30 17:42:42 2012 -0700
Check __SSE_MATH__ instead of __x86_64__
diff --git a/ChangeLog.fpu b/ChangeLog.fpu
index eed5135..a3c7592 100644
--- a/ChangeLog.fpu
+++ b/ChangeLog.fpu
@@ -1,5 +1,10 @@
2012-05-30 H.J. Lu <hongjiu.lu@intel.com>
+ * sysdeps/x86/fpu/bits/mathinline.h: Check __SSE_MATH__
+ instead of __x86_64__.
+
+2012-05-30 H.J. Lu <hongjiu.lu@intel.com>
+
[BZ #14117]
* sysdeps/i386/fpu/bits/fenv.h: Removed.
* sysdeps/i386/fpu/bits/mathinline.h: Likewise.
diff --git a/sysdeps/x86/fpu/bits/mathinline.h b/sysdeps/x86/fpu/bits/mathinline.h
index a4e6df8..7919d1e 100644
--- a/sysdeps/x86/fpu/bits/mathinline.h
+++ b/sysdeps/x86/fpu/bits/mathinline.h
@@ -382,8 +382,8 @@ __END_NAMESPACE_C99
# endif
# if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \
- && !defined __x86_64__ && defined __OPTIMIZE__)
-/* Not used for x86-64. */
+ && !defined __SSE_MATH__ && defined __OPTIMIZE__)
+/* Not used by SSE math. */
/* The inline functions do not set errno or raise necessarily the
correct exceptions. */
@@ -521,8 +521,8 @@ __END_NAMESPACE_C99
# endif
-# if !defined __x86_64__ && !defined __NO_MATH_INLINES && defined __OPTIMIZE__
-/* Miscellaneous functions. Not used by x86-64. */
+# if !defined __SSE_MATH__ && !defined __NO_MATH_INLINES && defined __OPTIMIZE__
+/* Miscellaneous functions. Not used by SSE math. */
/* __FAST_MATH__ is defined by gcc -ffast-math. */
# ifdef __FAST_MATH__
@@ -953,8 +953,8 @@ __NTH (__finite (double __x))
# endif /* __NO_MATH_INLINES */
-/* This code is used internally in the GNU libc. Not used by x86-64. */
-# if !defined __x86_64__ && defined __LIBC_INTERNAL_MATH_INLINES
+/* This code is used internally in the GNU libc. Not used by SSE math. */
+# if !defined __SSE_MATH__ && defined __LIBC_INTERNAL_MATH_INLINES
__inline_mathop (__ieee754_sqrt, "fsqrt")
__inline_mathcode2 (__ieee754_atan2, __y, __x,
register long double __value;
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0064934f96a570ed8ac7193849c22c5f78d99bfb
commit 0064934f96a570ed8ac7193849c22c5f78d99bfb
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed May 30 17:38:26 2012 -0700
Add missing ChangeLog entries.
diff --git a/ChangeLog.fpu b/ChangeLog.fpu
index 419162b..eed5135 100644
--- a/ChangeLog.fpu
+++ b/ChangeLog.fpu
@@ -5,3 +5,5 @@
* sysdeps/i386/fpu/bits/mathinline.h: Likewise.
* sysdeps/x86_64/fpu/bits/fenv.h: Likewise.
* sysdeps/x86_64/fpu/bits/mathinline.h: Likewise.
+ * sysdeps/x86/fpu/bits/fenv.h: New file.
+ * sysdeps/x86/fpu/bits/mathinline.h: Likewise.
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4e4bc18c86828eff878ac9907e978983f45dca59
commit 4e4bc18c86828eff878ac9907e978983f45dca59
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed May 30 17:23:40 2012 -0700
Add sysdeps/x86/fpu/bits/{fenv.h,mathinline.h}
diff --git a/ChangeLog.fpu b/ChangeLog.fpu
new file mode 100644
index 0000000..419162b
--- /dev/null
+++ b/ChangeLog.fpu
@@ -0,0 +1,7 @@
+2012-05-30 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14117]
+ * sysdeps/i386/fpu/bits/fenv.h: Removed.
+ * sysdeps/i386/fpu/bits/mathinline.h: Likewise.
+ * sysdeps/x86_64/fpu/bits/fenv.h: Likewise.
+ * sysdeps/x86_64/fpu/bits/mathinline.h: Likewise.
diff --git a/sysdeps/i386/fpu/Implies b/sysdeps/i386/fpu/Implies
new file mode 100644
index 0000000..2b745a3
--- /dev/null
+++ b/sysdeps/i386/fpu/Implies
@@ -0,0 +1 @@
+x86/fpu
diff --git a/sysdeps/i386/fpu/bits/fenv.h b/sysdeps/x86/fpu/bits/fenv.h
similarity index 92%
rename from sysdeps/i386/fpu/bits/fenv.h
rename to sysdeps/x86/fpu/bits/fenv.h
index e71ceb7..b2c01c4 100644
--- a/sysdeps/i386/fpu/bits/fenv.h
+++ b/sysdeps/x86/fpu/bits/fenv.h
@@ -19,7 +19,6 @@
# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
#endif
-
/* Define bits representing the exception. We use the bit positions
of the appropriate bits in the FPU control word. */
enum
@@ -60,8 +59,10 @@ enum
typedef unsigned short int fexcept_t;
-/* Type representing floating-point environment. This function corresponds
- to the layout of the block written by the `fstenv'. */
+/* Type representing floating-point environment. This structure
+ corresponds to the layout of the block written by the `fstenv'
+ instruction and has additional fields for the contents of the MXCSR
+ register as written by the `stmxcsr' instruction. */
typedef struct
{
unsigned short int __control_word;
@@ -77,6 +78,9 @@ typedef struct
unsigned int __data_offset;
unsigned short int __data_selector;
unsigned short int __unused5;
+#ifdef __x86_64__
+ unsigned int __mxcsr;
+#endif
}
fenv_t;
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/x86/fpu/bits/mathinline.h
similarity index 65%
rename from sysdeps/i386/fpu/bits/mathinline.h
rename to sysdeps/x86/fpu/bits/mathinline.h
index 2a7e96b..a4e6df8 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/x86/fpu/bits/mathinline.h
@@ -1,7 +1,6 @@
-/* Inline math functions for i387.
+/* Inline math functions for i387 and SSE.
Copyright (C) 1995-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by John C. Bowman <bowman@math.ualberta.ca>, 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -21,10 +20,10 @@
# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
#endif
-#ifndef __extern_inline
+#ifndef __extern_always_inline
# define __MATH_INLINE __inline
#else
-# define __MATH_INLINE __extern_inline
+# define __MATH_INLINE __extern_always_inline
#endif
@@ -120,26 +119,42 @@
/* The gcc, version 2.7 or below, has problems with all this inlining
code. So disable it for this version of the compiler. */
-# if __GNUC_PREREQ (2, 8)
+# if __GNUC_PREREQ (2, 8) && defined __USE_ISOC99
+__BEGIN_NAMESPACE_C99
+
/* Test for negative number. Used in the signbit() macro. */
__MATH_INLINE int
__NTH (__signbitf (float __x))
{
+# ifndef __x86_64__
__extension__ union { float __f; int __i; } __u = { __f: __x };
return __u.__i < 0;
+# else
+ int __m;
+ __asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x));
+ return __m & 0x8;
+# endif
}
__MATH_INLINE int
__NTH (__signbit (double __x))
{
+# ifndef __x86_64__
__extension__ union { double __d; int __i[2]; } __u = { __d: __x };
return __u.__i[1] < 0;
+# else
+ int __m;
+ __asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x));
+ return __m & 0x80;
+# endif
}
__MATH_INLINE int
__NTH (__signbitl (long double __x))
{
__extension__ union { long double __l; int __i[3]; } __u = { __l: __x };
- return (__u.__i[2] & 0x8000) != 0;
+ return __u.__i[2] & 0x8000;
}
+
+__END_NAMESPACE_C99
# endif
#endif
@@ -147,13 +162,232 @@ __NTH (__signbitl (long double __x))
/* The gcc, version 2.7 or below, has problems with all this inlining
code. So disable it for this version of the compiler. */
#if __GNUC_PREREQ (2, 8)
+# if !__GNUC_PREREQ (3, 4) && !defined __NO_MATH_INLINES \
+ && defined __OPTIMIZE__
+/* GCC 3.4 introduced builtins for all functions below, so
+ there's no need to define any of these inline functions. */
+
+# ifdef __USE_ISOC99
+__BEGIN_NAMESPACE_C99
+
+/* Round to nearest integer. */
+# ifdef __SSE_MATH__
+__MATH_INLINE long int
+__NTH (lrintf (float __x))
+{
+ long int __res;
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("cvtss2si %1, %0" : "=r" (__res) : "xm" (__x));
+ return __res;
+}
+# endif
+# ifdef __SSE2_MATH__
+__MATH_INLINE long int
+__NTH (lrint (double __x))
+{
+ long int __res;
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("cvtsd2si %1, %0" : "=r" (__res) : "xm" (__x));
+ return __res;
+}
+# endif
+# ifdef __x86_64__
+__MATH_INLINE long long int
+__NTH (llrintf (float __x))
+{
+ long long int __res;
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("cvtss2si %1, %0" : "=r" (__res) : "xm" (__x));
+ return __res;
+}
+__MATH_INLINE long long int
+__NTH (llrint (double __x))
+{
+ long long int __res;
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("cvtsd2si %1, %0" : "=r" (__res) : "xm" (__x));
+ return __res;
+}
+# endif
+
+# if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0 \
+ && defined __SSE2_MATH__
+/* Determine maximum of two values. */
+__MATH_INLINE float
+__NTH (fmaxf (float __x, float __y))
+{
+# ifdef __AVX__
+ float __res;
+ __asm ("vmaxss %2, %1, %0" : "=x" (__res) : "x" (x), "xm" (__y));
+ return __res;
+# else
+ __asm ("maxss %1, %0" : "+x" (__x) : "xm" (__y));
+ return __x;
+# endif
+}
+__MATH_INLINE double
+__NTH (fmax (double __x, double __y))
+{
+# ifdef __AVX__
+ float __res;
+ __asm ("vmaxsd %2, %1, %0" : "=x" (__res) : "x" (x), "xm" (__y));
+ return __res;
+# else
+ __asm ("maxsd %1, %0" : "+x" (__x) : "xm" (__y));
+ return __x;
+# endif
+}
+
+/* Determine minimum of two values. */
+__MATH_INLINE float
+__NTH (fminf (float __x, float __y))
+{
+# ifdef __AVX__
+ float __res;
+ __asm ("vminss %2, %1, %0" : "=x" (__res) : "x" (x), "xm" (__y));
+ return __res;
+# else
+ __asm ("minss %1, %0" : "+x" (__x) : "xm" (__y));
+ return __x;
+# endif
+}
+__MATH_INLINE double
+__NTH (fmin (double __x, double __y))
+{
+# ifdef __AVX__
+ float __res;
+ __asm ("vminsd %2, %1, %0" : "=x" (__res) : "x" (x), "xm" (__y));
+ return __res;
+# else
+ __asm ("minsd %1, %0" : "+x" (__x) : "xm" (__y));
+ return __x;
+# endif
+}
+# endif
+
+__END_NAMESPACE_C99
+# endif
+
+# if defined __SSE4_1__ && defined __SSE2_MATH__
+# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+__BEGIN_NAMESPACE_C99
+
+/* Round to nearest integer. */
+__MATH_INLINE double
+__NTH (rint (double __x))
+{
+ double __res;
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("roundsd $4, %1, %0" : "=x" (__res) : "xm" (__x));
+ return __res;
+}
+__MATH_INLINE float
+__NTH (rintf (float __x))
+{
+ float __res;
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("roundss $4, %1, %0" : "=x" (__res) : "xm" (__x));
+ return __res;
+}
-#if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \
- && defined __OPTIMIZE__)
+# ifdef __USE_ISOC99
+/* Round to nearest integer without raising inexact exception. */
+__MATH_INLINE double
+__NTH (nearbyint (double __x))
+{
+ double __res;
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("roundsd $0xc, %1, %0" : "=x" (__res) : "xm" (__x));
+ return __res;
+}
+__MATH_INLINE float
+__NTH (nearbyintf (float __x))
+{
+ float __res;
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("roundss $0xc, %1, %0" : "=x" (__res) : "xm" (__x));
+ return __res;
+}
+# endif
+
+__END_NAMESPACE_C99
+# endif
+
+__BEGIN_NAMESPACE_STD
+/* Smallest integral value not less than X. */
+__MATH_INLINE double
+__NTH (ceil (double __x))
+{
+ double __res;
+ __asm ("roundsd $2, %1, %0" : "=x" (__res) : "xm" (__x));
+ return __res;
+}
+__END_NAMESPACE_STD
+
+__BEGIN_NAMESPACE_C99
+__MATH_INLINE float
+__NTH (ceilf (float __x))
+{
+ float __res;
+ __asm ("roundss $2, %1, %0" : "=x" (__res) : "xm" (__x));
+ return __res;
+}
+__END_NAMESPACE_C99
+
+__BEGIN_NAMESPACE_STD
+/* Largest integer not greater than X. */
+__MATH_INLINE double
+__NTH (floor (double __x))
+{
+ double __res;
+ __asm ("roundsd $1, %1, %0" : "=x" (__res) : "xm" (__x));
+ return __res;
+}
+__END_NAMESPACE_STD
+
+__BEGIN_NAMESPACE_C99
+__MATH_INLINE float
+__NTH (floorf (float __x))
+{
+ float __res;
+ __asm ("roundss $1, %1, %0" : "=x" (__res) : "xm" (__x));
+ return __res;
+}
+__END_NAMESPACE_C99
+# endif
+# endif
+
+# if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \
+ && !defined __x86_64__ && defined __OPTIMIZE__)
+/* Not used for x86-64. */
/* The inline functions do not set errno or raise necessarily the
correct exceptions. */
-# undef math_errhandling
+# undef math_errhandling
/* A macro to define float, double, and long double versions of various
math functions for the ix87 FPU. FUNC is the function name (which will
@@ -162,49 +396,49 @@ __NTH (__signbitl (long double __x))
We define two sets of macros. The set with the additional NP
doesn't add a prototype declaration. */
-#if defined __USE_MISC || defined __USE_ISOC99
-# define __inline_mathop(func, op) \
+# if defined __USE_MISC || defined __USE_ISOC99
+# define __inline_mathop(func, op) \
__inline_mathop_ (double, func, op) \
__inline_mathop_ (float, __CONCAT(func,f), op) \
__inline_mathop_ (long double, __CONCAT(func,l), op)
-# define __inline_mathopNP(func, op) \
+# define __inline_mathopNP(func, op) \
__inline_mathopNP_ (double, func, op) \
__inline_mathopNP_ (float, __CONCAT(func,f), op) \
__inline_mathopNP_ (long double, __CONCAT(func,l), op)
-#else
-# define __inline_mathop(func, op) \
+# else
+# define __inline_mathop(func, op) \
__inline_mathop_ (double, func, op)
-# define __inline_mathopNP(func, op) \
+# define __inline_mathopNP(func, op) \
__inline_mathopNP_ (double, func, op)
-#endif
+# endif
-#define __inline_mathop_(float_type, func, op) \
+# define __inline_mathop_(float_type, func, op) \
__inline_mathop_decl_ (float_type, func, op, "0" (__x))
-#define __inline_mathopNP_(float_type, func, op) \
+# define __inline_mathopNP_(float_type, func, op) \
__inline_mathop_declNP_ (float_type, func, op, "0" (__x))
-#if defined __USE_MISC || defined __USE_ISOC99
-# define __inline_mathop_decl(func, op, params...) \
+# if defined __USE_MISC || defined __USE_ISOC99
+# define __inline_mathop_decl(func, op, params...) \
__inline_mathop_decl_ (double, func, op, params) \
__inline_mathop_decl_ (float, __CONCAT(func,f), op, params) \
__inline_mathop_decl_ (long double, __CONCAT(func,l), op, params)
-# define __inline_mathop_declNP(func, op, params...) \
+# define __inline_mathop_declNP(func, op, params...) \
__inline_mathop_declNP_ (double, func, op, params) \
__inline_mathop_declNP_ (float, __CONCAT(func,f), op, params) \
__inline_mathop_declNP_ (long double, __CONCAT(func,l), op, params)
-#else
-# define __inline_mathop_decl(func, op, params...) \
+# else
+# define __inline_mathop_decl(func, op, params...) \
__inline_mathop_decl_ (double, func, op, params)
-# define __inline_mathop_declNP(func, op, params...) \
+# define __inline_mathop_declNP(func, op, params...) \
__inline_mathop_declNP_ (double, func, op, params)
-#endif
+# endif
-#define __inline_mathop_decl_(float_type, func, op, params...) \
+# define __inline_mathop_decl_(float_type, func, op, params...) \
__MATH_INLINE float_type func (float_type) __THROW; \
__inline_mathop_declNP_ (float_type, func, op, params)
-#define __inline_mathop_declNP_(float_type, func, op, params...) \
+# define __inline_mathop_declNP_(float_type, func, op, params...) \
__MATH_INLINE float_type __NTH (func (float_type __x)) \
{ \
register float_type __result; \
@@ -213,87 +447,87 @@ __NTH (__signbitl (long double __x))
}
-#if defined __USE_MISC || defined __USE_ISOC99
-# define __inline_mathcode(func, arg, code) \
+# if defined __USE_MISC || defined __USE_ISOC99
+# define __inline_mathcode(func, arg, code) \
__inline_mathcode_ (double, func, arg, code) \
__inline_mathcode_ (float, __CONCAT(func,f), arg, code) \
__inline_mathcode_ (long double, __CONCAT(func,l), arg, code)
-# define __inline_mathcodeNP(func, arg, code) \
+# define __inline_mathcodeNP(func, arg, code) \
__inline_mathcodeNP_ (double, func, arg, code) \
__inline_mathcodeNP_ (float, __CONCAT(func,f), arg, code) \
__inline_mathcodeNP_ (long double, __CONCAT(func,l), arg, code)
-# define __inline_mathcode2(func, arg1, arg2, code) \
+# define __inline_mathcode2(func, arg1, arg2, code) \
__inline_mathcode2_ (double, func, arg1, arg2, code) \
__inline_mathcode2_ (float, __CONCAT(func,f), arg1, arg2, code) \
__inline_mathcode2_ (long double, __CONCAT(func,l), arg1, arg2, code)
-# define __inline_mathcodeNP2(func, arg1, arg2, code) \
+# define __inline_mathcodeNP2(func, arg1, arg2, code) \
__inline_mathcodeNP2_ (double, func, arg1, arg2, code) \
__inline_mathcodeNP2_ (float, __CONCAT(func,f), arg1, arg2, code) \
__inline_mathcodeNP2_ (long double, __CONCAT(func,l), arg1, arg2, code)
-# define __inline_mathcode3(func, arg1, arg2, arg3, code) \
+# define __inline_mathcode3(func, arg1, arg2, arg3, code) \
__inline_mathcode3_ (double, func, arg1, arg2, arg3, code) \
__inline_mathcode3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \
__inline_mathcode3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code)
-# define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \
+# define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \
__inline_mathcodeNP3_ (double, func, arg1, arg2, arg3, code) \
__inline_mathcodeNP3_ (float, __CONCAT(func,f), arg1, arg2, arg3, code) \
__inline_mathcodeNP3_ (long double, __CONCAT(func,l), arg1, arg2, arg3, code)
-#else
-# define __inline_mathcode(func, arg, code) \
+# else
+# define __inline_mathcode(func, arg, code) \
__inline_mathcode_ (double, func, (arg), code)
-# define __inline_mathcodeNP(func, arg, code) \
+# define __inline_mathcodeNP(func, arg, code) \
__inline_mathcodeNP_ (double, func, (arg), code)
-# define __inline_mathcode2(func, arg1, arg2, code) \
+# define __inline_mathcode2(func, arg1, arg2, code) \
__inline_mathcode2_ (double, func, arg1, arg2, code)
-# define __inline_mathcodeNP2(func, arg1, arg2, code) \
+# define __inline_mathcodeNP2(func, arg1, arg2, code) \
__inline_mathcodeNP2_ (double, func, arg1, arg2, code)
-# define __inline_mathcode3(func, arg1, arg2, arg3, code) \
+# define __inline_mathcode3(func, arg1, arg2, arg3, code) \
__inline_mathcode3_ (double, func, arg1, arg2, arg3, code)
-# define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \
+# define __inline_mathcodeNP3(func, arg1, arg2, arg3, code) \
__inline_mathcodeNP3_ (double, func, arg1, arg2, arg3, code)
-#endif
+# endif
-#define __inline_mathcode_(float_type, func, arg, code) \
+# define __inline_mathcode_(float_type, func, arg, code) \
__MATH_INLINE float_type func (float_type) __THROW; \
__inline_mathcodeNP_(float_type, func, arg, code)
-#define __inline_mathcodeNP_(float_type, func, arg, code) \
+# define __inline_mathcodeNP_(float_type, func, arg, code) \
__MATH_INLINE float_type __NTH (func (float_type arg)) \
{ \
code; \
}
-#define __inline_mathcode2_(float_type, func, arg1, arg2, code) \
+# define __inline_mathcode2_(float_type, func, arg1, arg2, code) \
__MATH_INLINE float_type func (float_type, float_type) __THROW; \
__inline_mathcodeNP2_ (float_type, func, arg1, arg2, code)
-#define __inline_mathcodeNP2_(float_type, func, arg1, arg2, code) \
+# define __inline_mathcodeNP2_(float_type, func, arg1, arg2, code) \
__MATH_INLINE float_type __NTH (func (float_type arg1, float_type arg2)) \
{ \
code; \
}
-#define __inline_mathcode3_(float_type, func, arg1, arg2, arg3, code) \
+# define __inline_mathcode3_(float_type, func, arg1, arg2, arg3, code) \
__MATH_INLINE float_type func (float_type, float_type, float_type) __THROW; \
__inline_mathcodeNP3_(float_type, func, arg1, arg2, arg3, code)
-#define __inline_mathcodeNP3_(float_type, func, arg1, arg2, arg3, code) \
+# define __inline_mathcodeNP3_(float_type, func, arg1, arg2, arg3, code) \
__MATH_INLINE float_type __NTH (func (float_type arg1, float_type arg2, \
float_type arg3)) \
{ \
code; \
}
-#endif
+# endif
-#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
-/* Miscellaneous functions */
+# if !defined __x86_64__ && !defined __NO_MATH_INLINES && defined __OPTIMIZE__
+/* Miscellaneous functions. Not used by x86-64. */
/* __FAST_MATH__ is defined by gcc -ffast-math. */
-#ifdef __FAST_MATH__
-# ifdef __USE_GNU
-# define __sincos_code \
+# ifdef __FAST_MATH__
+# ifdef __USE_GNU
+# define __sincos_code \
register long double __cosr; \
register long double __sinr; \
register unsigned int __swtmp; \
@@ -333,19 +567,19 @@ __NTH (__sincosl (long double __x, long double *__sinx, long double *__cosx))
{
__sincos_code;
}
-# endif
+# endif
/* Optimized inline implementation, sometimes with reduced precision
and/or argument range. */
-# if __GNUC_PREREQ (3, 5)
-# define __expm1_code \
+# if __GNUC_PREREQ (3, 5)
+# define __expm1_code \
register long double __temp; \
__temp = __builtin_expm1l (__x); \
return __temp ? __temp : __x
-# else
-# define __expm1_code \
+# else
+# define __expm1_code \
register long double __value; \
register long double __exponent; \
register long double __temp; \
@@ -365,13 +599,13 @@ __NTH (__sincosl (long double __x, long double *__sinx, long double *__cosx))
__temp -= 1.0; \
__temp += __value; \
return __temp ? __temp : __x
-# endif
+# endif
__inline_mathcodeNP_ (long double, __expm1l, __x, __expm1_code)
-# if __GNUC_PREREQ (3, 4)
+# if __GNUC_PREREQ (3, 4)
__inline_mathcodeNP_ (long double, __expl, __x, return __builtin_expl (__x))
-# else
-# define __exp_code \
+# else
+# define __exp_code \
register long double __value; \
register long double __exponent; \
__asm __volatile__ \
@@ -390,10 +624,10 @@ __inline_mathcodeNP_ (long double, __expl, __x, return __builtin_expl (__x))
return __value
__inline_mathcodeNP (exp, __x, __exp_code)
__inline_mathcodeNP_ (long double, __expl, __x, __exp_code)
-# endif
+# endif
-# if !__GNUC_PREREQ (3, 5)
+# if !__GNUC_PREREQ (3, 5)
__inline_mathcodeNP (tan, __x, \
register long double __value; \
register long double __value2 __attribute__ ((__unused__)); \
@@ -401,28 +635,28 @@ __inline_mathcodeNP (tan, __x, \
("fptan" \
: "=t" (__value2), "=u" (__value) : "0" (__x)); \
return __value)
-# endif
-#endif /* __FAST_MATH__ */
+# endif
+# endif /* __FAST_MATH__ */
-#if __GNUC_PREREQ (3, 4)
+# if __GNUC_PREREQ (3, 4)
__inline_mathcodeNP2_ (long double, __atan2l, __y, __x,
return __builtin_atan2l (__y, __x))
-#else
-# define __atan2_code \
+# else
+# define __atan2_code \
register long double __value; \
__asm __volatile__ \
("fpatan" \
: "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); \
return __value
-# ifdef __FAST_MATH__
+# ifdef __FAST_MATH__
__inline_mathcodeNP2 (atan2, __y, __x, __atan2_code)
-# endif
+# endif
__inline_mathcodeNP2_ (long double, __atan2l, __y, __x, __atan2_code)
-#endif
+# endif
-#if defined __FAST_MATH__ && !__GNUC_PREREQ (3, 5)
+# if defined __FAST_MATH__ && !__GNUC_PREREQ (3, 5)
__inline_mathcodeNP2 (fmod, __x, __y, \
register long double __value; \
__asm __volatile__ \
@@ -432,52 +666,52 @@ __inline_mathcodeNP2 (fmod, __x, __y, \
"jp 1b" \
: "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); \
return __value)
-#endif
+# endif
-#ifdef __FAST_MATH__
-# if !__GNUC_PREREQ (3,3)
+# ifdef __FAST_MATH__
+# if !__GNUC_PREREQ (3,3)
__inline_mathopNP (sqrt, "fsqrt")
__inline_mathopNP_ (long double, __sqrtl, "fsqrt")
-# define __libc_sqrtl(n) __sqrtl (n)
-# else
-# define __libc_sqrtl(n) __builtin_sqrtl (n)
-# endif
-#endif
+# define __libc_sqrtl(n) __sqrtl (n)
+# else
+# define __libc_sqrtl(n) __builtin_sqrtl (n)
+# endif
+# endif
-#if __GNUC_PREREQ (2, 8)
+# if __GNUC_PREREQ (2, 8)
__inline_mathcodeNP_ (double, fabs, __x, return __builtin_fabs (__x))
-# if defined __USE_MISC || defined __USE_ISOC99
+# if defined __USE_MISC || defined __USE_ISOC99
__inline_mathcodeNP_ (float, fabsf, __x, return __builtin_fabsf (__x))
__inline_mathcodeNP_ (long double, fabsl, __x, return __builtin_fabsl (__x))
-# endif
+# endif
__inline_mathcodeNP_ (long double, __fabsl, __x, return __builtin_fabsl (__x))
-#else
+# else
__inline_mathop (fabs, "fabs")
__inline_mathop_ (long double, __fabsl, "fabs")
-#endif
+# endif
-#ifdef __FAST_MATH__
-# if !__GNUC_PREREQ (3, 4)
+# ifdef __FAST_MATH__
+# if !__GNUC_PREREQ (3, 4)
/* The argument range of this inline version is reduced. */
__inline_mathopNP (sin, "fsin")
/* The argument range of this inline version is reduced. */
__inline_mathopNP (cos, "fcos")
__inline_mathop_declNP (log, "fldln2; fxch; fyl2x", "0" (__x) : "st(1)")
-# endif
+# endif
-# if !__GNUC_PREREQ (3, 5)
+# if !__GNUC_PREREQ (3, 5)
__inline_mathop_declNP (log10, "fldlg2; fxch; fyl2x", "0" (__x) : "st(1)")
__inline_mathcodeNP (asin, __x, return __atan2l (__x, __libc_sqrtl (1.0 - __x * __x)))
__inline_mathcodeNP (acos, __x, return __atan2l (__libc_sqrtl (1.0 - __x * __x), __x))
-# endif
+# endif
-# if !__GNUC_PREREQ (3, 4)
+# if !__GNUC_PREREQ (3, 4)
__inline_mathop_declNP (atan, "fld1; fpatan", "0" (__x) : "st(1)")
-# endif
-#endif /* __FAST_MATH__ */
+# endif
+# endif /* __FAST_MATH__ */
__inline_mathcode_ (long double, __sgn1l, __x, \
__extension__ union { long double __xld; unsigned int __xi[3]; } __n = \
@@ -488,7 +722,7 @@ __inline_mathcode_ (long double, __sgn1l, __x, \
return __n.__xld)
-#ifdef __FAST_MATH__
+# ifdef __FAST_MATH__
/* The argument range of the inline version of sinhl is slightly reduced. */
__inline_mathcodeNP (sinh, __x, \
register long double __exm1 = __expm1l (__fabsl (__x)); \
@@ -501,7 +735,7 @@ __inline_mathcodeNP (cosh, __x, \
__inline_mathcodeNP (tanh, __x, \
register long double __exm1 = __expm1l (-__fabsl (__x + __x)); \
return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x))
-#endif
+# endif
__inline_mathcodeNP (floor, __x, \
register long double __value; \
@@ -539,8 +773,8 @@ __inline_mathcodeNP (ceil, __x, \
: "0" (__x)); \
return __value)
-#ifdef __FAST_MATH__
-# define __ldexp_code \
+# ifdef __FAST_MATH__
+# define __ldexp_code \
register long double __value; \
__asm __volatile__ \
("fscale" \
@@ -552,20 +786,20 @@ __NTH (ldexp (double __x, int __y))
{
__ldexp_code;
}
-#endif
+# endif
/* Optimized versions for some non-standardized functions. */
-#if defined __USE_ISOC99 || defined __USE_MISC
+# if defined __USE_ISOC99 || defined __USE_MISC
-# ifdef __FAST_MATH__
+# ifdef __FAST_MATH__
__inline_mathcodeNP (expm1, __x, __expm1_code)
/* We cannot rely on M_SQRT being defined. So we do it for ourself
here. */
-# define __M_SQRT2 1.41421356237309504880L /* sqrt(2) */
+# define __M_SQRT2 1.41421356237309504880L /* sqrt(2) */
-# if !__GNUC_PREREQ (3, 5)
+# if !__GNUC_PREREQ (3, 5)
__inline_mathcodeNP (log1p, __x, \
register long double __value; \
if (__fabsl (__x) >= 1.0 - 0.5 * __M_SQRT2) \
@@ -577,7 +811,7 @@ __inline_mathcodeNP (log1p, __x, \
"fyl2xp1" \
: "=t" (__value) : "0" (__x) : "st(1)"); \
return __value)
-# endif
+# endif
/* The argument range of the inline version of asinhl is slightly reduced. */
@@ -597,7 +831,7 @@ __inline_mathcodeNP (atanh, __x, \
__inline_mathcodeNP2 (hypot, __x, __y,
return __libc_sqrtl (__x * __x + __y * __y))
-# if !__GNUC_PREREQ (3, 5)
+# if !__GNUC_PREREQ (3, 5)
__inline_mathcodeNP(logb, __x, \
register long double __value; \
register long double __junk; \
@@ -605,17 +839,17 @@ __inline_mathcodeNP(logb, __x, \
("fxtract\n\t" \
: "=t" (__junk), "=u" (__value) : "0" (__x)); \
return __value)
-# endif
+# endif
-# endif
-#endif
+# endif
+# endif
-#ifdef __USE_ISOC99
-# ifdef __FAST_MATH__
+# ifdef __USE_ISOC99
+# ifdef __FAST_MATH__
-# if !__GNUC_PREREQ (3, 5)
+# if !__GNUC_PREREQ (3, 5)
__inline_mathop_declNP (log2, "fld1; fxch; fyl2x", "0" (__x) : "st(1)")
-# endif
+# endif
__MATH_INLINE float
__NTH (ldexpf (float __x, int __y))
@@ -630,9 +864,9 @@ __NTH (ldexpl (long double __x, int __y))
}
__inline_mathopNP (rint, "frndint")
-# endif /* __FAST_MATH__ */
+# endif /* __FAST_MATH__ */
-# define __lrint_code \
+# define __lrint_code \
long int __lrintres; \
__asm__ __volatile__ \
("fistpl %0" \
@@ -653,9 +887,9 @@ __NTH (lrintl (long double __x))
{
__lrint_code;
}
-# undef __lrint_code
+# undef __lrint_code
-# define __llrint_code \
+# define __llrint_code \
long long int __llrintres; \
__asm__ __volatile__ \
("fistpll %0" \
@@ -676,14 +910,14 @@ __NTH (llrintl (long double __x))
{
__llrint_code;
}
-# undef __llrint_code
+# undef __llrint_code
-#endif
+# endif
-#ifdef __USE_MISC
+# ifdef __USE_MISC
-# if defined __FAST_MATH__ && !__GNUC_PREREQ (3, 5)
+# if defined __FAST_MATH__ && !__GNUC_PREREQ (3, 5)
__inline_mathcodeNP2 (drem, __x, __y, \
register double __value; \
register int __clobbered; \
@@ -694,7 +928,7 @@ __inline_mathcodeNP2 (drem, __x, __y, \
"jp 1b" \
: "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); \
return __value)
-# endif
+# endif
/* This function is used in the `isfinite' macro. */
@@ -706,21 +940,21 @@ __NTH (__finite (double __x))
| 0x800fffffu) + 1) >> 31));
}
-#endif /* __USE_MISC */
+# endif /* __USE_MISC */
/* Undefine some of the large macros which are not used anymore. */
-#undef __atan2_code
-#ifdef __FAST_MATH__
-# undef __expm1_code
-# undef __exp_code
-# undef __sincos_code
-#endif /* __FAST_MATH__ */
+# undef __atan2_code
+# ifdef __FAST_MATH__
+# undef __expm1_code
+# undef __exp_code
+# undef __sincos_code
+# endif /* __FAST_MATH__ */
-#endif /* __NO_MATH_INLINES */
+# endif /* __NO_MATH_INLINES */
-/* This code is used internally in the GNU libc. */
-#ifdef __LIBC_INTERNAL_MATH_INLINES
+/* This code is used internally in the GNU libc. Not used by x86-64. */
+# if !defined __x86_64__ && defined __LIBC_INTERNAL_MATH_INLINES
__inline_mathop (__ieee754_sqrt, "fsqrt")
__inline_mathcode2 (__ieee754_atan2, __y, __x,
register long double __value;
@@ -728,6 +962,6 @@ __inline_mathcode2 (__ieee754_atan2, __y, __x,
: "=t" (__value)
: "0" (__x), "u" (__y) : "st(1)");
return __value;)
-#endif
+# endif
#endif /* __GNUC__ */
diff --git a/sysdeps/x86_64/fpu/Implies b/sysdeps/x86_64/fpu/Implies
new file mode 100644
index 0000000..2b745a3
--- /dev/null
+++ b/sysdeps/x86_64/fpu/Implies
@@ -0,0 +1 @@
+x86/fpu
diff --git a/sysdeps/x86_64/fpu/bits/fenv.h b/sysdeps/x86_64/fpu/bits/fenv.h
deleted file mode 100644
index bb790c9..0000000
--- a/sysdeps/x86_64/fpu/bits/fenv.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Copyright (C) 1997-2001,2004,2011,2012 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 _FENV_H
-# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
-#endif
-
-/* Define bits representing the exception. We use the bit positions
- of the appropriate bits in the FPU control word. */
-enum
- {
- FE_INVALID = 0x01,
-#define FE_INVALID FE_INVALID
- __FE_DENORM = 0x02,
- FE_DIVBYZERO = 0x04,
-#define FE_DIVBYZERO FE_DIVBYZERO
- FE_OVERFLOW = 0x08,
-#define FE_OVERFLOW FE_OVERFLOW
- FE_UNDERFLOW = 0x10,
-#define FE_UNDERFLOW FE_UNDERFLOW
- FE_INEXACT = 0x20
-#define FE_INEXACT FE_INEXACT
- };
-
-#define FE_ALL_EXCEPT \
- (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
-
-/* The ix87 FPU supports all of the four defined rounding modes. We
- use again the bit positions in the FPU control word as the values
- for the appropriate macros. */
-enum
- {
- FE_TONEAREST = 0,
-#define FE_TONEAREST FE_TONEAREST
- FE_DOWNWARD = 0x400,
-#define FE_DOWNWARD FE_DOWNWARD
- FE_UPWARD = 0x800,
-#define FE_UPWARD FE_UPWARD
- FE_TOWARDZERO = 0xc00
-#define FE_TOWARDZERO FE_TOWARDZERO
- };
-
-
-/* Type representing exception flags. */
-typedef unsigned short int fexcept_t;
-
-
-/* Type representing floating-point environment. This structure
- corresponds to the layout of the block written by the `fstenv'
- instruction and has additional fields for the contents of the MXCSR
- register as written by the `stmxcsr' instruction. */
-typedef struct
- {
- unsigned short int __control_word;
- unsigned short int __unused1;
- unsigned short int __status_word;
- unsigned short int __unused2;
- unsigned short int __tags;
- unsigned short int __unused3;
- unsigned int __eip;
- unsigned short int __cs_selector;
- unsigned int __opcode:11;
- unsigned int __unused4:5;
- unsigned int __data_offset;
- unsigned short int __data_selector;
- unsigned short int __unused5;
-#ifdef __x86_64__
- unsigned int __mxcsr;
-#endif
- }
-fenv_t;
-
-/* If the default argument is used we use this value. */
-#define FE_DFL_ENV ((const fenv_t *) -1)
-
-#ifdef __USE_GNU
-/* Floating-point environment where none of the exception is masked. */
-# define FE_NOMASK_ENV ((const fenv_t *) -2)
-#endif
-
-
-#ifdef __USE_EXTERN_INLINES
-__BEGIN_DECLS
-
-/* Optimized versions. */
-extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), feraiseexcept);
-__extern_inline int
-__NTH (feraiseexcept (int __excepts))
-{
- if (__builtin_constant_p (__excepts)
- && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0)
- {
- if ((FE_INVALID & __excepts) != 0)
- {
- /* One example of a invalid operation is 0.0 / 0.0. */
- float __f = 0.0;
-
- __asm__ __volatile__ ("divss %0, %0 " : : "x" (__f));
- (void) &__f;
- }
- if ((FE_DIVBYZERO & __excepts) != 0)
- {
- float __f = 1.0;
- float __g = 0.0;
-
- __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
- (void) &__f;
- }
-
- return 0;
- }
-
- return __feraiseexcept_renamed (__excepts);
-}
-
-__END_DECLS
-#endif
diff --git a/sysdeps/x86_64/fpu/bits/mathinline.h b/sysdeps/x86_64/fpu/bits/mathinline.h
deleted file mode 100644
index 7cfe688..0000000
--- a/sysdeps/x86_64/fpu/bits/mathinline.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/* Inline math functions for x86-64.
- Copyright (C) 2002-2012 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 _MATH_H
-# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
-#endif
-
-#ifndef __extern_always_inline
-# define __MATH_INLINE __inline
-#else
-# define __MATH_INLINE __extern_always_inline
-#endif
-
-
-/* The gcc, version 2.7 or below, has problems with all this inlining
- code. So disable it for this version of the compiler. */
-#if __GNUC_PREREQ (2, 8) && defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
-
-/* Test for negative number. Used in the signbit() macro. */
-__MATH_INLINE int
-__NTH (__signbitf (float __x))
-{
-# ifndef __x86_64__
- __extension__ union { float __f; int __i; } __u = { __f: __x };
- return __u.__i < 0;
-# else
- int __m;
- __asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x));
- return __m & 0x8;
-# endif
-}
-__MATH_INLINE int
-__NTH (__signbit (double __x))
-{
-# ifndef __x86_64__
- __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
- return __u.__i[1] < 0;
-# else
- int __m;
- __asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x));
- return __m & 0x80;
-# endif
-}
-__MATH_INLINE int
-__NTH (__signbitl (long double __x))
-{
- __extension__ union { long double __l; int __i[3]; } __u = { __l: __x };
- return __u.__i[2] & 0x8000;
-}
-
-__END_NAMESPACE_C99
-#endif
-
-
-#if __GNUC_PREREQ (2, 8) && !__GNUC_PREREQ (3, 4) \
- && !defined __NO_MATH_INLINES && defined __OPTIMIZE__
-/* GCC 3.4 introduced builtins for all functions below, so
- there's no need to define any of these inline functions. */
-
-# ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
-
-/* Round to nearest integer. */
-# ifdef __SSE_MATH__
-__MATH_INLINE long int
-__NTH (lrintf (float __x))
-{
- long int __res;
- /* Mark as volatile since the result is dependend on the state of
- the SSE control register (the rounding mode). Otherwise GCC might
- remove these assembler instructions since it does not know about
- the rounding mode change and cannot currently be told. */
- __asm __volatile__ ("cvtss2si %1, %0" : "=r" (__res) : "xm" (__x));
- return __res;
-}
-# endif
-# ifdef __SSE2_MATH__
-__MATH_INLINE long int
-__NTH (lrint (double __x))
-{
- long int __res;
- /* Mark as volatile since the result is dependend on the state of
- the SSE control register (the rounding mode). Otherwise GCC might
- remove these assembler instructions since it does not know about
- the rounding mode change and cannot currently be told. */
- __asm __volatile__ ("cvtsd2si %1, %0" : "=r" (__res) : "xm" (__x));
- return __res;
-}
-# endif
-# ifdef __x86_64__
-__MATH_INLINE long long int
-__NTH (llrintf (float __x))
-{
- long long int __res;
- /* Mark as volatile since the result is dependend on the state of
- the SSE control register (the rounding mode). Otherwise GCC might
- remove these assembler instructions since it does not know about
- the rounding mode change and cannot currently be told. */
- __asm __volatile__ ("cvtss2si %1, %0" : "=r" (__res) : "xm" (__x));
- return __res;
-}
-__MATH_INLINE long long int
-__NTH (llrint (double __x))
-{
- long long int __res;
- /* Mark as volatile since the result is dependend on the state of
- the SSE control register (the rounding mode). Otherwise GCC might
- remove these assembler instructions since it does not know about
- the rounding mode change and cannot currently be told. */
- __asm __volatile__ ("cvtsd2si %1, %0" : "=r" (__res) : "xm" (__x));
- return __res;
-}
-# endif
-
-# if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0 \
- && defined __SSE2_MATH__
-/* Determine maximum of two values. */
-__MATH_INLINE float
-__NTH (fmaxf (float __x, float __y))
-{
-# ifdef __AVX__
- float __res;
- __asm ("vmaxss %2, %1, %0" : "=x" (__res) : "x" (x), "xm" (__y));
- return __res;
-# else
- __asm ("maxss %1, %0" : "+x" (__x) : "xm" (__y));
- return __x;
-# endif
-}
-__MATH_INLINE double
-__NTH (fmax (double __x, double __y))
-{
-# ifdef __AVX__
- float __res;
- __asm ("vmaxsd %2, %1, %0" : "=x" (__res) : "x" (x), "xm" (__y));
- return __res;
-# else
- __asm ("maxsd %1, %0" : "+x" (__x) : "xm" (__y));
- return __x;
-# endif
-}
-
-/* Determine minimum of two values. */
-__MATH_INLINE float
-__NTH (fminf (float __x, float __y))
-{
-# ifdef __AVX__
- float __res;
- __asm ("vminss %2, %1, %0" : "=x" (__res) : "x" (x), "xm" (__y));
- return __res;
-# else
- __asm ("minss %1, %0" : "+x" (__x) : "xm" (__y));
- return __x;
-# endif
-}
-__MATH_INLINE double
-__NTH (fmin (double __x, double __y))
-{
-# ifdef __AVX__
- float __res;
- __asm ("vminsd %2, %1, %0" : "=x" (__res) : "x" (x), "xm" (__y));
- return __res;
-# else
- __asm ("minsd %1, %0" : "+x" (__x) : "xm" (__y));
- return __x;
-# endif
-}
-# endif
-
-__END_NAMESPACE_C99
-# endif
-
-# if defined __SSE4_1__ && defined __SSE2_MATH__
-# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
-
-/* Round to nearest integer. */
-__MATH_INLINE double
-__NTH (rint (double __x))
-{
- double __res;
- /* Mark as volatile since the result is dependend on the state of
- the SSE control register (the rounding mode). Otherwise GCC might
- remove these assembler instructions since it does not know about
- the rounding mode change and cannot currently be told. */
- __asm __volatile__ ("roundsd $4, %1, %0" : "=x" (__res) : "xm" (__x));
- return __res;
-}
-__MATH_INLINE float
-__NTH (rintf (float __x))
-{
- float __res;
- /* Mark as volatile since the result is dependend on the state of
- the SSE control register (the rounding mode). Otherwise GCC might
- remove these assembler instructions since it does not know about
- the rounding mode change and cannot currently be told. */
- __asm __volatile__ ("roundss $4, %1, %0" : "=x" (__res) : "xm" (__x));
- return __res;
-}
-
-# ifdef __USE_ISOC99
-/* Round to nearest integer without raising inexact exception. */
-__MATH_INLINE double
-__NTH (nearbyint (double __x))
-{
- double __res;
- /* Mark as volatile since the result is dependend on the state of
- the SSE control register (the rounding mode). Otherwise GCC might
- remove these assembler instructions since it does not know about
- the rounding mode change and cannot currently be told. */
- __asm __volatile__ ("roundsd $0xc, %1, %0" : "=x" (__res) : "xm" (__x));
- return __res;
-}
-__MATH_INLINE float
-__NTH (nearbyintf (float __x))
-{
- float __res;
- /* Mark as volatile since the result is dependend on the state of
- the SSE control register (the rounding mode). Otherwise GCC might
- remove these assembler instructions since it does not know about
- the rounding mode change and cannot currently be told. */
- __asm __volatile__ ("roundss $0xc, %1, %0" : "=x" (__res) : "xm" (__x));
- return __res;
-}
-# endif
-
-__END_NAMESPACE_C99
-# endif
-
-__BEGIN_NAMESPACE_STD
-/* Smallest integral value not less than X. */
-__MATH_INLINE double
-__NTH (ceil (double __x))
-{
- double __res;
- __asm ("roundsd $2, %1, %0" : "=x" (__res) : "xm" (__x));
- return __res;
-}
-__END_NAMESPACE_STD
-
-__BEGIN_NAMESPACE_C99
-__MATH_INLINE float
-__NTH (ceilf (float __x))
-{
- float __res;
- __asm ("roundss $2, %1, %0" : "=x" (__res) : "xm" (__x));
- return __res;
-}
-__END_NAMESPACE_C99
-
-__BEGIN_NAMESPACE_STD
-/* Largest integer not greater than X. */
-__MATH_INLINE double
-__NTH (floor (double __x))
-{
- double __res;
- __asm ("roundsd $1, %1, %0" : "=x" (__res) : "xm" (__x));
- return __res;
-}
-__END_NAMESPACE_STD
-
-__BEGIN_NAMESPACE_C99
-__MATH_INLINE float
-__NTH (floorf (float __x))
-{
- float __res;
- __asm ("roundss $1, %1, %0" : "=x" (__res) : "xm" (__x));
- return __res;
-}
-__END_NAMESPACE_C99
-# endif
-
-#endif
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e545cb1ff97d7329d73b2e98194a4641d6c26d1b
commit e545cb1ff97d7329d73b2e98194a4641d6c26d1b
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed May 30 11:38:38 2012 -0700
Use the same set of header files for x86-64 and i386
diff --git a/ChangeLog b/ChangeLog
index 8cc25ef..e8b2d86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,32 @@
2012-05-31 H.J. Lu <hongjiu.lu@intel.com>
[BZ #14117]
+ * sysdeps/unix/sysv/linux/i386/sys/debugreg.h: Removed.
+ * sysdeps/unix/sysv/linux/i386/sys/io.h: Likewise.
+ * sysdeps/unix/sysv/linux/i386/sys/perm.h: Likewise.
+ * sysdeps/unix/sysv/linux/i386/sys/reg.h: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h: Renamed to ...
+ * sysdeps/unix/sysv/linux/x86/bits/sigcontext.h: This.
+ * sysdeps/unix/sysv/linux/i386/bits/wchar.h: Renamed to ...
+ * sysdeps/unix/sysv/linux/x86/bits/wchar.h: This. Support x86-64.
+ * sysdeps/unix/sysv/linux/x86_64/sys/debugreg.h: Renamed to ...
+ * sysdeps/unix/sysv/linux/x86/sys/debugreg.h: This.
+ * sysdeps/unix/sysv/linux/i386/sys/elf.h: Renamed to ...
+ * sysdeps/unix/sysv/linux/x86/sys/elf.h: This. Support x86-64.
+ * sysdeps/unix/sysv/linux/x86_64/sys/io.h: Renamed to ...
+ * sysdeps/unix/sysv/linux/x86/sys/io.h: This.
+ * sysdeps/unix/sysv/linux/x86_64/sys/perm.h: Renamed to ...
+ * sysdeps/unix/sysv/linux/x86/sys/perm.h: This.
+ * sysdeps/unix/sysv/linux/x86_64/sys/reg.h: Renamed to ...
+ * sysdeps/unix/sysv/linux/x86/sys/reg.h: This.
+ * sysdeps/unix/sysv/linux/i386/sys/vm86.h: Renamed to ...
+ * sysdeps/unix/sysv/linux/x86/sys/vm86.h: This. Support x86-64.
+ * sysdeps/x86_64/bits/string.h: Renamed to ...
+ * sysdeps/x86/bits/string.h: This.
+
+2012-05-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ [BZ #14117]
* sysdeps/unix/sysv/linux/i386/bits/wchar.h: Include
<bits/wordsize.h>.
(__WCHAR_MIN): Support __WORDSIZE == 64.
diff --git a/sysdeps/unix/sysv/linux/i386/sys/debugreg.h b/sysdeps/unix/sysv/linux/i386/sys/debugreg.h
deleted file mode 100644
index ac1926b..0000000
--- a/sysdeps/unix/sysv/linux/i386/sys/debugreg.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Copyright (C) 1998, 2000 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 _SYS_DEBUGREG_H
-#define _SYS_DEBUGREG_H 1
-
-/* Indicate the register numbers for a number of the specific
- debug registers. Registers 0-3 contain the addresses we wish to trap on */
-#define DR_FIRSTADDR 0 /* u_debugreg[DR_FIRSTADDR] */
-#define DR_LASTADDR 3 /* u_debugreg[DR_LASTADDR] */
-
-#define DR_STATUS 6 /* u_debugreg[DR_STATUS] */
-#define DR_CONTROL 7 /* u_debugreg[DR_CONTROL] */
-
-/* Define a few things for the status register. We can use this to determine
- which debugging register was responsible for the trap. The other bits
- are either reserved or not of interest to us. */
-
-#define DR_TRAP0 (0x1) /* db0 */
-#define DR_TRAP1 (0x2) /* db1 */
-#define DR_TRAP2 (0x4) /* db2 */
-#define DR_TRAP3 (0x8) /* db3 */
-
-#define DR_STEP (0x4000) /* single-step */
-#define DR_SWITCH (0x8000) /* task switch */
-
-/* Now define a bunch of things for manipulating the control register.
- The top two bytes of the control register consist of 4 fields of 4
- bits - each field corresponds to one of the four debug registers,
- and indicates what types of access we trap on, and how large the data
- field is that we are looking at */
-
-#define DR_CONTROL_SHIFT 16 /* Skip this many bits in ctl register */
-#define DR_CONTROL_SIZE 4 /* 4 control bits per register */
-
-#define DR_RW_EXECUTE (0x0) /* Settings for the access types to trap on */
-#define DR_RW_WRITE (0x1)
-#define DR_RW_READ (0x3)
-
-#define DR_LEN_1 (0x0) /* Settings for data length to trap on */
-#define DR_LEN_2 (0x4)
-#define DR_LEN_4 (0xC)
-
-/* The low byte to the control register determine which registers are
- enabled. There are 4 fields of two bits. One bit is "local", meaning
- that the processor will reset the bit after a task switch and the other
- is global meaning that we have to explicitly reset the bit. With linux,
- you can use either one, since we explicitly zero the register when we enter
- kernel mode. */
-
-#define DR_LOCAL_ENABLE_SHIFT 0 /* Extra shift to the local enable bit */
-#define DR_GLOBAL_ENABLE_SHIFT 1 /* Extra shift to the global enable bit */
-#define DR_ENABLE_SIZE 2 /* 2 enable bits per register */
-
-#define DR_LOCAL_ENABLE_MASK (0x55) /* Set local bits for all 4 regs */
-#define DR_GLOBAL_ENABLE_MASK (0xAA) /* Set global bits for all 4 regs */
-
-/* The second byte to the control register has a few special things.
-
- On the i386, you should set the DR_LOCAL_SLOWDOWN or
- DR_GLOBAL_SLOWDOWN bits if you want to know exactly which
- instruction triggered the watchpoint. Setting these bits causes
- the processor to run more slowly, but leaving them clear makes it
- treat watchpoint hits as imprecise exceptions, so you can't
- reliably determine which instruction caused the hit.
-
- The i486 and all later IA-32 processors ignore DR_LOCAL_SLOWDOWN
- and DR_GLOBAL_SLOWDOWN. They always report the exception
- precisely, except in some rare cases, which the user can't do
- anything about. */
-
-#define DR_CONTROL_RESERVED (0xFC00) /* Reserved by Intel */
-#define DR_LOCAL_SLOWDOWN (0x100) /* Local slow the pipeline */
-#define DR_GLOBAL_SLOWDOWN (0x200) /* Global slow the pipeline */
-
-#endif /* sys/debugreg.h */
diff --git a/sysdeps/unix/sysv/linux/i386/sys/io.h b/sysdeps/unix/sysv/linux/i386/sys/io.h
deleted file mode 100644
index 3ddcee7..0000000
--- a/sysdeps/unix/sysv/linux/i386/sys/io.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/* Copyright (C) 1996, 2000, 2009 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 _SYS_IO_H
-#define _SYS_IO_H 1
-
-#include <features.h>
-
-__BEGIN_DECLS
-
-/* If TURN_ON is TRUE, request for permission to do direct i/o on the
- port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O
- permission off for that range. This call requires root privileges.
-
- Portability note: not all Linux platforms support this call. Most
- platforms based on the PC I/O architecture probably will, however.
- E.g., Linux/Alpha for Alpha PCs supports this. */
-extern int ioperm (unsigned long int __from, unsigned long int __num,
- int __turn_on) __THROW;
-
-/* Set the I/O privilege level to LEVEL. If LEVEL>3, permission to
- access any I/O port is granted. This call requires root
- privileges. */
-extern int iopl (int __level) __THROW;
-
-#if defined __GNUC__ && __GNUC__ >= 2
-
-static __inline unsigned char
-inb (unsigned short int __port)
-{
- unsigned char _v;
-
- __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (__port));
- return _v;
-}
-
-static __inline unsigned char
-inb_p (unsigned short int __port)
-{
- unsigned char _v;
-
- __asm__ __volatile__ ("inb %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port));
- return _v;
-}
-
-static __inline unsigned short int
-inw (unsigned short int __port)
-{
- unsigned short _v;
-
- __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (__port));
- return _v;
-}
-
-static __inline unsigned short int
-inw_p (unsigned short int __port)
-{
- unsigned short int _v;
-
- __asm__ __volatile__ ("inw %w1,%0\noutb %%al,$0x80":"=a" (_v):"Nd" (__port));
- return _v;
-}
-
-static __inline unsigned int
-inl (unsigned short int __port)
-{
- unsigned int _v;
-
- __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (__port));
- return _v;
-}
-
-static __inline unsigned int
-inl_p (unsigned short int __port)
-{
- unsigned int _v;
- __asm__ __volatile__ ("inl %w1,%0\noutb %%al,$0x80":"=a" (_v)
- :"Nd" (__port));
- return _v;
-}
-
-static __inline void
-outb (unsigned char value, unsigned short int __port)
-{
- __asm__ __volatile__ ("outb %b0,%w1": :"a" (value), "Nd" (__port));
-}
-
-static __inline void
-outb_p (unsigned char value, unsigned short int __port)
-{
- __asm__ __volatile__ ("outb %b0,%w1\noutb %%al,$0x80": :"a" (value),
- "Nd" (__port));
-}
-
-static __inline void
-outw (unsigned short int value, unsigned short int __port)
-{
- __asm__ __volatile__ ("outw %w0,%w1": :"a" (value), "Nd" (__port));
-
-}
-
-static __inline void
-outw_p (unsigned short int value, unsigned short int __port)
-{
- __asm__ __volatile__ ("outw %w0,%w1\noutb %%al,$0x80": :"a" (value),
- "Nd" (__port));
-}
-
-static __inline void
-outl (unsigned int value, unsigned short int __port)
-{
- __asm__ __volatile__ ("outl %0,%w1": :"a" (value), "Nd" (__port));
-}
-
-static __inline void
-outl_p (unsigned int value, unsigned short int __port)
-{
- __asm__ __volatile__ ("outl %0,%w1\noutb %%al,$0x80": :"a" (value),
- "Nd" (__port));
-}
-
-static __inline void
-insb (unsigned short int __port, void *__addr, unsigned long int __count)
-{
- __asm__ __volatile__ ("cld ; rep ; insb":"=D" (__addr), "=c" (__count)
- :"d" (__port), "0" (__addr), "1" (__count));
-}
-
-static __inline void
-insw (unsigned short int __port, void *__addr, unsigned long int __count)
-{
- __asm__ __volatile__ ("cld ; rep ; insw":"=D" (__addr), "=c" (__count)
- :"d" (__port), "0" (__addr), "1" (__count));
-}
-
-static __inline void
-insl (unsigned short int __port, void *__addr, unsigned long int __count)
-{
- __asm__ __volatile__ ("cld ; rep ; insl":"=D" (__addr), "=c" (__count)
- :"d" (__port), "0" (__addr), "1" (__count));
-}
-
-static __inline void
-outsb (unsigned short int __port, const void *__addr,
- unsigned long int __count)
-{
- __asm__ __volatile__ ("cld ; rep ; outsb":"=S" (__addr), "=c" (__count)
- :"d" (__port), "0" (__addr), "1" (__count));
-}
-
-static __inline void
-outsw (unsigned short int __port, const void *__addr,
- unsigned long int __count)
-{
- __asm__ __volatile__ ("cld ; rep ; outsw":"=S" (__addr), "=c" (__count)
- :"d" (__port), "0" (__addr), "1" (__count));
-}
-
-static __inline void
-outsl (unsigned short int __port, const void *__addr,
- unsigned long int __count)
-{
- __asm__ __volatile__ ("cld ; rep ; outsl":"=S" (__addr), "=c" (__count)
- :"d" (__port), "0" (__addr), "1" (__count));
-}
-
-#endif /* GNU C */
-
-__END_DECLS
-#endif /* _SYS_IO_H */
diff --git a/sysdeps/unix/sysv/linux/i386/sys/perm.h b/sysdeps/unix/sysv/linux/i386/sys/perm.h
deleted file mode 100644
index c268681..0000000
--- a/sysdeps/unix/sysv/linux/i386/sys/perm.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1996, 1999 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 _SYS_PERM_H
-
-#define _SYS_PERM_H 1
-#include <features.h>
-
-__BEGIN_DECLS
-
-/* Set port input/output permissions. */
-extern int ioperm (unsigned long int __from, unsigned long int __num,
- int __turn_on) __THROW;
-
-
-/* Change I/O privilege level. */
-extern int iopl (int __level) __THROW;
-
-__END_DECLS
-
-#endif /* _SYS_PERM_H */
diff --git a/sysdeps/unix/sysv/linux/i386/sys/reg.h b/sysdeps/unix/sysv/linux/i386/sys/reg.h
deleted file mode 100644
index b993f99..0000000
--- a/sysdeps/unix/sysv/linux/i386/sys/reg.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright (C) 1998 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 _SYS_REG_H
-#define _SYS_REG_H 1
-
-/* Index into an array of 4 byte integers returned from ptrace for
- * location of the users' stored general purpose registers. */
-
-#define EBX 0
-#define ECX 1
-#define EDX 2
-#define ESI 3
-#define EDI 4
-#define EBP 5
-#define EAX 6
-#define DS 7
-#define ES 8
-#define FS 9
-#define GS 10
-#define ORIG_EAX 11
-#define EIP 12
-#define CS 13
-#define EFL 14
-#define UESP 15
-#define SS 16
-
-#endif /* _SYS_REG_H */
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h b/sysdeps/unix/sysv/linux/x86/bits/sigcontext.h
similarity index 100%
rename from sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
rename to sysdeps/unix/sysv/linux/x86/bits/sigcontext.h
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/debugreg.h b/sysdeps/unix/sysv/linux/x86/sys/debugreg.h
similarity index 100%
rename from sysdeps/unix/sysv/linux/x86_64/sys/debugreg.h
rename to sysdeps/unix/sysv/linux/x86/sys/debugreg.h
diff --git a/sysdeps/unix/sysv/linux/i386/sys/elf.h b/sysdeps/unix/sysv/linux/x86/sys/elf.h
similarity index 100%
rename from sysdeps/unix/sysv/linux/i386/sys/elf.h
rename to sysdeps/unix/sysv/linux/x86/sys/elf.h
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/io.h b/sysdeps/unix/sysv/linux/x86/sys/io.h
similarity index 100%
rename from sysdeps/unix/sysv/linux/x86_64/sys/io.h
rename to sysdeps/unix/sysv/linux/x86/sys/io.h
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/perm.h b/sysdeps/unix/sysv/linux/x86/sys/perm.h
similarity index 100%
rename from sysdeps/unix/sysv/linux/x86_64/sys/perm.h
rename to sysdeps/unix/sysv/linux/x86/sys/perm.h
diff --git a/sysdeps/unix/sysv/linux/x86_64/sys/reg.h b/sysdeps/unix/sysv/linux/x86/sys/reg.h
similarity index 100%
rename from sysdeps/unix/sysv/linux/x86_64/sys/reg.h
rename to sysdeps/unix/sysv/linux/x86/sys/reg.h
diff --git a/sysdeps/unix/sysv/linux/i386/sys/vm86.h b/sysdeps/unix/sysv/linux/x86/sys/vm86.h
similarity index 100%
rename from sysdeps/unix/sysv/linux/i386/sys/vm86.h
rename to sysdeps/unix/sysv/linux/x86/sys/vm86.h
diff --git a/sysdeps/x86_64/bits/string.h b/sysdeps/x86/bits/string.h
similarity index 100%
rename from sysdeps/x86_64/bits/string.h
rename to sysdeps/x86/bits/string.h
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources