diff options
author | Tom de Vries <tom@codesourcery.com> | 2015-06-05 15:57:34 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2015-06-05 15:57:34 +0000 |
commit | 7c82d82716dd3e5c3377b2392e02e9c2454382fa (patch) | |
tree | 299636b9713d77014b892241dd301e1b62c714b3 /libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c | |
parent | ddb63209a8dc059a7b2a137d7a1859222bb43dd6 (diff) | |
download | gcc-7c82d82716dd3e5c3377b2392e02e9c2454382fa.zip gcc-7c82d82716dd3e5c3377b2392e02e9c2454382fa.tar.gz gcc-7c82d82716dd3e5c3377b2392e02e9c2454382fa.tar.bz2 |
Add transform_to_exit_first_loop_alt
2015-06-05 Tom de Vries <tom@codesourcery.com>
merge from gomp4 branch:
2015-05-28 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/65443
* tree-parloops.c (replace_imm_uses, replace_uses_in_bb_by)
(replace_uses_in_bbs_by, transform_to_exit_first_loop_alt)
(try_transform_to_exit_first_loop_alt): New function.
(transform_to_exit_first_loop): Use
try_transform_to_exit_first_loop_alt.
* gcc.dg/parloops-exit-first-loop-alt-2.c: New test.
* gcc.dg/parloops-exit-first-loop-alt-3.c: New test.
* gcc.dg/parloops-exit-first-loop-alt.c: New test.
* testsuite/libgomp.c/parloops-exit-first-loop-alt-2.c: New test.
* testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c: New test.
* testsuite/libgomp.c/parloops-exit-first-loop-alt.c: New test.
From-SVN: r224154
Diffstat (limited to 'libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c')
-rw-r--r-- | libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c new file mode 100644 index 0000000..d7d4003 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c @@ -0,0 +1,48 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2" } */ + +#include <stdio.h> +#include <stdlib.h> + +#define N 1000 + +unsigned int a[N]; +unsigned int b[N]; +unsigned int c[N]; + +void __attribute__((noclone,noinline)) +f (unsigned int n) +{ + int i; + + for (i = 0; i < n; ++i) + c[i] = a[i] + b[i]; +} + +int +main (void) +{ + int i, j; + + /* Complexify loop to inhibit parloops. */ + for (j = 0; j < 100; ++j) + for (i = 0; i < 10; i++) + { + int k = i + (10 * j); + a[k] = k; + b[k] = (k * 3) % 7; + c[k] = k * 2; + } + + f (N); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = i + ((i * 3) % 7); + if (actual != expected) + abort (); + } + + return 0; +} |