I have the following problem:
Say, at location 'A', I have: c1 d1 c3 d3, which are all doubles (64-bit). I want to fill two registers, a00 and a01 with:
a00-> |d1|c1|d1|c1| ; a01-> |d3|c3|d3|c3|
i.e I want to broadcast the first two elements to register a00 and the next two elements to register a01.
Currently, I'm doing it as follows:
a_t = _mm256_load_pd(A); i.e a00[255:128] = |d3|c3| and a00[127:0] = |d1|c1|
a00 = _mm256_permute2f128_pd(a_t,a_t,0); i.e. a00[127:0] = a_t[127:0] and a00[255:128] = a_t[127:0]
a01 = _mm256_permute2f128_pd(a_t,a_t,51);i.e a01[127:0] = a_t[255:128] and a01[255:128] = a_t[255:128]
However, this takes one load and two permute instructions. Is it possible to do this in 2 instructions?
I am not changing the order.
To be clearer: A=c1,A=d1,A=c3,A=d3. When I say that register a00 should contain: |d1|c1|d1|c1|, 'c1' is at a00[63:0] which would have been the same if I had done, say :
a00 = _mm256_load_pd(A); a00->|d3|c3|d1|c1|