This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: bsf on atom
- From: Dmitrieva Liubov <liubov dot dmitrieva at gmail dot com>
- To: Ondřej Bílka <neleai at seznam dot cz>
- Cc: libc-help at sourceware dot org
- Date: Fri, 31 Aug 2012 16:50:12 +0400
- Subject: Re: bsf on atom
- References: <20120830150755.GA6804@domone.kolej.mff.cuni.cz>
This replacement looks good to me, but anyway you should provide
comparison of performance with glibc 2.15 or later and discount IFUNC
overhead.
Currently all ...no-bsf versions (=atom versions) use binary tree
replacement of bsf, but your idea might be better.
--
Liubov
2012/8/30 OndÅej BÃlka <neleai@seznam.cz>:
> Hello, I now again have time to string functions.
>
> I consider using following replacement of bsf:
>
> static char first_bit_short_ary[]=
> {[0]=16,[1]=0,[2]=1,[4]=2,[8]=3,[16]=4,[32]=5,[64]=6,[128]=7,[256]=8,
> [512]=9,[1024]=10,[2048]=11,[4096]=12,[8192]=13,[16384]=14,[32768]=15
> };
> inline int first_bit_short(int x){
> return first_bit_short_ary[x&(-x)];
> }
>
> in function prologue as it deals only 16 bit values.
> How fast is this on atom?
> Cost is 11 cache lines which look acceptable to me.
>
> --
>
> Budget cuts forced us to sell all the power cords for the servers.