<div class="gmail_quote">On 2 October 2012 23:52, jerro <span dir="ltr"><<a href="mailto:a@a.com" target="_blank">a@a.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tuesday, 2 October 2012 at 13:36:37 UTC, Manu wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On 2 October 2012 13:49, jerro <<a href="mailto:a@a.com" target="_blank">a@a.com</a>> wrote:<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
I don't think it is possible to think of all usages of this, but for every<br>
simd instruction there are valid usages. At least for writing pfft, I found<br>
shuffling two vectors very useful. For, example, I needed a function that<br>
takes a small, square, power of two number of elements stored in vectors<br>
and bit-reverses them - it rearanges them so that you can calculate the new<br>
index of each element by reversing bits of the old index (for 16 elements<br>
using 4 element vectors this can actually be done using std.simd.transpose,<br>
but for AVX it was more efficient to make this function work on 64<br>
elements). There are other places in pfft where I need to select elements<br></div>
from two vectors (for example, here <a href="https://github.com/jerro/pfft/**" target="_blank">https://github.com/jerro/pfft/<u></u>**</a><br>
blob/sine-transform/pfft/avx_*<u></u>*float.d#L141<<a href="https://github.com/jerro/pfft/blob/sine-transform/pfft/avx_float.d#L141" target="_blank">https://github.<u></u>com/jerro/pfft/blob/sine-<u></u>transform/pfft/avx_float.d#<u></u>L141</a>>is the platform specific code for AVX).<div class="im">
<br>
<br>
I don't think this are the kind of things that should be implemented in<br>
std.simd. If you wanted to implement all such operations (for example bit<br>
reversing a small array) that somebody may find useful at some time,<br>
std.simd would need to be huge, and most of it would never be used.<br>
</div></blockquote>
<br>
<br><div class="im">
I was referring purely to your 2-vector swizzle idea (or useful high-level<br>
ideas in general). Not to hyper-context-specific functions :P<br>
</div></blockquote>
<br>
My point was that those context specific functions can be implemented using a 2 vector swizzle. LLVM, for example, actually provides access to most vector shuffling instruction through "shufflevector", which is basically a 2 vector swizzle.<br>
</blockquote><div><br></div></div>Yeah, I understand. And it's a good suggestion. I'll add support for 2-vector swizzling next time I'm working on it.