glibc/sysdeps
H.J. Lu c5cc45148c i586: Use conditional branches in strcpy.S [BZ #22353]
i586 strcpy.S used a clever trick with LEA to implement jump table:

/* ECX has the last 2 bits of the address of source - 1.  */
	andl	$3, %ecx

        call    2f
2:      popl    %edx
	/* 0xb is the distance between 2: and 1:.  */
        leal    0xb(%edx,%ecx,8), %ecx
        jmp     *%ecx

        .align 8
1:  /* ECX == 0 */
        orb     (%esi), %al
        jz      L(end)
        stosb
        xorl    %eax, %eax
        incl    %esi
    /* ECX == 1 */
        orb     (%esi), %al
        jz      L(end)
        stosb
        xorl    %eax, %eax
        incl    %esi
    /* ECX == 2 */
        orb     (%esi), %al
        jz      L(end)
        stosb
        xorl    %eax, %eax
        incl    %esi
    /* ECX == 3 */
L(1):   movl    (%esi), %ecx
        leal    4(%esi),%esi

This fails if there are instruction length changes before L(1):.  This
patch replaces it with conditional branches:

	cmpb	$2, %cl
	je	L(Src2)
	ja	L(Src3)
	cmpb	$1, %cl
	je	L(Src1)

L(Src0):

which have similar performance and work with any instruction lengths.

Tested on i586 and i686 with and without --disable-multi-arch.

	[BZ #22353]
	* sysdeps/i386/i586/strcpy.S (STRCPY): Use conditional branches.
	(1): Renamed to ...
	(L(Src0)): This.
	(L(Src1)): New.
	(L(Src2)): Likewise.
	(L(1)): Renamed to ...
	(L(Src3)): This.
2017-10-30 10:02:30 -07:00
..
aarch64 aarch64: Add missing math Makefile for recent commit 2017-10-23 15:34:36 +01:00
alpha Use libm_alias_double for dbl-64 fma. 2017-10-04 20:32:48 +00:00
arm Update ARM libm-test-ulps. 2017-10-05 22:17:30 +00:00
generic Add _Float128 function aliases. 2017-10-18 17:37:18 +00:00
gnu hurd: Fix getifaddrs' and freeifaddrs' symbol exposition 2017-09-28 01:05:18 +02:00
hppa ld.so: Replace (&bootstrap_map) with BOOTSTRAP_MAP 2017-10-03 01:55:12 -07:00
i386 i586: Use conditional branches in strcpy.S [BZ #22353] 2017-10-30 10:02:30 -07:00
ia64 Add bits/floatn.h defines for more _FloatN / _FloatNx types. 2017-10-20 21:42:51 +00:00
ieee754 Add bits/floatn.h defines for more _FloatN / _FloatNx types. 2017-10-20 21:42:51 +00:00
init_array Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
m68k m68k: Update elf_machine_load_address for static PIE 2017-10-20 03:36:47 -07:00
mach Introduce NO_RTLD_HIDDEN, make hurd use it instead of NO_HIDDEN 2017-10-03 01:33:38 +02:00
microblaze Obsolete pow10 functions. 2017-09-01 21:13:18 +00:00
mips Replace "if if " with "if " in comments 2017-10-25 08:05:51 -07:00
nios2 Enable unwind info in libc-start.c and backtrace.c 2017-09-19 15:07:58 +01:00
nptl Remove add-ons mechanism. 2017-10-05 15:58:13 +00:00
posix sysconf: Fix missing definition of UIO_MAXIOV on Linux [BZ #22321] 2017-10-20 04:10:15 +02:00
powerpc powerpc: Replace lxvd2x/stxvd2x with lvx/stvx in P7's memcpy/memmove 2017-10-25 13:14:30 -02:00
pthread aio: Remove internal_function function attribute 2017-08-31 15:59:06 +02:00
s390 S390: Regenerate ULPs 2017-10-05 12:50:49 +02:00
sh Enable unwind info in libc-start.c and backtrace.c 2017-09-19 15:07:58 +01:00
sparc Fix TLS relocations against local symbols on powerpc32, sparc32 and sparc64 2017-10-13 16:14:16 -03:00
tile Remove ancient __signbit inlines 2017-09-28 19:52:13 +01:00
unix posix: Do not use WNOHANG in waitpid call for Linux posix_spawn 2017-10-23 13:31:26 -02:00
wordsize-32 Build divdi3 only for architecture that required it 2017-04-06 15:14:34 -03:00
wordsize-64 posix: Consolidate Linux glob implementation 2017-09-08 16:34:02 +02:00
x86 Update x86 fix-fp-int-compare-invalid.h for GCC 8. 2017-10-24 00:33:08 +00:00
x86_64 Replace "if if " with "if " in comments 2017-10-25 08:05:51 -07:00