PR target/80969 - Fix ICE with -mabi=ms -mavx512f, reduce wasted space when realignin...
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-i64gatherq512-2.c
blob134fd18b82d55c43c15fb2bc9521155a6865d248
1 /* { dg-do run } */
2 /* { dg-options "-mavx512f -O2" } */
3 /* { dg-require-effective-target avx512f } */
5 #include "avx512f-check.h"
7 #define SCALE 2
9 static void
10 compute_gatherqq (long long *res, __mmask8 m8, long long *idx,
11 long long *src, int scale, long long *r)
13 int i;
15 for (i = 0; i < 8; i++)
17 if (m8 & (1 << i))
18 r[i] = *(long long *)
19 (((unsigned char *) src) + idx[i] * scale);
20 else
21 r[i] = res[i];
25 static void
26 avx512f_test (void)
28 int i;
29 union512i_q idx, res;
30 long long src[8];
31 long long res_ref[8];
32 __mmask8 m8 = 0xC5;
34 for (i = 0; i < 8; i++)
36 src[i] = 1983 * (i + 1) * (i + 2);
38 /* About to gather in reverse order,
39 divide by 2 to demonstrate scale */
40 idx.a[i] = (64 - (i + 1) * 8) >> 1;
43 res.x = _mm512_mask_i64gather_epi64 (res.x, m8, idx.x, src, SCALE);
44 compute_gatherqq (res.a, m8, idx.a, src, SCALE, res_ref);
46 if (check_union512i_q (res, res_ref))
47 abort ();
49 res.x = _mm512_i64gather_epi64 (idx.x, src, SCALE);
50 compute_gatherqq (res.a, 0xFF, idx.a, src, SCALE, res_ref);
52 if (check_union512i_q (res, res_ref))
53 abort ();