]> git.ipfire.org Git - thirdparty/gcc.git/blame - 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
CommitLineData
7c82d827 1/* { dg-do run } */
d7bfc710 2/* { dg-additional-options "-ftree-parallelize-loops=2" } */
7c82d827 3
ab3306d2
TV
4/* Variable bound, vector addition. */
5
7c82d827
TV
6#include <stdio.h>
7#include <stdlib.h>
8
9#define N 1000
10
11unsigned int a[N];
12unsigned int b[N];
13unsigned int c[N];
14
15void __attribute__((noclone,noinline))
4f75d608
TV
16f (unsigned int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b,
17 unsigned int *__restrict__ c)
7c82d827
TV
18{
19 int i;
20
21 for (i = 0; i < n; ++i)
22 c[i] = a[i] + b[i];
23}
24
25int
26main (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
4f75d608 40 f (N, a, b, c);
7c82d827
TV
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}