Debian Codegraph @

gcc/testsuite/gcc.dg/vect/vect-simd-clone-11.c

raw
1 /* { dg-require-effective-target vect_simd_clones } */
2 /* { dg-additional-options "-fopenmp-simd" } */
3 /* { dg-additional-options "-mavx" { target avx_runtime } } */
4
5 #include "tree-vect.h"
6
7 #ifndef N
8 #define N 1024
9 #endif
10
11 int a[N] __attribute__((aligned (32)));
12
13 #pragma omp declare simd linear(a) linear(b:3) linear(c:6) notinbranch
14 __attribute__((noinline)) int
15 foo (int a, int b, int c)
16 {
17 return a ^ (b * 512) ^ (c * 512 * 512);
18 }
19
20 __attribute__((noinline, noclone)) void
21 bar (int *d)
22 {
23 int i, j, k;
24 for (i = 0, j = 0, k = 0; i < N / 2; i++, j++, k += 3)
25 d[i] = foo (j, i * 3, 2 * k + 2);
26 }
27
28 #if 0
29 __attribute__((noinline, noclone)) void
30 baz (int *d)
31 {
32 long int i, j, k;
33 for (i = 0, j = 0, k = 0; i < N / 2;
34 i = (int) i + 1, j = (int) j + 1, k = (int) k + 3)
35 d[i] = foo (j, i * 3, 2 * k + 2);
36 }
37 #endif
38
39 int
40 main ()
41 {
42 int i;
43 check_vect ();
44 if (sizeof (int) * __CHAR_BIT__ < 32)
45 return 0;
46 bar (a + 7);
47 #pragma GCC novector
48 for (i = 0; i < N / 2; i++)
49 if (a[i + 7] != (i ^ (i * 3 * 512) ^ (((i * 6) + 2) * 512 * 512)))
50 abort ();
51 bar (a);
52 #pragma GCC novector
53 for (i = 0; i < N / 2; i++)
54 if (a[i] != (i ^ (i * 3 * 512) ^ (((i * 6) + 2) * 512 * 512)))
55 abort ();
56 #if 0
57 baz (a + 7);
58 #pragma GCC novector
59 for (i = 0; i < N / 2; i++)
60 if (a[i + 7] != (i ^ (i * 3 * 512) ^ (((i * 6) + 2) * 512 * 512)))
61 abort ();
62 baz (a);
63 #pragma GCC novector
64 for (i = 0; i < N / 2; i++)
65 if (a[i] != (i ^ (i * 3 * 512) ^ (((i * 6) + 2) * 512 * 512)))
66 abort ();
67 #endif
68 return 0;
69 }
70