- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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:

[cpp]

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]

[/cpp]

However, this takes one load and two permute instructions. Is it possible to do this in 2 instructions?

Thanks,

Bharat.

Link Copied

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

**c1 d1**and

**c3 d3**to:

**d1 c1 d1 c1**and

**d3 c3 d3 c3**

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi Sergey,

I am not changing the order.

To be clearer: A[0]=c1,A[1]=d1,A[2]=c3,A[3]=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 :

[cpp]

a00 = _mm256_load_pd(A); a00->|d3|c3|d1|c1|

[/cpp]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

**_mm256_broadcast_pd**you've described tomorrow.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi Sergey,

Yes, this is what I was referring to. Thanks! I'll try this and get back to you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Yeah it works properly..thanks!

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page