1 /* { dg-do run } */
2 /* { dg-require-effective-target avx } */
3 /* { dg-options "-O2 -mavx" } */
4 
5 #include "avx-check.h"
6 
7 #ifndef MASK
8 #define MASK 6
9 #endif
10 
11 #define mask_v(pos) (((MASK & (0x1ULL << (pos))) >> (pos)) << 63)
12 
13 void static
avx_test(void)14 avx_test (void)
15 {
16   int i;
17   long long m[2] = {mask_v(0), mask_v(1)};
18   double s[2] = {1.1, 2.2};
19   double e[2] = {0.0};
20   double d[2] = {0.0};
21   union128d src;
22   union128i_q mask;
23 
24   src.x = _mm_loadu_pd (s);
25   mask.x = _mm_loadu_si128 ((__m128i *)m);
26   _mm_maskstore_pd (d, mask.x, src.x);
27 
28   for (i = 0 ; i < 2; i++)
29     e[i] = m[i] ? s[i] : 0;
30 
31   if (checkVd (d, e, 2))
32     abort ();
33 }
34