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

Shifting __m256i variable by 4 bytes or 32 bits to read 32bit values

Caster
New Contributor I
660 Views

I am trying to read uint32_t values from __m256i variable and store them into uint32_t array.

 

__m256i chunk0;
__m256i chunk1;

uint32_t field[80];

int main()
{
    chunk0 = _mm256_setr_epi32(0x6A6F6841, 0x34333231, 0x00000008, 0x0, 0x0, 0x0, 0x0, 0x0);
    chunk1 = _mm256_setr_epi32(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x40);

    for (int i = 7; i >= 0; i--) {
        field[i] = _mm256_extract_epi32(chunk0, 7);
        chunk0 = _mm256_slli_si256(chunk0, 4);

    for (int i = 15; i >= 8; i--) {
        field[i] = _mm256_extract_epi32(chunk1, 7);
        chunk1 = _mm256_slli_si256(chunk1, 4);
    }

 

However I discovered that _mm256_slli_si256 works on 128 bit lane only. What function to use to do the job?

0 Kudos
0 Replies
Reply