libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr59984.c
blobc00c2267158667784fb084b0ade19e2ab763c6a3
1 /* PR c/59984 */
2 /* { dg-require-effective-target vect_simd_clones } */
3 /* { dg-additional-options "-fopenmp-simd" } */
5 #include "tree-vect.h"
7 #define N 128
9 int a[N];
11 #pragma omp declare simd
12 __attribute__((noinline)) void
13 foo (int in, int *out1, int *out2)
15 *out1 = in * in - 1;
16 *out2 = in * in + 1;
19 #pragma omp declare simd linear (out1, out2)
20 __attribute__((noinline)) void
21 bar (int in, int *out1, int *out2)
23 *out1 = in * in - 1;
24 *out2 = in * in + 1;
27 __attribute__((noinline)) void
28 test (void)
30 int i;
31 for (i = 0; i < N; i++)
32 a[i] = i;
33 #pragma omp simd
34 for (i = 0; i < N; i++)
36 int v1, v2;
37 foo (a[i], &v1, &v2);
38 a[i] = v1 * v2;
40 #pragma GCC novector
41 for (i = 0; i < N; i++)
42 if (a[i] != i * i * i * i - 1)
43 __builtin_abort ();
44 for (i = 0; i < N; i++)
45 a[i] = i;
46 #pragma omp simd
47 for (i = 0; i < N; i++)
49 int v1, v2;
50 bar (a[i], &v1, &v2);
51 a[i] = v1 * v2;
53 #pragma GCC novector
54 for (i = 0; i < N; i++)
55 if (a[i] != i * i * i * i - 1)
56 __builtin_abort ();
59 int
60 main ()
62 check_vect ();
63 test ();
64 return 0;