PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vcvttpd2udq-2.c
blobf0a966ed96824aefa7f61b7299c76e9a0b088c9b
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 SRC_SIZE ((AVX512F_LEN) / 64)
10 #include "avx512f-mask-type.h"
11 #define DST_SIZE ((AVX512F_LEN_HALF) / 32)
13 static void
14 CALC (double *s, unsigned *r)
16 int i;
18 for (i = 0; i < SRC_SIZE; i++)
19 r[i] = (unsigned) s[i];
20 for (i = SRC_SIZE; i < DST_SIZE; i++)
21 r[i] = 0;
24 void
25 TEST (void)
27 UNION_TYPE (AVX512F_LEN, d) s;
28 UNION_TYPE (AVX512F_LEN_HALF, i_ud) res1, res2, res3;
29 MASK_TYPE mask = MASK_VALUE;
30 unsigned res_ref[DST_SIZE] = { 0 };
31 int i;
33 for (i = 0; i < SRC_SIZE; i++)
35 s.a[i] = 123.456 * (i + 2000);
38 for (i = 0; i < DST_SIZE; i++)
39 res2.a[i] = DEFAULT_VALUE;
41 res1.x = INTRINSIC (_cvttpd_epu32) (s.x);
42 res2.x = INTRINSIC (_mask_cvttpd_epu32) (res2.x, mask, s.x);
43 res3.x = INTRINSIC (_maskz_cvttpd_epu32) (mask, s.x);
45 CALC (s.a, res_ref);
47 if (UNION_CHECK (AVX512F_LEN_HALF, i_ud) (res1, res_ref))
48 abort ();
50 MASK_MERGE (i_ud) (res_ref, mask, SRC_SIZE);
51 if (UNION_CHECK (AVX512F_LEN_HALF, i_ud) (res2, res_ref))
52 abort ();
54 MASK_ZERO (i_ud) (res_ref, mask, SRC_SIZE);
55 if (UNION_CHECK (AVX512F_LEN_HALF, i_ud) (res3, res_ref))
56 abort ();