]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c
Add empty loop exit block in transform_to_exit_first_loop_alt
[thirdparty/gcc.git] / libgomp / testsuite / libgomp.c / parloops-exit-first-loop-alt-3.c
CommitLineData
7c82d827 1/* { dg-do run } */
d7bfc710 2/* { dg-additional-options "-ftree-parallelize-loops=2" } */
7c82d827 3
ab3306d2
TV
4/* Variable bound, reduction. */
5
1222f22b
TV
6#include <stdlib.h>
7
ab3306d2
TV
8#define N 4000
9
7c82d827
TV
10unsigned int *a;
11
12unsigned int __attribute__((noclone,noinline))
4f75d608 13f (unsigned int n, unsigned int *__restrict__ a)
7c82d827
TV
14{
15 int i;
16 unsigned int sum = 1;
17
18 for (i = 0; i < n; ++i)
19 sum += a[i];
20
21 return sum;
22}
23
24int
25main (void)
26{
27 unsigned int res;
ab3306d2 28 unsigned int array[N];
7c82d827 29 int i;
1222f22b 30
ab3306d2 31 for (i = 0; i < N; ++i)
7c82d827
TV
32 array[i] = i % 7;
33 a = &array[0];
1222f22b 34
4f75d608 35 res = f (N, a);
1222f22b
TV
36 if (res != 11995)
37 abort ();
38
712cb0bb
TV
39 /* Test low iteration count case. */
40 res = f (10);
41 if (res != 25)
42 abort ();
43
1222f22b 44 return 0;
7c82d827 45}