Rebase.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vpmovqw-2.c
blob27b816511da04971fe57876078bbc44f8e83c74e
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
5 #define AVX512F
7 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 64)
10 #include "avx512f-mask-type.h"
12 static void
13 CALC (short *r, long long *s)
15 int i;
16 for (i = 0; i < 8; i++)
18 r[i] = (i < SIZE) ? (short) s[i] : 0;
22 void
23 TEST (void)
25 int i, sign;
26 UNION_TYPE (128, i_w) res1, res2, res3;
27 short res4[8];
28 UNION_TYPE (AVX512F_LEN, i_q) src;
29 MASK_TYPE mask = MASK_VALUE;
30 short res_ref[8];
32 sign = -1;
33 for (i = 0; i < SIZE; i++)
35 src.a[i] = 1 + 34 * i * sign;
36 sign = sign * -1;
37 res2.a[i] = DEFAULT_VALUE;
38 res4[i] = DEFAULT_VALUE;
41 res1.x = INTRINSIC (_cvtepi64_epi16) (src.x);
42 res2.x = INTRINSIC (_mask_cvtepi64_epi16) (res2.x, mask, src.x);
43 res3.x = INTRINSIC (_maskz_cvtepi64_epi16) (mask, src.x);
44 INTRINSIC (_mask_cvtepi64_storeu_epi16) (res4, mask, src.x);
46 CALC (res_ref, src.a);
48 if (UNION_CHECK (128, i_w) (res1, res_ref))
49 abort ();
51 MASK_MERGE (i_w) (res_ref, mask, SIZE);
52 if (UNION_CHECK (128, i_w) (res2, res_ref))
53 abort ();
55 if (checkVs (res4, res_ref, 8))
56 abort ();
58 MASK_ZERO (i_w) (res_ref, mask, SIZE);
59 if (UNION_CHECK (128, i_w) (res3, res_ref))
60 abort ();