SIMD ideas for Rust
bearophile
bearophileHUGS at lycos.com
Tue Jul 23 00:05:58 PDT 2013
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 :-(
Bye,
bearophile
More information about the Digitalmars-d
mailing list