Splitting __m256 into two __m128 registers

Viewed 580

I have one __m256 containing 8 floats, and I'd like to split this into 2 __m128, one containing the first four floats and the other containing the last four floats. Is this possible?

Thanks

1 Answers

_mm256_extractf128_ps can be used for both the upper and lower parts. For the upper part, that's the best way to extract it. However, with some slightly older versions of MSVC that intrinsic always results in the corresponding instruction, even when the index is zero (in that case actually no instruction is necessary). So for extracting the lower part, _mm256_castps256_ps128 should be preferred.

Related