2015-12-10 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512dq-vpmovd2m-2.c
blob02b9513aca2ff8af829ad4b02c06f9fd0bc1a336
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512dq" } */
3 /* { dg-require-effective-target avx512dq } */
5 #define AVX512DQ
6 #include "avx512f-helper.h"
8 #define SIZE (AVX512F_LEN / 32)
9 #include "avx512f-mask-type.h"
11 void
12 CALC (MASK_TYPE *r, int *s1)
14 int i;
15 MASK_TYPE res = 0;
16 MASK_TYPE one = 1;
18 for (i = 0; i < SIZE; i++)
19 if (s1[i] >> 31)
20 res = res | (one << i);
22 *r = res;
25 void
26 TEST (void)
28 int i, sign;
29 UNION_TYPE (AVX512F_LEN, i_d) src;
30 MASK_TYPE res, res_ref = 0;
32 sign = -1;
33 for (i = 0; i < SIZE; i++)
35 src.a[i] = 2 * i * sign;
36 sign = sign * -1;
39 res = INTRINSIC (_movepi32_mask) (src.x);
41 CALC (&res_ref, src.a);
43 if (res_ref != res)
44 abort ();