C++: simplify output from suggest_alternatives_for
[official-gcc.git] / libgomp / testsuite / libgomp.c / examples-4 / target-1.c
blob45adbe00f3c6c99a275e44c3721603950249de2f
1 /* { dg-do run } */
3 #include <stdlib.h>
5 #define N 100000
7 void init (int *a1, int *a2)
9 int i, s = -1;
10 for (i = 0; i < N; i++)
12 a1[i] = s;
13 a2[i] = i;
14 s = -s;
18 void check (int *a, int *b)
20 int i;
21 for (i = 0; i < N; i++)
22 if (a[i] != b[i])
23 abort ();
26 void vec_mult_ref (int *p)
28 int i;
29 int v1[N], v2[N];
31 init (v1, v2);
33 for (i = 0; i < N; i++)
34 p[i] = v1[i] * v2[i];
37 void vec_mult (int *p)
39 int i;
40 int v1[N], v2[N];
42 init (v1, v2);
44 #pragma omp target map(p[0:N])
45 #pragma omp parallel for
46 for (i = 0; i < N; i++)
47 p[i] = v1[i] * v2[i];
50 int main ()
52 int p1[N], p2[N];
53 int v1[N], v2[N];
55 init (v1, v2);
57 vec_mult_ref (p1);
58 vec_mult (p2);
60 check (p1, p2);
62 return 0;