Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have an _m256 with 8 floats in it:



i want to add pairs of values : (0+4, 1+5, 2+6, 3+7)

__m256 i;

... i gets some values...
 and then...
i = {
   i.m256_f32[0] + i.m256_f32[4], 
   i.m256_f32[1] + i.m256_f32[5], 
   i.m256_f32[2] + i.m256_f32[6], 
   i.m256_f32[3] + i.m256_f32[7], 
   x, x, x, x
};

x = don't care

in SSE, i would shuffle the 4,5,6,7 into a new register then add the two, but i can't find any good docs for _mm256_shuffle_ps.

anyone know how to do this?
Posted

1 solution

nevermind...

C++
__m256 j = _mm256_permute2f128_ps(i, i, (1 << 0) | (1 << 1));
i = _mm256_add_ps(i,j);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900