File glibc-2.3.3-amd64-string.diff of Package glibc

============================================================
Index: sysdeps/x86_64/strlen.S
===================================================================
--- sysdeps/x86_64/strlen.S.orig
+++ sysdeps/x86_64/strlen.S
@@ -1,139 +1,405 @@
-/* strlen(str) -- determine the length of the string STR.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
-   Based on i486 version contributed by Ulrich Drepper <drepper@redhat.com>.
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include "asm-syntax.h"
-#include "bp-sym.h"
-#include "bp-asm.h"
-
-
-	.text
-ENTRY (strlen)
-	movq %rdi, %rcx		/* Duplicate source pointer. */
-	andl $7, %ecx		/* mask alignment bits */
-	movq %rdi, %rax		/* duplicate destination.  */
-	jz 1f			/* aligned => start loop */
-
-	neg %ecx		/* We need to align to 8 bytes.  */
-	addl $8,%ecx
-	/* Search the first bytes directly.  */
-0:	cmpb $0x0,(%rax)	/* is byte NUL? */
-	je 2f			/* yes => return */
-	incq %rax		/* increment pointer */
-	decl %ecx
-	jnz 0b
-
-1:	movq $0xfefefefefefefeff,%r8 /* Save magic.  */
-
-	.p2align 4		/* Align loop.  */
-4:	/* Main Loop is unrolled 4 times.  */
-	/* First unroll.  */
-	movq (%rax), %rcx	/* get double word (= 8 bytes) in question */
-	addq $8,%rax		/* adjust pointer for next word */
-	movq %r8, %rdx		/* magic value */
-	addq %rcx, %rdx		/* add the magic value to the word.  We get
-				   carry bits reported for each byte which
-				   is *not* 0 */
-	jnc 3f			/* highest byte is NUL => return pointer */
-	xorq %rcx, %rdx		/* (word+magic)^word */
-	orq %r8, %rdx		/* set all non-carry bits */
-	incq %rdx		/* add 1: if one carry bit was *not* set
-				   the addition will not result in 0.  */
-	jnz 3f			/* found NUL => return pointer */
-
-	/* Second unroll.  */
-	movq (%rax), %rcx	/* get double word (= 8 bytes) in question */
-	addq $8,%rax		/* adjust pointer for next word */
-	movq %r8, %rdx		/* magic value */
-	addq %rcx, %rdx		/* add the magic value to the word.  We get
-				   carry bits reported for each byte which
-				   is *not* 0 */
-	jnc 3f			/* highest byte is NUL => return pointer */
-	xorq %rcx, %rdx		/* (word+magic)^word */
-	orq %r8, %rdx		/* set all non-carry bits */
-	incq %rdx		/* add 1: if one carry bit was *not* set
-				   the addition will not result in 0.  */
-	jnz 3f			/* found NUL => return pointer */
-
-	/* Third unroll.  */
-	movq (%rax), %rcx	/* get double word (= 8 bytes) in question */
-	addq $8,%rax		/* adjust pointer for next word */
-	movq %r8, %rdx		/* magic value */
-	addq %rcx, %rdx		/* add the magic value to the word.  We get
-				   carry bits reported for each byte which
-				   is *not* 0 */
-	jnc 3f			/* highest byte is NUL => return pointer */
-	xorq %rcx, %rdx		/* (word+magic)^word */
-	orq %r8, %rdx		/* set all non-carry bits */
-	incq %rdx		/* add 1: if one carry bit was *not* set
-				   the addition will not result in 0.  */
-	jnz 3f			/* found NUL => return pointer */
-
-	/* Fourth unroll.  */
-	movq (%rax), %rcx	/* get double word (= 8 bytes) in question */
-	addq $8,%rax		/* adjust pointer for next word */
-	movq %r8, %rdx		/* magic value */
-	addq %rcx, %rdx		/* add the magic value to the word.  We get
-				   carry bits reported for each byte which
-				   is *not* 0 */
-	jnc 3f			/* highest byte is NUL => return pointer */
-	xorq %rcx, %rdx		/* (word+magic)^word */
-	orq %r8, %rdx		/* set all non-carry bits */
-	incq %rdx		/* add 1: if one carry bit was *not* set
-				   the addition will not result in 0.  */
-	jz 4b			/* no NUL found => continue loop */
-
-	.p2align 4		/* Align, it's a jump target.  */
-3:	subq $8,%rax		/* correct pointer increment.  */
-
-	testb %cl, %cl		/* is first byte NUL? */
-	jz 2f			/* yes => return */
-	incq %rax		/* increment pointer */
-
-	testb %ch, %ch		/* is second byte NUL? */
-	jz 2f			/* yes => return */
-	incq %rax		/* increment pointer */
-
-	testl $0x00ff0000, %ecx /* is third byte NUL? */
-	jz 2f			/* yes => return pointer */
-	incq %rax		/* increment pointer */
-
-	testl $0xff000000, %ecx /* is fourth byte NUL? */
-	jz 2f			/* yes => return pointer */
-	incq %rax		/* increment pointer */
-
-	shrq $32, %rcx		/* look at other half.  */
-
-	testb %cl, %cl		/* is first byte NUL? */
-	jz 2f			/* yes => return */
-	incq %rax		/* increment pointer */
-
-	testb %ch, %ch		/* is second byte NUL? */
-	jz 2f			/* yes => return */
-	incq %rax		/* increment pointer */
-
-	testl $0xff0000, %ecx	/* is third byte NUL? */
-	jz 2f			/* yes => return pointer */
-	incq %rax		/* increment pointer */
-2:
-	subq %rdi, %rax		/* compute difference to string start */
-	ret
+# $Header: /K8_Projects/Glibc/amd64strlen.S 3     10/06/03 11:00 Emenezes $
+
+# (c) 2002 Advanced Micro Devices, Inc.
+# YOUR USE OF THIS CODE IS SUBJECT TO THE TERMS
+# AND CONDITIONS OF THE GNU LESSER GENERAL PUBLIC
+# LICENSE FOUND IN THE "README" FILE THAT IS
+# INCLUDED WITH THIS FILE
+
+#include "sysdep.h"
+#include <rtld-global-offsets.h>
+
+#ifdef PIC
+	.globl _rtld_local_ro
+        .hidden _rtld_local_ro
+        .set    _rtld_local_ro,_rtld_global_ro
+#endif
+        .text
+
+ENTRY   (strlen)                # (const char *s)
+
+        mov     %rdi, %rsi
+        neg     %rdi
+
+L(strlenaligntry):
+        mov     %rsi , %r8
+        and     $7, %r8d
+	jz	L(strlenalignafter)
+
+L(strlenalign):                            # 8-byte align
+        sub     $8, %r8
+
+        .p2align 4
+
+L(strlenalignloop):
+        cmpb    $0, (%rsi)
+        je      L(exit)
+
+        inc     %rsi
+        inc     %r8
+        jnz     L(strlenalignloop)
+
+        .p2align 4
+
+L(strlenalignafter):
+
+L(strlen56try):
+
+L(strlen56):                               # 56-byte
+        mov     (%rsi), %rax
+        mov     $0xfefefefefefefeff, %rcx
+
+L(strlen56loop):
+        mov     %rcx, %r8
+        add     %rax, %r8
+        jnc     L(strlentail)
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        inc     %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        lea     8 (%rsi), %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        jnc     L(strlentail)
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        inc     %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        lea     8 (%rsi), %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        jnc     L(strlentail)
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        inc     %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        lea     8 (%rsi), %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        jnc     L(strlentail)
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        inc     %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        lea     8 (%rsi), %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        jnc     L(strlentail)
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        inc     %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        lea     8 (%rsi), %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        jnc     L(strlentail)
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        inc     %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        lea     8 (%rsi), %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        jnc     L(strlentail)
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        inc     %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        lea     8 (%rsi), %rsi
+
+L(strlen56after):
+
+L(strlen32):                               # 32-byte
+#       mov     $0xfefefefefefefeff, %rcx
+#       mov     (%rsi), %rax
+
+#ifdef PIC
+        mov     _rtld_local_ro@GOTPCREL(%rip), %r8
+	mov	RTLD_GLOBAL_DL_CACHE1SIZE(%r8), %r9
+#else
+        mov     _dl_cache1size, %r9
+#endif
+	
+        .p2align 4
+
+L(strlen32loop):
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        sub     $32, %r9
+
+        mov     8 (%rsi), %rax
+        lea     8 (%rsi), %rsi
+
+        jbe     L(strlen32loop)
+
+L(strlen32after):
+
+L(strlenpretry):
+
+L(strlenpre):                              # 64-byte prefetch
+#       mov     $0xfefefefefefefeff, %rcx
+#       mov     (%rsi), %rax
+
+        .p2align 4
+
+L(strlenpreloop):
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %rdx, %rdx
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %rdx, %r8
+        jnz     L(strlentail)
+
+        prefetcht0 512 (%rsi)
+
+        mov     8 (%rsi), %rax
+        add     $8, %rsi
+
+        jmp     L(strlenpreloop)
+
+        .p2align 4
+
+L(strlenpreafter):
+
+L(strlentailtry):
+
+L(strlentail):                             # 4-byte tail
+
+L(strlentailloop):
+        test    %al, %al
+        jz      L(exit)
+
+        inc     %rsi
+
+        test    %ah, %ah
+        jz      L(exit)
+
+        inc     %rsi
+
+        test    $0x00ff0000, %eax
+        jz      L(exit)
+
+        inc     %rsi
+
+        test    $0xff000000, %eax
+        jz      L(exit)
+
+        inc     %rsi
+
+        shr     $32, %rax
+        jmp     L(strlentailloop)
+
+L(strlentailafter):
+
+        .p2align 4
+
+L(exit):
+        lea     (%rdi, %rsi), %rax
+        ret
+
 END (strlen)
 libc_hidden_builtin_def (strlen)
Index: sysdeps/x86_64/dl-machine.h
===================================================================
--- sysdeps/x86_64/dl-machine.h.orig
+++ sysdeps/x86_64/dl-machine.h
@@ -219,6 +219,40 @@ dl_platform_init (void)
   if (GLRO(dl_platform) != NULL && *GLRO(dl_platform) == '\0')
     /* Avoid an empty string which would disturb us.  */
     GLRO(dl_platform) = NULL;
+
+  long int t1, t2;
+  t1 = 0;
+  t2 = 0;
+  
+  asm (
+       "mov	$0x80000000, %%eax		# get highest level of support\n\t"
+       "cpuid\n\t"
+       "cmp     $0x80000006, %%eax	# check for support of cache info\n\t"
+       "jb      1f\n\t"
+       "mov     $0x80000005, %%eax	# get L1 info\n\t"
+       "cpuid\n\t"
+       "shr     $24, %%ecx\n\t"
+       "shl     $10, %%ecx\n\t"
+       "mov     %%rcx, %0\n\t"
+       "mov     $0x80000006, %%eax    	# get L2 info\n\t"
+       "cpuid\n\t"
+       "shr     $16, %%ecx\n\t"
+       "shl     $10, %%ecx\n\t"
+       "mov     %%rcx, %1\n\t"
+       "1:\n\t"
+       :"=r" (t1), "=r" (t2) :: "%rbx", "%rax", "%rcx", "%rdx"
+       );
+
+  if (t1)
+    {
+      GLRO(dl_cache1size) = t1;
+      GLRO(dl_cache1sizehalf) = t1 / 2;
+    }
+  if (t2)
+    {
+      GLRO(dl_cache2size) = t2;
+      GLRO(dl_cache2sizehalf) = t2 / 2;
+    }
 }
 
 static inline Elf64_Addr
Index: sysdeps/x86_64/Makefile
===================================================================
--- sysdeps/x86_64/Makefile.orig
+++ sysdeps/x86_64/Makefile
@@ -4,6 +4,9 @@ long-double-fcts = yes
 ifeq ($(subdir),csu)
 sysdep_routines += hp-timing
 elide-routines.os += hp-timing
+
+# get offset to rtld_global._dl_*
+gen-as-const-headers += rtld-global-offsets.sym
 endif
 
 ifeq ($(subdir),gmon)
Index: sysdeps/x86_64/strcpy.S
===================================================================
--- sysdeps/x86_64/strcpy.S.orig
+++ sysdeps/x86_64/strcpy.S
@@ -1,159 +1,833 @@
-/* strcpy/stpcpy implementation for x86-64.
-   Copyright (C) 2002 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@suse.de>, 2002.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include "asm-syntax.h"
-#include "bp-sym.h"
-#include "bp-asm.h"
+# $Header: /K8_Projects/Glibc/amd64strcpy.S 7     2/12/04 19:06 Emenezes $
 
-#ifndef USE_AS_STPCPY
+# (c) 2002 Advanced Micro Devices, Inc.
+# YOUR USE OF THIS CODE IS SUBJECT TO THE TERMS
+# AND CONDITIONS OF THE GNU LESSER GENERAL PUBLIC
+# LICENSE FOUND IN THE "README" FILE THAT IS
+# INCLUDED WITH THIS FILE
+
+#include "sysdep.h"
+#include <rtld-global-offsets.h>
+
+	/* XXX:	strncpy is broken, just use this for strcpy for now.  */
+#ifdef PIC
+	.globl _rtld_local_ro
+        .hidden _rtld_local_ro
+        .set    _rtld_local_ro,_rtld_global_ro
+#endif
+#ifndef STRCPY
 # define STRCPY strcpy
 #endif
+#define LABEL(s) L(strcpy##s)
+
+        .text
+
+ENTRY   (STRCPY)                        # (char *, const char *)
+
+#ifdef USE_AS_STRNCPY			// (char *, const char *, size_t)
+	test	%rdx, %rdx		# (char *, const char *, size_t)
+	mov	%rdx, %r11
+	jz	LABEL(exitn)		# early exit
+#endif
+
+        xor     %edx, %edx
+
+LABEL(aligntry):
+        mov     %rsi, %r8		# align by source
+        and     $7, %r8
+	jz	LABEL(alignafter)
+
+LABEL(align):				# 8-byte align
+        sub     $8, %r8
 
-	.text
-ENTRY (BP_SYM (STRCPY))
-	movq %rsi, %rcx		/* Source register. */
-	andl $7, %ecx		/* mask alignment bits */
-	movq %rdi, %rdx		/* Duplicate destination pointer.  */
-
-	jz 5f			/* aligned => start loop */
-
-	neg %ecx		/* We need to align to 8 bytes.  */
-	addl $8,%ecx
-	/* Search the first bytes directly.  */
-0:
-	movb	(%rsi), %al	/* Fetch a byte */
-	testb	%al, %al	/* Is it NUL? */
-	movb	%al, (%rdx)	/* Store it */
-	jz	4f		/* If it was NUL, done! */
-	incq	%rsi
-	incq	%rdx
-	decl	%ecx
-	jnz	0b
-
-5:
-	movq $0xfefefefefefefeff,%r8
-
-	/* Now the sources is aligned.  Unfortunatly we cannot force
-	   to have both source and destination aligned, so ignore the
-	   alignment of the destination.  */
 	.p2align 4
-1:
-	/* 1st unroll.  */
-	movq	(%rsi), %rax	/* Read double word (8 bytes).  */
-	addq	$8, %rsi	/* Adjust pointer for next word.  */
-	movq	%rax, %r9	/* Save a copy for NUL finding.  */
-	addq	%r8, %r9	/* add the magic value to the word.  We get
-				   carry bits reported for each byte which
-				   is *not* 0 */
-	jnc	3f		/* highest byte is NUL => return pointer */
-	xorq	%rax, %r9	/* (word+magic)^word */
-	orq	%r8, %r9	/* set all non-carry bits */
-	incq	%r9		/* add 1: if one carry bit was *not* set
-				   the addition will not result in 0.  */
-
-	jnz	3f		/* found NUL => return pointer */
-
-	movq	%rax, (%rdx)	/* Write value to destination.  */
-	addq	$8, %rdx	/* Adjust pointer.  */
-
-	/* 2nd unroll.  */
-	movq	(%rsi), %rax	/* Read double word (8 bytes).  */
-	addq	$8, %rsi	/* Adjust pointer for next word.  */
-	movq	%rax, %r9	/* Save a copy for NUL finding.  */
-	addq	%r8, %r9	/* add the magic value to the word.  We get
-				   carry bits reported for each byte which
-				   is *not* 0 */
-	jnc	3f		/* highest byte is NUL => return pointer */
-	xorq	%rax, %r9	/* (word+magic)^word */
-	orq	%r8, %r9	/* set all non-carry bits */
-	incq	%r9		/* add 1: if one carry bit was *not* set
-				   the addition will not result in 0.  */
-
-	jnz	3f		/* found NUL => return pointer */
-
-	movq	%rax, (%rdx)	/* Write value to destination.  */
-	addq	$8, %rdx	/* Adjust pointer.  */
-
-	/* 3rd unroll.  */
-	movq	(%rsi), %rax	/* Read double word (8 bytes).  */
-	addq	$8, %rsi	/* Adjust pointer for next word.  */
-	movq	%rax, %r9	/* Save a copy for NUL finding.  */
-	addq	%r8, %r9	/* add the magic value to the word.  We get
-				   carry bits reported for each byte which
-				   is *not* 0 */
-	jnc	3f		/* highest byte is NUL => return pointer */
-	xorq	%rax, %r9	/* (word+magic)^word */
-	orq	%r8, %r9	/* set all non-carry bits */
-	incq	%r9		/* add 1: if one carry bit was *not* set
-				   the addition will not result in 0.  */
-
-	jnz	3f		/* found NUL => return pointer */
-
-	movq	%rax, (%rdx)	/* Write value to destination.  */
-	addq	$8, %rdx	/* Adjust pointer.  */
-
-	/* 4th unroll.  */
-	movq	(%rsi), %rax	/* Read double word (8 bytes).  */
-	addq	$8, %rsi	/* Adjust pointer for next word.  */
-	movq	%rax, %r9	/* Save a copy for NUL finding.  */
-	addq	%r8, %r9	/* add the magic value to the word.  We get
-				   carry bits reported for each byte which
-				   is *not* 0 */
-	jnc	3f		/* highest byte is NUL => return pointer */
-	xorq	%rax, %r9	/* (word+magic)^word */
-	orq	%r8, %r9	/* set all non-carry bits */
-	incq	%r9		/* add 1: if one carry bit was *not* set
-				   the addition will not result in 0.  */
-
-	jnz	3f		/* found NUL => return pointer */
-
-	movq	%rax, (%rdx)	/* Write value to destination.  */
-	addq	$8, %rdx	/* Adjust pointer.  */
-	jmp	1b		/* Next iteration.  */
 
-	/* Do the last few bytes. %rax contains the value to write.
-	   The loop is unrolled twice.  */
+LABEL(alignloop):
+#ifdef USE_AS_STRNCPY
+	dec	%r11
+	jl	LABEL(exitn)
+#endif
+
+        mov     (%rsi, %rdx), %al       # check if same character
+        test    %al, %al                # check if character a NUL
+        mov     %al, (%rdi, %rdx)
+        jz      LABEL(exit)
+
+        inc     %edx
+        inc     %r8
+        jnz     LABEL(alignloop)
+
 	.p2align 4
+
+LABEL(alignafter):
+
+LABEL(8try):
+        mov     $0xfefefefefefefeff, %rcx
+
+LABEL(8):                               # 8-byte
+        mov     (%rsi, %rdx), %rax
+
+LABEL(8loop):
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+LABEL(8after):
+
+LABEL(64try):
+#ifdef PIC
+        mov     _rtld_local_ro@GOTPCREL(%rip), %r8
+	mov	RTLD_GLOBAL_DL_CACHE1SIZEHALF(%r8), %r9
+#else
+        mov     _dl_cache1sizehalf, %r9
+#endif
+
+
+LABEL(64):				# 64-byte
+
+        .p2align 4
+
+LABEL(64loop):
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        cmp     %r9, %rdx
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        lea     8 (%rdx), %rdx
+
+        jbe     LABEL(64loop)
+
+LABEL(64after):
+
+LABEL(pretry):
+#ifdef PIC
+	mov     _rtld_local_ro@GOTPCREL(%rip), %r8
+	mov	RTLD_GLOBAL_DL_CACHE2SIZEHALF(%r8), %r9
+#else
+        mov     _dl_cache2sizehalf, %r9
+#endif
+
+LABEL(pre):                              # 64-byte prefetch
+
+        .p2align 4
+
+LABEL(preloop):
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        mov     %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %edx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(tail)
+
+        cmp     %r9, %rdx
+
+        mov     %rax, (%rdi, %rdx)
+        prefetcht0 512 + 8 (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        prefetcht0 512 + 8 (%rsi, %rdx)
+        lea     8 (%rdx), %rdx
+
+        jb	LABEL(preloop)
+
+        .p2align 4
+
+LABEL(preafter):
+
+LABEL(NTtry):
+	sfence
+
+LABEL(NT):				# 64-byte NT
+
+        .p2align 4
+
+LABEL(NTloop):
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(NTtail)
+
+        movnti  %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %rdx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(NTtail)
+
+        movnti  %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %rdx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(NTtail)
+
+        movnti  %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %rdx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(NTtail)
+
+        movnti  %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %rdx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(NTtail)
+
+        movnti  %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %rdx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(NTtail)
+
+        movnti  %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %rdx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(NTtail)
+
+        movnti  %rax, (%rdi, %rdx)
+        mov     8 (%rsi, %rdx), %rax
+        add     $8, %rdx
+
+#ifdef USE_AS_STRNCPY
+	sub	$8, %r11
+	jl	LABEL(tail)
+#endif
+
+        mov     %rcx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        xor     %rax, %r8
+        or      %rcx, %r8
+        sub     %r10, %r8
+        jnz     LABEL(NTtail)
+
+        movnti  %rax, (%rdi, %rdx)
+	mov     8 (%rsi, %rdx), %rax
+	prefetchnta 768 + 8 (%rsi, %rdx)
+        add     $8, %rdx
+
+        jmp     LABEL(NTloop)
+
+        .p2align 4
+
+LABEL(NTtail):
+	sfence
+
+        .p2align 4
+
+LABEL(NTafter):
+
+LABEL(tailtry):
+
+LABEL(tail):                             # 1-byte tail
+#ifdef USE_AS_STRNCPY
+	add	$8, %r11
+#endif
+
+        .p2align 4
+
+LABEL(tailloop):
+#ifdef USE_AS_STRNCPY
+	dec	%r11
+	jl	LABEL(exitn)
+#endif
+
+        test    %al, %al
+        mov     %al, (%rdi, %rdx)
+        jz      LABEL(exit)
+
+	inc     %rdx
+
+#ifdef USE_AS_STRNCPY
+	dec	%r11
+	jl	LABEL(exitn)
+
+	mov	%ah, %al
+#endif
+
+        test    %ah, %ah
+        mov     %ah, (%rdi, %rdx)
+        jz      LABEL(exit)
+
+        inc     %rdx
+
+#ifdef USE_AS_STRNCPY
+	dec	%r11
+	jl	LABEL(exitn)
+#endif
+
+        shr     $16, %rax
+
+        test    %al, %al
+        mov     %al, (%rdi, %rdx)
+        jz      LABEL(exit)
+
+        inc     %rdx
+
+#ifdef USE_AS_STRNCPY
+	dec	%r11
+	jl	LABEL(exitn)
+
+	mov	%ah, %al
+#endif
+
+        test    %ah, %ah
+        mov     %ah, (%rdi, %rdx)
+        jz      LABEL(exit)
+
+        shr     $16, %rax
+        inc     %rdx
+
+        jmp     LABEL(tailloop)
+
+        .p2align 4
+
+LABEL(tailafter):
+
+LABEL(exit):
+#ifdef USE_AS_STRNCPY
+	test	%r11, %r11
+	mov	%r11, %rcx
+
+#ifdef USE_AS_STPCPY
+        lea     (%rdi, %rdx), %r8
+#else
+        mov     %rdi, %r8
+#endif
+
+	jz	2f
+
+	xor	%eax, %eax		# bzero () would do too, but usually there are only a handfull of bytes left
+	shr	$3, %rcx
+        lea     1 (%rdi, %rdx), %rdi
+	jz	1f
+
+	rep	stosq
+
+1:
+	mov	%r11d, %ecx
+	and	$7, %ecx
+	jz	2f
+
+        .p2align 4,, 3
+
 3:
-	/* Note that stpcpy needs to return with the value of the NUL
-	   byte.  */
-	movb	%al, (%rdx)	/* 1st byte.  */
-	testb	%al, %al	/* Is it NUL.  */
-	jz	4f		/* yes, finish.  */
-	incq	%rdx		/* Increment destination.  */
-	movb	%ah, (%rdx)	/* 2nd byte.  */
-	testb	%ah, %ah	/* Is it NUL?.  */
-	jz	4f		/* yes, finish.  */
-	incq	%rdx		/* Increment destination.  */
-	shrq	$16, %rax	/* Shift...  */
-	jmp	3b		/* and look at next two bytes in %rax.  */
+	dec	%ecx
+	mov	%al, (%rdi, %rcx)
+	jnz	3b
+
+        .p2align 4,, 3
+
+2:
+	mov	%r8, %rax
+        ret
+	
+#endif
+
+        .p2align 4
 
-4:
+LABEL(exitn):
 #ifdef USE_AS_STPCPY
-	movq	%rdx, %rax	/* Destination is return value.  */
+        lea     (%rdi, %rdx), %rax
 #else
-	movq	%rdi, %rax	/* Source is return value.  */
+        mov     %rdi, %rax
 #endif
-	retq
-END (BP_SYM (STRCPY))
-#ifndef USE_AS_STPCPY
-libc_hidden_builtin_def (strcpy)
+
+        ret
+
+END (STRCPY)
+#if !defined USE_AS_STPCPY && !defined USE_AS_STRNCPY
+libc_hidden_builtin_def (STRCPY)
 #endif
Index: sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c
===================================================================
--- sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c.orig
+++ sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c
@@ -1,5 +1,5 @@
 #ifdef IS_IN_ldconfig
 # include <sysdeps/i386/dl-procinfo.c>
 #else
-# include <sysdeps/generic/dl-procinfo.c>
+# include <sysdeps/x86_64/dl-procinfo.c>
 #endif
Index: sysdeps/x86_64/dl-procinfo.c
===================================================================
--- /dev/null
+++ sysdeps/x86_64/dl-procinfo.c
@@ -0,0 +1,108 @@
+/* Data for x86-64 version of processor capability information.
+   Copyright (C) 2004 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Jaeger <aj@suse.de>, 2004.
+
+   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, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This information must be kept in sync with the _DL_HWCAP_COUNT and
+   _DL_PLATFORM_COUNT definitions in procinfo.h.
+
+   If anything should be added here check whether the size of each string
+   is still ok with the given array size.
+
+   All the #ifdefs in the definitions ar equite irritating but
+   necessary if we want to avoid duplicating the information.  There
+   are three different modes:
+
+   - PROCINFO_DECL is defined.  This means we are only interested in
+     declarations.
+
+   - PROCINFO_DECL is not defined:
+
+     + if SHARED is defined the file is included in an array
+       initializer.  The .element = { ... } syntax is needed.
+
+     + if SHARED is not defined a normal array initialization is
+       needed.
+  */
+
+#ifndef PROCINFO_CLASS
+#define PROCINFO_CLASS
+#endif
+
+  /* _dl_cache1size: size of L1 cache  */
+#if !defined PROCINFO_DECL && defined SHARED
+  ._dl_cache1size
+#else
+PROCINFO_CLASS long int _dl_cache1size
+#endif
+#ifndef PROCINFO_DECL
+= 1024 * 64
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
+  /* _dl_cache1sizehalf: 1/2 size of L1 cache  */
+#if !defined PROCINFO_DECL && defined SHARED
+  ._dl_cache1sizehalf
+#else
+PROCINFO_CLASS long int _dl_cache1sizehalf
+#endif
+#ifndef PROCINFO_DECL
+= 1024 * 64 / 2
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
+  /* _dl_cache2size: size of L2 cache  */
+#if !defined PROCINFO_DECL && defined SHARED
+  ._dl_cache2size
+#else
+PROCINFO_CLASS long int _dl_cache2size
+#endif
+#ifndef PROCINFO_DECL
+= 1024 * 1024
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
+  /* _dl_cache2size: 1/2 size of L2 cache  */
+#if !defined PROCINFO_DECL && defined SHARED
+  ._dl_cache2sizehalf
+#else
+PROCINFO_CLASS long int _dl_cache2sizehalf
+#endif
+#ifndef PROCINFO_DECL
+= 1024 * 1024 / 2
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
+#undef PROCINFO_DECL
+#undef PROCINFO_CLASS
Index: sysdeps/x86_64/elf/rtld-global-offsets.sym
===================================================================
--- /dev/null
+++ sysdeps/x86_64/elf/rtld-global-offsets.sym
@@ -0,0 +1,10 @@
+#define SHARED 1
+
+#include <ldsodefs.h>
+
+#define rtdl_global_offsetof(mem) offsetof (struct rtld_global_ro, mem)
+
+RTLD_GLOBAL_DL_CACHE1SIZE	rtdl_global_offsetof (_dl_cache1size)
+RTLD_GLOBAL_DL_CACHE1SIZEHALF	rtdl_global_offsetof (_dl_cache1sizehalf)
+RTLD_GLOBAL_DL_CACHE2SIZE	rtdl_global_offsetof (_dl_cache2size)
+RTLD_GLOBAL_DL_CACHE2SIZEHALF	rtdl_global_offsetof (_dl_cache2sizehalf)
Index: sysdeps/x86_64/memcmp.S
===================================================================
--- /dev/null
+++ sysdeps/x86_64/memcmp.S
@@ -0,0 +1,442 @@
+# $Header: /K8_Projects/Glibc/amd64memcmp.S 4     10/06/03 10:57 Emenezes $
+
+# (c) 2002 Advanced Micro Devices, Inc.
+# YOUR USE OF THIS CODE IS SUBJECT TO THE TERMS
+# AND CONDITIONS OF THE GNU LESSER GENERAL PUBLIC
+# LICENSE FOUND IN THE "README" FILE THAT IS
+# INCLUDED WITH THIS FILE
+
+#include "sysdep.h"
+#include <rtld-global-offsets.h>
+
+#ifdef PIC
+	.globl _rtld_local_ro
+        .hidden _rtld_local_ro
+        .set    _rtld_local_ro,_rtld_global_ro
+#endif
+
+        .text
+
+ENTRY   (memcmp)                        # (const void *, const void*, size_t)
+
+L(memcmptry1):
+        cmp     $8, %rdx
+        jae     L(memcmp1after)
+
+L(memcmp1):                                # 1-byte
+        test    %rdx, %rdx
+        mov     $0, %eax
+        jz      L(memcmpexit)
+
+L(memcmp1loop):
+        movzbl  (%rdi), %eax
+        movzbl  (%rsi), %ecx
+        sub     %ecx, %eax
+        jnz     L(memcmpexit)
+
+        dec     %rdx
+
+        lea     1 (%rdi), %rdi
+        lea     1 (%rsi), %rsi
+
+        jnz     L(memcmp1loop)
+
+L(memcmpexit):
+        rep
+        ret
+
+        .p2align 4
+
+L(memcmp1after):
+
+L(memcmp8try):
+        cmp     $32, %rdx
+        jae     L(memcmp8after)
+
+L(memcmp8):                        # 8-byte
+        mov     %edx, %ecx
+        shr     $3, %ecx
+        jz      L(memcmp1)
+
+        .p2align 4
+
+L(memcmp8loop):
+        mov     (%rsi), %rax
+        cmp     (%rdi), %rax
+        jne     L(memcmp1)
+
+        sub     $8, %rdx
+        dec     %ecx
+
+        lea     8 (%rsi), %rsi
+        lea     8 (%rdi), %rdi
+
+        jnz     L(memcmp8loop)
+
+L(memcmp8skip):
+        and     $7, %edx
+        jnz     L(memcmp1)
+
+        xor     %eax, %eax
+        ret
+
+        .p2align 4
+
+L(memcmp8after):
+
+L(memcmp32try):
+        cmp     $2048, %rdx
+        ja      L(memcmp32after)
+
+L(memcmp32):                               # 32-byte
+        mov     %edx, %ecx
+        shr     $5, %ecx
+        jz      L(memcmp8)
+
+        .p2align 4
+
+L(memcmp32loop):
+        mov        (%rsi), %rax
+        mov      8 (%rsi),  %r8
+        mov     16 (%rsi),  %r9
+        mov     24 (%rsi), %r10
+        sub        (%rdi), %rax
+        sub      8 (%rdi),  %r8
+        sub     16 (%rdi),  %r9
+        sub     24 (%rdi), %r10
+
+        or      %rax,  %r8
+        or       %r9, %r10
+        or       %r8, %r10
+        jnz     L(memcmp8)
+
+        sub     $32, %rdx
+        dec     %ecx
+
+        lea     32 (%rsi), %rsi
+        lea     32 (%rdi), %rdi
+
+        jnz     L(memcmp32loop)
+
+L(memcmp32skip):
+        and     $31, %edx
+        jnz     L(memcmp8)
+
+        xor     %eax, %eax
+        ret
+
+        .p2align 4
+
+L(memcmp32after):
+
+#ifdef PIC
+        mov     _rtld_local_ro@GOTPCREL(%rip), %r8
+	mov	RTLD_GLOBAL_DL_CACHE1SIZEHALF(%r8), %r9
+#else
+        mov     _dl_cache1sizehalf, %r9
+#endif
+	prefetcht0 (%r9)
+
+
+.alignsrctry:
+        mov     %esi, %r8d      # align by source
+
+        and     $7, %r8d
+        jz      .alignsrcafter  # not unaligned
+
+.alignsrc:                      # align
+        lea     -8 (%r8, %rdx), %rdx
+        sub     $8, %r8d
+
+#       .p2align 4
+
+.alignsrcloop:
+        movzbl  (%rdi), %eax
+        movzbl  (%rsi), %ecx
+        sub     %ecx, %eax
+        jnz     L(memcmpexit)
+
+        inc     %r8d
+
+        lea     1 (%rdi), %rdi
+        lea     1 (%rsi), %rsi
+
+        jnz     .alignsrcloop
+
+        .p2align 4
+
+.alignsrcafter:
+
+
+L(memcmp64try):
+#ifdef PIC
+        mov     _rtld_local_ro@GOTPCREL(%rip), %r8
+	mov	RTLD_GLOBAL_DL_CACHE1SIZEHALF(%r8), %rcx
+#else
+        mov     _dl_cache1sizehalf, %rcx
+#endif
+        cmp	%rdx, %rcx
+        cmova   %rdx, %rcx
+
+L(memcmp64):                               # 64-byte
+        shr     $6, %rcx
+        jz      L(memcmp32)
+
+        .p2align 4
+
+L(memcmp64loop):
+        mov        (%rsi), %rax
+        mov      8 (%rsi),  %r8
+        sub        (%rdi), %rax
+        sub      8 (%rdi),  %r8
+        or      %r8,  %rax
+
+        mov     16 (%rsi),  %r9
+        mov     24 (%rsi), %r10
+        sub     16 (%rdi),  %r9
+        sub     24 (%rdi), %r10
+        or      %r10, %r9
+
+        or      %r9,  %rax
+        jnz     L(memcmp32)
+
+        mov     32 (%rsi), %rax
+        mov     40 (%rsi),  %r8
+        sub     32 (%rdi), %rax
+        sub     40 (%rdi),  %r8
+        or      %r8,  %rax
+
+        mov     48 (%rsi),  %r9
+        mov     56 (%rsi), %r10
+        sub     48 (%rdi),  %r9
+        sub     56 (%rdi), %r10
+        or      %r10, %r9
+
+        or      %r9,  %rax
+        jnz    	L(memcmp32)
+
+        lea     64 (%rsi), %rsi
+        lea     64 (%rdi), %rdi
+
+        sub     $64, %rdx
+        dec     %rcx
+        jnz     L(memcmp64loop)
+
+#       .p2align 4
+
+L(memcmp64skip):
+        cmp     $2048, %rdx
+        ja     L(memcmp64after)
+
+        test    %edx, %edx
+        jnz     L(memcmp32)
+
+        xor     %eax, %eax
+        ret
+
+        .p2align 4
+
+L(memcmp64after):
+
+L(memcmppretry):
+
+L(memcmppre):                              # 64-byte prefetching
+#ifdef PIC
+        mov     _rtld_local_ro@GOTPCREL(%rip), %r8
+	mov	RTLD_GLOBAL_DL_CACHE2SIZEHALF(%r8), %rcx
+#else
+        mov     _dl_cache2sizehalf, %rcx
+#endif
+        cmp	%rdx, %rcx
+        cmova   %rdx, %rcx
+
+        shr     $6, %rcx
+        jz      L(memcmppreskip)
+
+        prefetcht0 512 (%rsi)
+        prefetcht0 512 (%rdi)
+
+        mov        (%rsi), %rax
+        mov      8 (%rsi), %r9
+        mov     16 (%rsi), %r10
+        mov     24 (%rsi), %r11
+        sub        (%rdi), %rax
+        sub      8 (%rdi), %r9
+        sub     16 (%rdi), %r10
+        sub     24 (%rdi), %r11
+
+        or       %r9, %rax
+        or      %r11, %r10
+        or      %r10, %rax
+        jnz     L(memcmp32)
+
+        mov     32 (%rsi), %rax
+        mov     40 (%rsi), %r9
+        mov     48 (%rsi), %r10
+        mov     56 (%rsi), %r11
+        sub     32 (%rdi), %rax
+        sub     40 (%rdi), %r9
+        sub     48 (%rdi), %r10
+        sub     56 (%rdi), %r11
+
+        or       %r9, %rax
+        or      %r11, %r10
+        or      %r10, %rax
+        jnz     L(memcmp32)
+
+        lea     64 (%rsi), %rsi
+        lea     64 (%rdi), %rdi
+
+        sub     $64, %rdx
+        dec     %rcx
+
+        .p2align 4
+
+L(memcmppreloop):
+        prefetcht0 512 (%rsi)
+        prefetcht0 512 (%rdi)
+
+        mov        (%rsi), %rax
+        mov      8 (%rsi), %r9
+        mov     16 (%rsi), %r10
+        mov     24 (%rsi), %r11
+        sub        (%rdi), %rax
+        sub      8 (%rdi), %r9
+        sub     16 (%rdi), %r10
+        sub     24 (%rdi), %r11
+
+        or       %r9, %rax
+        or      %r11, %r10
+        or      %r10, %rax
+        jnz     L(memcmp32)
+
+        mov     32 (%rsi), %rax
+        mov     40 (%rsi), %r9
+        mov     48 (%rsi), %r10
+        mov     56 (%rsi), %r11
+        sub     32 (%rdi), %rax
+        sub     40 (%rdi), %r9
+        sub     48 (%rdi), %r10
+        sub     56 (%rdi), %r11
+
+        or       %r9, %rax
+        or      %r11, %r10
+        or      %r10, %rax
+        jnz     L(memcmp32)
+
+        lea     64 (%rsi), %rsi
+        lea     64 (%rdi), %rdi
+
+        sub     $64, %rdx
+        dec     %rcx
+        jnz     L(memcmppreloop)
+
+#       .p2align 4
+
+L(memcmppreskip):
+        cmp     $2048, %rdx
+        ja      L(memcmppreafter)
+
+        test    %edx, %edx
+        jnz     L(memcmp32)
+
+        xor     %eax, %eax
+        ret
+
+        .p2align 4
+
+L(memcmppreafter):
+
+L(memcmp128try):
+
+L(memcmp128):                              # 128-byte
+        mov     %rdx, %rcx
+        shr     $7, %rcx
+        jz      L(memcmp128skip)
+
+        .p2align 4
+
+L(memcmp128loop):
+        prefetcht0 512 (%rsi)
+        prefetcht0 512 (%rdi)
+
+        mov        (%rsi), %rax
+        mov      8 (%rsi), %r8
+        sub        (%rdi), %rax
+        sub      8 (%rdi), %r8
+        mov     16 (%rsi), %r9
+        mov     24 (%rsi), %r10
+        sub     16 (%rdi), %r9
+        sub     24 (%rdi), %r10
+
+        or       %r8, %rax
+        or       %r9, %r10
+        or      %r10, %rax
+
+        mov     32 (%rsi), %r8
+        mov     40 (%rsi), %r9
+        sub     32 (%rdi), %r8
+        sub     40 (%rdi), %r9
+        mov     48 (%rsi), %r10
+        mov     56 (%rsi), %r11
+        sub     48 (%rdi), %r10
+        sub     56 (%rdi), %r11
+
+        or       %r9, %r8
+        or      %r11, %r10
+        or      %r10, %r8
+
+        or      %r8, %rax
+        jnz     L(memcmp32)
+
+        prefetcht0 576 (%rsi)
+        prefetcht0 576 (%rdi)
+
+        mov      64 (%rsi), %rax
+        mov      72 (%rsi), %r8
+        sub      64 (%rdi), %rax
+        sub      72 (%rdi), %r8
+        mov      80 (%rsi), %r9
+        mov      88 (%rsi), %r10
+        sub      80 (%rdi), %r9
+        sub      88 (%rdi), %r10
+
+        or       %r8, %rax
+        or       %r9, %r10
+        or      %r10, %rax
+
+        mov      96 (%rsi), %r8
+        mov     104 (%rsi), %r9
+        sub      96 (%rdi), %r8
+        sub     104 (%rdi), %r9
+        mov     112 (%rsi), %r10
+        mov     120 (%rsi), %r11
+        sub     112 (%rdi), %r10
+        sub     120 (%rdi), %r11
+
+        or       %r9, %r8
+        or      %r11, %r10
+        or      %r10, %r8
+
+        or      %r8, %rax
+        jnz     L(memcmp32)
+
+        sub     $128, %rdx
+        dec     %rcx
+
+        lea     128 (%rsi), %rsi
+        lea     128 (%rdi), %rdi
+
+        jnz     L(memcmp128loop)
+
+L(memcmp128skip):
+        and     $127, %edx
+        jnz     L(memcmp32)
+
+        xor     %eax, %eax
+        ret
+
+END     (memcmp)
+
+#undef bcmp
+weak_alias (memcmp, bcmp)
Index: sysdeps/x86_64/strncmp.S
===================================================================
--- /dev/null
+++ sysdeps/x86_64/strncmp.S
@@ -0,0 +1,15 @@
+# $Header: /K8_Projects/Glibc/amd64strncpy.S 1     8/29/03 16:37 Emenezes $
+
+# (c) 2002 Advanced Micro Devices, Inc.
+# YOUR USE OF THIS CODE IS SUBJECT TO THE TERMS
+# AND CONDITIONS OF THE GNU LESSER GENERAL PUBLIC
+# LICENSE FOUND IN THE "README" FILE THAT IS
+# INCLUDED WITH THIS FILE
+
+#define USE_AS_STRNCMP
+#define strcmp strncmp
+
+#include "strcmp.S"
+
+weak_alias (strncmp, __strncmp)
+libc_hidden_builtin_def (strncmp)
Index: sysdeps/x86_64/strcmp.S
===================================================================
--- sysdeps/x86_64/strcmp.S.orig
+++ sysdeps/x86_64/strcmp.S
@@ -1,45 +1,487 @@
-/* Highly optimized version for x86-64.
-   Copyright (C) 1999, 2000, 2002, 2003, 2005 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Based on i686 version contributed by Ulrich Drepper
-   <drepper@cygnus.com>, 1999.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <sysdep.h>
-#include "asm-syntax.h"
-#include "bp-sym.h"
-#include "bp-asm.h"
+# $Header: /K8_Projects/Glibc/amd64strcmp.S 10    2/10/04 11:48 Emenezes $
+
+# (c) 2002 Advanced Micro Devices, Inc.
+# YOUR USE OF THIS CODE IS SUBJECT TO THE TERMS
+# AND CONDITIONS OF THE GNU LESSER GENERAL PUBLIC
+# LICENSE FOUND IN THE "README" FILE THAT IS
+# INCLUDED WITH THIS FILE
+
+#include "sysdep.h"
+
+#define LABEL(s) L##s
 
         .text
-ENTRY (BP_SYM (strcmp))
-L(oop):	movb	(%rdi), %al
-	cmpb	(%rsi), %al
-	jne	L(neq)
-	incq	%rdi
-	incq	%rsi
-	testb	%al, %al
-	jnz	L(oop)
-
-	xorl	%eax, %eax
-	ret
-
-L(neq):	movl	$1, %eax
-	movl	$-1, %ecx
-	cmovbl	%ecx, %eax
-	ret
-END (BP_SYM (strcmp))
+
+ENTRY   (strcmp)			# (const char *, const char *)
+
+        xor     %ecx, %ecx
+
+#ifdef USE_AS_STRNCMP			// (const char *, const char *, size_t)
+        mov	%r14, -8 (%rsp)
+	mov	%rdx, %r14
+
+	test	%rdx, %rdx
+	mov	%edx, %eax
+	jz	.LABEL(exitz)
+#endif
+
+.LABEL(aligntry):
+        mov     %rsi, %r8		# align by "source"
+        and     $8 - 1, %r8		# between 0 and 8 characters compared
+	jz	.LABEL(alignafter)
+
+.LABEL(align):
+        sub     $8, %r8
+
+        .p2align 4
+
+.LABEL(alignloop):
+        mov     (%rsi, %rcx), %al
+        mov	(%rdi, %rcx), %dl
+
+#ifdef USE_AS_STRNCMP
+	dec	%r14
+	jl	.LABEL(exitafter)
+#endif
+
+        cmp     %dl, %al		# check if same character
+        jne     .LABEL(exitafter)
+        test    %al, %al		# check if character a NUL
+        jz      .LABEL(exitafter)
+
+        inc     %ecx
+
+        inc     %r8
+        jnz     .LABEL(alignloop)
+
+        .p2align 4
+
+.LABEL(alignafter):
+
+        mov	%r15, -32 (%rsp)
+        mov	%rbp, -24 (%rsp)
+        mov	%rbx, -16 (%rsp)
+
+.LABEL(pagealigntry):			# page align by "destination"
+	mov	$4096, %r15d		# page size is 4096
+        lea	(%rdi, %rcx), %ebp
+        and     $4095, %ebp		# page mask
+        sub	%r15d, %ebp
+
+.LABEL(64):                              # 64-byte
+	mov     $0xfefefefefefefeff, %rbx # magic number
+
+        .p2align 4
+
+.LABEL(64loop):
+	add	$64, %ebp		# check if "destination" crosses a page unevenly
+	jle	.LABEL(64gobble)
+
+        sub	%r15d, %ebp
+        lea	64 (%rcx), %r8
+
+        .p2align 4
+
+.LABEL(64nibble):
+        mov     (%rsi, %rcx), %al
+        mov	(%rdi, %rcx), %dl
+
+#ifdef USE_AS_STRNCMP
+	dec	%r14
+	jl	.exit
+#endif
+
+        cmp     %dl, %al		# check if same character
+        jne     .exit
+        test    %al, %al		# check if character a NUL
+        jz      .exit
+
+        inc	%ecx
+
+        cmp	%ecx, %r8d
+        ja	.LABEL(64nibble)
+
+        .p2align 4
+
+.LABEL(64gobble):
+        mov     (%rsi, %rcx), %rax
+        mov     (%rdi, %rcx), %rdx
+
+#ifdef USE_AS_STRNCMP
+	sub	$8, %r14
+	jl	.LABEL(tail)
+#endif
+
+        mov     %rbx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        mov     %rbx, %r9
+        add     %rdx, %r9
+        sbb     %r11, %r11
+
+        xor     %rax, %r8
+        or      %rbx, %r8
+        sub     %r10, %r8
+        jnz     .LABEL(tail)
+
+        xor     %rdx, %r9
+        or      %rbx, %r9
+        sub     %r11, %r9
+        jnz     .LABEL(tail)
+
+        cmp     %rdx, %rax
+        jne     .LABEL(tail)
+
+        mov     8 (%rsi, %rcx), %rax
+        mov     8 (%rdi, %rcx), %rdx
+        add     $8, %ecx
+
+#ifdef USE_AS_STRNCMP
+	sub	$8, %r14
+	jl	.LABEL(tail)
+#endif
+
+        mov     %rbx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        mov     %rbx, %r9
+        add     %rdx, %r9
+        sbb     %r11, %r11
+
+        xor     %rax, %r8
+        or      %rbx, %r8
+        sub     %r10, %r8
+        jnz     .LABEL(tail)
+
+        xor     %rdx, %r9
+        or      %rbx, %r9
+        sub     %r11, %r9
+        jnz     .LABEL(tail)
+
+        cmp     %rdx, %rax
+        jne     .LABEL(tail)
+
+        mov     8 (%rsi, %rcx), %rax
+        mov     8 (%rdi, %rcx), %rdx
+        add     $8, %ecx
+
+#ifdef USE_AS_STRNCMP
+	sub	$8, %r14
+	jl	.LABEL(tail)
+#endif
+
+        mov     %rbx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        mov     %rbx, %r9
+        add     %rdx, %r9
+        sbb     %r11, %r11
+
+        xor     %rax, %r8
+        or      %rbx, %r8
+        sub     %r10, %r8
+        jnz     .LABEL(tail)
+
+        xor     %rdx, %r9
+        or      %rbx, %r9
+        sub     %r11, %r9
+        jnz     .LABEL(tail)
+
+        cmp     %rdx, %rax
+        jne     .LABEL(tail)
+
+        mov     8 (%rsi, %rcx), %rax
+        mov     8 (%rdi, %rcx), %rdx
+        add     $8, %ecx
+
+#ifdef USE_AS_STRNCMP
+	sub	$8, %r14
+	jl	.LABEL(tail)
+#endif
+
+        mov     %rbx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        mov     %rbx, %r9
+        add     %rdx, %r9
+        sbb     %r11, %r11
+
+        xor     %rax, %r8
+        or      %rbx, %r8
+        sub     %r10, %r8
+        jnz     .LABEL(tail)
+
+        xor     %rdx, %r9
+        or      %rbx, %r9
+        sub     %r11, %r9
+        jnz     .LABEL(tail)
+
+        cmp     %rdx, %rax
+        jne     .LABEL(tail)
+
+        mov     8 (%rsi, %rcx), %rax
+        mov     8 (%rdi, %rcx), %rdx
+        add     $8, %ecx
+
+#ifdef USE_AS_STRNCMP
+	sub	$8, %r14
+	jl	.LABEL(tail)
+#endif
+
+        mov     %rbx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        mov     %rbx, %r9
+        add     %rdx, %r9
+        sbb     %r11, %r11
+
+        xor     %rax, %r8
+        or      %rbx, %r8
+        sub     %r10, %r8
+        jnz     .LABEL(tail)
+
+        xor     %rdx, %r9
+        or      %rbx, %r9
+        sub     %r11, %r9
+        jnz     .LABEL(tail)
+
+        cmp     %rdx, %rax
+        jne     .LABEL(tail)
+
+        mov     8 (%rsi, %rcx), %rax
+        mov     8 (%rdi, %rcx), %rdx
+        add     $8, %ecx
+
+#ifdef USE_AS_STRNCMP
+	sub	$8, %r14
+	jl	.LABEL(tail)
+#endif
+
+        mov     %rbx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        mov     %rbx, %r9
+        add     %rdx, %r9
+        sbb     %r11, %r11
+
+        xor     %rax, %r8
+        or      %rbx, %r8
+        sub     %r10, %r8
+        jnz     .LABEL(tail)
+
+        xor     %rdx, %r9
+        or      %rbx, %r9
+        sub     %r11, %r9
+        jnz     .LABEL(tail)
+
+        cmp     %rdx, %rax
+        jne     .LABEL(tail)
+
+        mov     8 (%rsi, %rcx), %rax
+        mov     8 (%rdi, %rcx), %rdx
+        add     $8, %ecx
+
+#ifdef USE_AS_STRNCMP
+	sub	$8, %r14
+	jl	.LABEL(tail)
+#endif
+
+        mov     %rbx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        mov     %rbx, %r9
+        add     %rdx, %r9
+        sbb     %r11, %r11
+
+        xor     %rax, %r8
+        or      %rbx, %r8
+        sub     %r10, %r8
+        jnz     .LABEL(tail)
+
+        xor     %rdx, %r9
+        or      %rbx, %r9
+        sub     %r11, %r9
+        jnz     .LABEL(tail)
+
+        cmp     %rdx, %rax
+        jne     .LABEL(tail)
+
+        mov     8 (%rsi, %rcx), %rax
+        mov     8 (%rdi, %rcx), %rdx
+        add     $8, %ecx
+
+#ifdef USE_AS_STRNCMP
+	sub	$8, %r14
+	jl	.LABEL(tail)
+#endif
+
+        mov     %rbx, %r8
+        add     %rax, %r8
+        sbb     %r10, %r10
+
+        mov     %rbx, %r9
+        add     %rdx, %r9
+        sbb     %r11, %r11
+
+        xor     %rax, %r8
+        or      %rbx, %r8
+        sub     %r10, %r8
+        jnz     .LABEL(tail)
+
+        xor     %rdx, %r9
+        or      %rbx, %r9
+        sub     %r11, %r9
+        jnz     .LABEL(tail)
+
+        cmp     %rdx, %rax
+        jne     .LABEL(tail)
+
+        add	$8, %ecx
+
+        jmp	.LABEL(64loop)
+
+.LABEL(64after):
+
+.LABEL(tailtry):
+#	mov     (%rsi, %rcx), %rax
+#	mov     (%rdi, %rcx), %rdx
+#	add     $8, %rcx
+
+.LABEL(tail):				# byte tail
+#ifdef USE_AS_STRNCMP
+	add	$7, %r14
+#endif
+
+        cmp     %dl, %al		# check if same character
+        jne     .exit
+        test    %al, %al		# check if character a NUL
+        jz      .exit
+
+        shr	$8, %rax
+        shr	$8, %rdx
+
+#ifdef USE_AS_STRNCMP
+	dec	%r14
+	jl	.exit
+#endif
+
+        cmp     %dl, %al
+        jne     .exit
+        test    %al, %al
+        jz      .exit
+
+        shr	$8, %rax
+        shr	$8, %rdx
+
+#ifdef USE_AS_STRNCMP
+	dec	%r14
+	jl	.exit
+#endif
+
+        cmp     %dl, %al
+        jne     .exit
+        test    %al, %al
+        jz      .exit
+
+        shr	$8, %rax
+        shr	$8, %rdx
+
+#ifdef USE_AS_STRNCMP
+	dec	%r14
+	jl	.exit
+#endif
+
+        cmp     %dl, %al
+        jne     .exit
+        test    %al, %al
+        jz      .exit
+
+        shr	$8, %rax
+        shr	$8, %rdx
+
+#ifdef USE_AS_STRNCMP
+	dec	%r14
+	jl	.exit
+#endif
+
+        cmp     %dl, %al
+        jne     .exit
+        test    %al, %al
+        jz      .exit
+
+        shr	$8, %eax
+        shr	$8, %edx
+
+#ifdef USE_AS_STRNCMP
+	dec	%r14
+	jl	.exit
+#endif
+
+        cmp     %dl, %al
+        jne     .exit
+        test    %al, %al
+        jz      .exit
+
+        shr	$8, %eax
+        shr	$8, %edx
+
+#ifdef USE_AS_STRNCMP
+	dec	%r14
+	jl	.exit
+#endif
+
+        cmp     %dl, %al
+        jne     .exit
+        test    %al, %al
+        jz      .exit
+
+        shr	$8, %eax
+        shr	$8, %edx
+
+#ifdef USE_AS_STRNCMP
+	dec	%r14
+	jl	.exit
+#endif
+
+        cmp     %dl, %al
+        jne     .exit
+#	test    %al, %al
+#	jz      .exit
+
+        .p2align 4,, 15
+
+.LABEL(tailafter):
+
+.exit:
+	mov	-32 (%rsp), %r15
+	mov	-24 (%rsp), %rbp
+        mov	-16 (%rsp), %rbx
+
+        .p2align 4,, 3
+
+.LABEL(exitafter):
+#ifdef USE_AS_STRNCMP
+	test	%r14, %r14
+	cmovl	%edx, %eax
+#endif
+
+	movzx	%al, %eax
+	movzx	%dl, %edx
+	sub	%eax, %edx
+	xchg	%edx, %eax
+
+#ifdef USE_AS_STRNCMP
+.LABEL(exitz):
+	mov	-8 (%rsp), %r14
+#endif
+        ret
+
+END     (strcmp)
 libc_hidden_builtin_def (strcmp)
Index: sysdeps/x86_64/memcpy.S
===================================================================
--- sysdeps/x86_64/memcpy.S.orig
+++ sysdeps/x86_64/memcpy.S
@@ -39,7 +39,7 @@
 
         .text
 
-#if defined PIC && !defined NOT_IN_libc
+#if defined PIC && !defined NOT_IN_libc && !defined USE_AS_BCOPY
 ENTRY (__memcpy_chk)
 
 	cmpq	%rdx, %rcx
openSUSE Build Service is sponsored by