lkml.org 
[lkml]   [2004]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: using gcc built-ins for bitops?
Arjan van de Ven <arjanv@redhat.com> wrote:
>
> gcc 3.4 gained support for several typical bitops as builtin directives.
> Using these over inline asm has a few advantages:
> * gcc can optimize constants into these better
> * gcc can reorder and schedule the code better
> * gcc can allocate registers etc better for the code
>
> The question is if we consider it desirable to go down this road or not. In
> order to help that discussion I've attached a patch below that switches the
> i386 ffz() function to the gcc builtin version, conditional on gcc having
> support for this. Before I go down the road of converting more functions
> and/or architectures.... is this worth doing?

I guess it depends on the resulting code size and quality. Some extra
conversions would be needed for that.

For the implementation it would be nice to have the old-style
implementations in one header and the new-style ones in a separate header.
That would create a bit of an all-or-nothing situation, but that should be
OK?

> +static inline unsigned long ffz (unsigned long word)
> +{
> + return __builtin_ctzl (~word);
> +}

eww, whitepsace innovations.

static inline unsigned long ffz(unsigned long word)
{
return __builtin_ctzl(~word);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:04    [W:0.085 / U:0.908 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site