This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/3] Optimize strchrnul with unrolling, better header and unaligned loads
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 28 May 2015 19:08:08 +0200
- Subject: Re: [PATCH 2/3] Optimize strchrnul with unrolling, better header and unaligned loads
- Authentication-results: sourceware.org; auth=none
- References: <20150526173150 dot GA26817 at domone> <20150526180007 dot GB26817 at domone> <alpine dot DEB dot 2 dot 10 dot 1505281659460 dot 16930 at digraph dot polyomino dot org dot uk>
On Thu, May 28, 2015 at 05:02:32PM +0000, Joseph Myers wrote:
> On Tue, 26 May 2015, OndÅej BÃlka wrote:
>
> > +static always_inline
> > +int
> > +found_in_long_bytes(char *s, unsigned long int cmask, char **result)
> > +{
> > + const unsigned long int *lptr = (const unsigned long int *) s;
> > + unsigned long int mask = contains_zero (*lptr) | contains_zero (*lptr ^ cmask);
> > + if (mask)
> > + {
> > + *result = s + ffsl (mask) / 8 - 1;
>
> If this gets used in strchr, note ffsl is in the user's namespace. Are
> you sure this will always be inlined by all supported GCC versions on all
> supported architectures (or converted to a call to a libgcc __clz*
> function, which is just as good in namespace terms)?
>
No, i handle that problem of next iteration of this patch that uses
skeleton. And you need different function for big endian.