Merge from trunk
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr59984.c
blob1b95942955db488cee7c0c83bbd69b3dc85035e7
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 for (i = 0; i < N; i++)
41 if (a[i] != i * i * i * i - 1)
42 __builtin_abort ();
43 for (i = 0; i < N; i++)
44 a[i] = i;
45 #pragma omp simd
46 for (i = 0; i < N; i++)
48 int v1, v2;
49 bar (a[i], &v1, &v2);
50 a[i] = v1 * v2;
52 for (i = 0; i < N; i++)
53 if (a[i] != i * i * i * i - 1)
54 __builtin_abort ();
57 int
58 main ()
60 check_vect ();
61 test ();
62 return 0;
65 /* { dg-final { cleanup-tree-dump "vect" } } */