Subject: Re: [boost] Boost SIMD beta release
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-12-20 11:42:08
On 20/12/12 17:35, Tim Blechmann wrote:
>>>> * is it possible to define simd kernels for both packs and scalars e.g.
>>>> to make use of branches in the scalar implementation used in
>>>> preroll/postroll of unrolled loops?
>>> All operations on pack are also defined on scalar so if you write a
>>> polymorphic template functor, it will work on both. There is a simple
>>> example of
>>> this in the paper.
>> While this works, if you do this you won't be able to use lazy branch
>> evaluation in the scalar version.
>> If you write
>> c = if_else(a != 0, b/a, b);
>> this is equivalent in scalar to
>> c = (a != 0) ? b/a : b;
>> except that in the case above you will always compute the division.
> would it be possible to simply provide an overloaded operator() for
> scalar types?
Sure, you can have separate scalar and simd versions, with the caveat
that quite often you'll write nearly the same code twice.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk