From f140a0d53d639c86408ac532091fb4644faa95c0 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 10 Apr 2009 07:57:20 +0000 Subject: [PATCH] * sysdeps/x86_64/rawmemchr.S: New file. --- ChangeLog | 2 ++ sysdeps/x86_64/memchr.S | 3 +-- sysdeps/x86_64/{memchr.S => rawmemchr.S} | 35 ++++++++++---------------------- 3 files changed, 14 insertions(+), 26 deletions(-) copy sysdeps/x86_64/{memchr.S => rawmemchr.S} (71%) diff --git a/ChangeLog b/ChangeLog index c0d26fccce..6a28967a24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2009-04-09 Ulrich Drepper + * sysdeps/x86_64/rawmemchr.S: New file. + * stdio-common/vfprintf.c (vfprintf): Slightly more compact code. Simplified code and possible copy problem fixed. diff --git a/sysdeps/x86_64/memchr.S b/sysdeps/x86_64/memchr.S index 644362d565..09ba6d4f8d 100644 --- a/sysdeps/x86_64/memchr.S +++ b/sysdeps/x86_64/memchr.S @@ -1,5 +1,4 @@ -/* strlen(str) -- determine the length of the string STR. - Copyright (C) 2009 Free Software Foundation, Inc. +/* Copyright (C) 2009 Free Software Foundation, Inc. Contributed by Ulrich Drepper . This file is part of the GNU C Library. diff --git a/sysdeps/x86_64/memchr.S b/sysdeps/x86_64/rawmemchr.S similarity index 71% copy from sysdeps/x86_64/memchr.S copy to sysdeps/x86_64/rawmemchr.S index 644362d565..c3bd771635 100644 --- a/sysdeps/x86_64/memchr.S +++ b/sysdeps/x86_64/rawmemchr.S @@ -1,5 +1,4 @@ -/* strlen(str) -- determine the length of the string STR. - Copyright (C) 2009 Free Software Foundation, Inc. +/* Copyright (C) 2009 Free Software Foundation, Inc. Contributed by Ulrich Drepper . This file is part of the GNU C Library. @@ -22,7 +21,7 @@ .text -ENTRY (memchr) +ENTRY (rawmemchr) movd %esi, %xmm1 movq %rdi, %rcx punpcklbw %xmm1, %xmm1 @@ -33,35 +32,23 @@ ENTRY (memchr) pshufd $0, %xmm1, %xmm1 subq %rdi, %rcx pcmpeqb %xmm1, %xmm0 - addq %rcx, %rdx shl %cl, %esi pmovmskb %xmm0, %ecx + leaq 16(%rdi), %rdi andl %esi, %ecx - movl $16, %esi jnz 1f - cmpq %rsi, %rdx - jle 3f -2: movdqa (%rdi,%rsi), %xmm0 - leaq 16(%rsi), %rsi +2: movdqa (%rdi), %xmm0 + leaq 16(%rdi), %rdi pcmpeqb %xmm1, %xmm0 pmovmskb %xmm0, %ecx testl %ecx, %ecx - jnz 1f - cmpq %rsi, %rdx - jg 2b - -3: xorl %eax, %eax - ret + jz 2b -1: leaq -16(%rdi,%rsi), %rax - bsfl %ecx, %ecx - addq %rcx, %rax - leaq -16(%rsi,%rcx), %rsi - cmpq %rsi, %rdx - jle 3b +1: bsfl %ecx, %ecx + leaq -16(%rcx,%rdi), %rax ret -END (memchr) +END (rawmemchr) -strong_alias (memchr, __memchr) -libc_hidden_builtin_def (memchr) +strong_alias (rawmemchr, __rawmemchr) +libc_hidden_builtin_def (__rawmemchr) -- 2.11.4.GIT