This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC PATCH] Add strcmp, strncmp, memcmp inline implementation.
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Ondřej Bílka <neleai at seznam dot cz>
- Cc: <libc-alpha at sourceware dot org>
- Date: Thu, 28 May 2015 16:23:13 +0000
- Subject: Re: [RFC PATCH] Add strcmp, strncmp, memcmp inline implementation.
- Authentication-results: sourceware.org; auth=none
- References: <20150525015826 dot GA29445 at domone>
On Mon, 25 May 2015, Ondřej Bílka wrote:
> Hi,
>
> I just found that on x64 gcc __builtin_strcmp suck a lot. And by lot I
> mean its around three times slower than libcall by using rep cmpsb which
> even intel manual says that shouldn't be used.
GCC bug report number? It's not helpful to say "suck a lot" without
reporting the issues to the other project (identifying the compiler
options etc. in use). We need to cooperate appropriately with other free
software projects in developing glibc.
> So I decided to write a strcmp inline that works. As reencoding it as
> gcc pass would be extra effort without any benefit I skipped it.
There is obvious benefit to compiler implementations e.g. for calls to
strcmp in kernel space.
> * sysdeps/x86_64/bits/string.h: New file.
No installed headers should ever be in x86_64 or i386 sysdeps directories.
The installed headers should always come from sysdeps/x86 directories and
be usable for both 32-bit and 64-bit compilations by containing
appropriate conditionals on e.g. __x86_64__. Don't regress on HJ's
implementation of this for 2.16.
--
Joseph S. Myers
joseph@codesourcery.com