Subject: Re: [boost] [Endian] Performance
From: Tim Moore (tim_at_[hidden])
Date: 2011-09-07 09:28:18


On 9/7/11 1:49 AM, Mathias Gaunard wrote:
> On 09/07/2011 01:54 AM, Phil Endecott wrote:
>
>> Unfortunately not, no; in my tests the gcc built-ins were the
>> worse-performing on one platform.
>
> Then it's a bug that should be fixed in the compiler.
> (But then it could also be that your benchmark is imperfect)
>

There have been reports that some gcc builtins (especially for ARM) do not generate very good code. One description of gcc's
bswap builtin for ARM is here:

http://hardwarebug.org/2010/01/14/beware-the-builtins/

My own personal work has found that gcc's implemenation of the popcount builtin is very inefficient on IA-64 archs compared to
other well known (and easy to implement) bit-twiddling algorithms. (Of course, this is for cases where the popcount instruction
is not available in the target processor.)

Cheers,

Tim