Debian Codegraph @

gcc/testsuite/gcc.target/i386/avx512f-scatter-3.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx512f } */
3 /* { dg-options "-O3 -mavx512f" } */
4
5 #define AVX512F
6
7 #include "avx512f-check.h"
8
9 #define N 1024
10 int a[N], b[N];
11
12 __attribute__((noinline, noclone)) void
13 foo (float *__restrict p, float *__restrict q,
14 int s1, int s2, int s3)
15 {
16 int i;
17 for (i = 0; i < (N / 8); i++)
18 p[a[i] * s1 + b[i] * s2 + s3] = q[i];
19 }
20
21 static void
22 avx512f_test (void)
23 {
24 int i;
25 float c[N], d[N];
26 for (i = 0; i < N; i++)
27 {
28 a[i] = (i * 7) & (N / 8 - 1);
29 b[i] = (i * 13) & (N / 8 - 1);
30 c[i] = 179.13 + i;
31 }
32 foo (d, c, 3, 2, 4);
33 for (i = 0; i < (N / 8); i++)
34 if (d[a[i] * 3 + b[i] * 2 + 4] != (float) (179.13 + i))
35 abort ();
36 }