PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-simd-clone-11.c
blob29acde22f1783e8b11376d1ae2e702e09182350c
1 /* { dg-require-effective-target vect_simd_clones } */
2 /* { dg-additional-options "-fopenmp-simd" } */
3 /* { dg-additional-options "-mavx" { target avx_runtime } } */
5 #include "tree-vect.h"
7 #ifndef N
8 #define N 1024
9 #endif
11 int a[N] __attribute__((aligned (32)));
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)
17 return a ^ (b * 512) ^ (c * 512 * 512);
20 __attribute__((noinline, noclone)) void
21 bar (int *d)
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);
28 #if 0
29 __attribute__((noinline, noclone)) void
30 baz (int *d)
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);
37 #endif
39 int
40 main ()
42 int i;
43 check_vect ();
44 if (sizeof (int) * __CHAR_BIT__ < 32)
45 return 0;
46 bar (a + 7);
47 for (i = 0; i < N / 2; i++)
48 if (a[i + 7] != (i ^ (i * 3 * 512) ^ (((i * 6) + 2) * 512 * 512)))
49 abort ();
50 bar (a);
51 for (i = 0; i < N / 2; i++)
52 if (a[i] != (i ^ (i * 3 * 512) ^ (((i * 6) + 2) * 512 * 512)))
53 abort ();
54 #if 0
55 baz (a + 7);
56 for (i = 0; i < N / 2; i++)
57 if (a[i + 7] != (i ^ (i * 3 * 512) ^ (((i * 6) + 2) * 512 * 512)))
58 abort ();
59 baz (a);
60 for (i = 0; i < N / 2; i++)
61 if (a[i] != (i ^ (i * 3 * 512) ^ (((i * 6) + 2) * 512 * 512)))
62 abort ();
63 #endif
64 return 0;