Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.
1093 Discussions

How to zero extend packed unsigned 8-bit integers with an AVX intrinsic

Henk-Jan_L_
Beginner
928 Views

I need to zero extend packed unsigned 8-bit integers with an AVX intrinsic. Question: How do you generate a "vpmovzxbd xmm, xmm" instruction with intrinsics. There seems to exist something close: __m256i _mm256_cvtepu8_epi32 (__m128i a) which generates "vpmovzxbd ymm, xmm", but this is AVX2. Regards HJ!

0 Kudos
2 Replies
andysem
New Contributor III
928 Views

AVX does not provide support for 256-bit integer instructions. 128-bit vpmovzxbd can be generated with _mm_cvtepu8_epi32, but it will only extend the lower 4 bytes. If you aim to process all bytes in the vector your best approach is to use unpack intrinsics.

 

0 Kudos
Henk-Jan_L_
Beginner
928 Views
Thanks, I didn't realize that _mm_cvtepu8_epi32 would generate different instructions: pmovzxbd and vpmovzxbd depending on the "Enabled Enhanced Instruction Set" compiler parameter.
0 Kudos
Reply