1 /* { dg-do run } */
2 /* { dg-require-effective-target avx2 } */
3 /* { dg-options "-O2 -mavx2" } */
4
5 #include "avx2-check.h"
6
7 #ifndef MASK
8 #define MASK 214
9 #endif
10
11 #define mask_v(pos) (((MASK & (0x1 << (pos))) >> (pos)) << 31)
12
13 void static
avx2_test(void)14 avx2_test (void)
15 {
16 int i;
17 int m[4] = { mask_v (0), mask_v (1), mask_v (2), mask_v (3) };
18 int s[4] = { 1, 2, 3, 4 };
19 union128i_d src, mask;
20 int e[4] = { 0 };
21 int d[4] = { 0 };
22
23 src.x = _mm_loadu_si128 ((__m128i *) s);
24 mask.x = _mm_loadu_si128 ((__m128i *) m);
25 _mm_maskstore_epi32 (d, mask.x, src.x);
26
27 for (i = 0; i < 4; i++)
28 e[i] = m[i] ? s[i] : 0;
29
30 if (checkVi (d, e, 4))
31 abort ();
32 }
33