libstdc++: remove JSON comment.
[official-gcc.git] / libgomp / testsuite / libgomp.c / parloops-exit-first-loop-alt-7.c
blob1f6e5e42ea48991210b5b3ec3b3c999a476080c2
1 /* { dg-do run } */
2 /* { dg-additional-options "-ftree-parallelize-loops=2" } */
4 /* Variable bound, vector addition, signed loop counter, signed bound. */
6 #include <stdio.h>
7 #include <stdlib.h>
9 #define N 1000
11 unsigned int a[N];
12 unsigned int b[N];
13 unsigned int c[N];
15 void __attribute__((noclone,noinline))
16 f (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b,
17 unsigned int *__restrict__ c)
19 int i;
21 for (i = 0; i < n; ++i)
22 c[i] = a[i] + b[i];
25 static void __attribute__((noclone,noinline))
26 init (void)
28 int i, j;
30 /* Complexify loop to inhibit parloops. */
31 for (j = 0; j < 100; ++j)
32 for (i = 0; i < 10; i++)
34 int k = i + (10 * j);
35 a[k] = k;
36 b[k] = (k * 3) % 7;
37 c[k] = k * 2;
41 int
42 main (void)
44 int i;
46 init ();
48 f (N, a, b, c);
50 for (i = 0; i < N; i++)
52 unsigned int actual = c[i];
53 unsigned int expected = i + ((i * 3) % 7);
54 if (actual != expected)
55 abort ();
58 /* Test low iteration count case. */
60 init ();
62 f (10, a, b, c);
64 for (i = 0; i < N; i++)
66 unsigned int actual = c[i];
67 unsigned int expected = (i < 10
68 ? i + ((i * 3) % 7)
69 : i * 2);
70 if (actual != expected)
71 abort ();
74 return 0;