* g++.dg/other/i386-2.C (dg-options): Add -mavx512pf.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vpermi2q-2.c
blob9d7b9bec3f39cc4db19aef68375e3df219810804
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 "math.h"
12 #include "values.h"
14 static void
15 CALC (long long *dst, long long *src1, long long *ind, long long *src2)
17 int i;
19 for (i = 0; i < SIZE; i++)
21 unsigned long long offset = ind[i] & (SIZE - 1);
22 unsigned long long cond = ind[i] & SIZE;
24 dst[i] = cond ? src2[offset] : src1[offset];
28 void static
29 TEST (void)
31 int i;
32 UNION_TYPE (AVX512F_LEN, i_q) s1, s2, res, ind;
33 long long res_ref[SIZE];
35 MASK_TYPE mask = MASK_VALUE;
37 for (i = 0; i < SIZE; i++)
39 ind.a[i] = DEFAULT_VALUE;
40 s1.a[i] = 34 * i + 1;
41 s2.a[i] = 34 * i;
43 res.a[i] = DEFAULT_VALUE;
46 CALC (res_ref, s1.a, ind.a, s2.a);
48 res.x =
49 INTRINSIC (_mask2_permutex2var_epi64) (s1.x, ind.x, mask, s2.x);
51 MASK_MERGE (i_q) (res_ref, mask, SIZE);
52 if (UNION_CHECK (AVX512F_LEN, i_q) (res, res_ref))
53 abort ();