ds at schleef.org
Wed Dec 21 14:39:07 PST 2005
On Wed, Dec 21, 2005 at 09:26:55PM +0100, Stephane Fillod wrote:
> What about transparent support for the following helpers/macros,
> where available (otherwise do nothing):
> * restrict
> * prefetch(), prefetchw() and __builtin_prefetch with GCC or asm()
> * likely()/unlikely() and __builtin_expect with GCC
> * nothrow
> * pure
> * ..
> Gathered in an header file, they may come handy for portable
> C implementations and modern compilers.
Most of these are handled quite well by Glib, so I don't consider
them candidates for the Liboil API.
likely()/unlikely() isn't very interesting internal to liboil,
since processors of the last few generations have adequate
dynamic branch prediction ability, which will be predicted well
in any loop with N>2.
prefetch() is currently outside the scope of liboil, since liboil
explicitly ignores any cache effects. I long ago came to the
conclusion that handling cache effects is a lot harder problem than
sprinkling prefetch instructions in a few places, and requires
coding using algorithms that have tunable parameters (such as block
size) that can be adjusted in order to use the cache optimally.
Big Kitten LLC (http://www.bigkitten.com/) -- data acquisition on Linux
More information about the Liboil