]> git.ipfire.org Git - thirdparty/gcc.git/blob - libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c
Use max_loop_iterations in transform_to_exit_first_loop_alt
[thirdparty/gcc.git] / libgomp / testsuite / libgomp.c / parloops-exit-first-loop-alt.c
1 /* { dg-do run } */
2 /* { dg-additional-options "-ftree-parallelize-loops=2" } */
3
4 /* Variable bound, vector addition. */
5
6 #include <stdio.h>
7 #include <stdlib.h>
8
9 #define N 1000
10
11 unsigned int a[N];
12 unsigned int b[N];
13 unsigned int c[N];
14
15 void __attribute__((noclone,noinline))
16 f (unsigned int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b,
17 unsigned int *__restrict__ c)
18 {
19 int i;
20
21 for (i = 0; i < n; ++i)
22 c[i] = a[i] + b[i];
23 }
24
25 int
26 main (void)
27 {
28 int i, j;
29
30 /* Complexify loop to inhibit parloops. */
31 for (j = 0; j < 100; ++j)
32 for (i = 0; i < 10; i++)
33 {
34 int k = i + (10 * j);
35 a[k] = k;
36 b[k] = (k * 3) % 7;
37 c[k] = k * 2;
38 }
39
40 f (N, a, b, c);
41
42 for (i = 0; i < N; i++)
43 {
44 unsigned int actual = c[i];
45 unsigned int expected = i + ((i * 3) % 7);
46 if (actual != expected)
47 abort ();
48 }
49
50 return 0;
51 }