* g++.dg/other/i386-2.C (dg-options): Add -mavx512pf.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vpmovusqb-2.c
blob43fb9d275ccf4e373503c0501af7dd88902c87df
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"
11 #include <limits.h>
13 CALC (unsigned char *r, unsigned long long *s, int mem)
15 int i;
16 int len = mem ? 8 : 16;
17 for (i = 0; i < len; i++)
19 r[i] = (s[i] > UCHAR_MAX) ? UCHAR_MAX : s[i];
20 r[i] = (i < SIZE) ? r[i] : 0;
24 void static
25 TEST (void)
27 int i, sign;
28 UNION_TYPE (128, i_b) res1, res2, res3;
29 unsigned char res4[16];
30 UNION_TYPE (AVX512F_LEN, i_q) src;
31 MASK_TYPE mask = MASK_VALUE;
32 unsigned char res_ref[16];
33 unsigned char res_ref2[16];
35 for (i = 0; i < SIZE; i++)
37 src.a[i] = 1 + 34 * i;
38 res2.a[i] = DEFAULT_VALUE;
39 res4[i] = DEFAULT_VALUE;
42 for (i = SIZE; i < 16; i++)
44 res4[i] = DEFAULT_VALUE * 2;
45 res_ref2[i] = DEFAULT_VALUE * 2;
48 res1.x = INTRINSIC (_cvtusepi64_epi8) (src.x);
49 res2.x = INTRINSIC (_mask_cvtusepi64_epi8) (res2.x, mask, src.x);
50 res3.x = INTRINSIC (_maskz_cvtusepi64_epi8) (mask, src.x);
52 CALC (res_ref, src.a, 0);
54 if (UNION_CHECK (128, i_b) (res1, res_ref))
55 abort ();
57 MASK_MERGE (i_b) (res_ref, mask, SIZE);
58 if (UNION_CHECK (128, i_b) (res2, res_ref))
59 abort ();
61 MASK_ZERO (i_b) (res_ref, mask, SIZE);
62 if (UNION_CHECK (128, i_b) (res3, res_ref))
63 abort ();
65 INTRINSIC (_mask_cvtusepi64_storeu_epi8) (res4, mask, src.x);
67 CALC (res_ref2, src.a, 1);
68 MASK_MERGE (i_b) (res_ref2, mask, SIZE);
70 if (checkVc (res4, res_ref2, 16))
71 abort ();