SIMD ideas for Rust
Manu
turkeyman at gmail.com
Tue Jul 23 17:22:44 PDT 2013
On 23 July 2013 17:05, bearophile <bearophileHUGS at lycos.com> wrote:
> Manu:
>
>
> // return [arb[0] - aib[0], arb[1] + aib[1]]; // this final line is
>> tricky... it's not very portable.
>>
>> // Maybe:
>> return select([-1, 0], arb-aib, arb+aib);
>> // Hopefully the x86 optimiser will generate the proper opcode. Or a
>> bunch of other options; a multi-vector shuffle, shift, swizzle,
>> interleave.
>> }
>>
>> I think that would be better. More portable, and it eliminates the code
>> that implies a vector->float->vector cast sequence, which I maintain,
>> should be syntactically discouraged at all costs.
>> You don't want to be giving people bad ideas that it's reasonable code to
>> write ;)
>>
>
> Apparently that select() uses __builtin_ia32_pblendvb128, that is a SSE4.1
> instruction. At the moment I have only SSE3 :-(
>
It's probably better to use a shuf, or a shift for compatibility, since the
selection predicate is constant anyway.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130724/b607c3e0/attachment.html>
More information about the Digitalmars-d
mailing list