diff options
Diffstat (limited to 'libgomp')
41 files changed, 400 insertions, 38 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index a01f9b2816c..4e4fcc32e8e 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,67 @@ +2015-06-30 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.oacc-c++/c++.exp: Set DEFAULT_CFLAGS to -O2 if not + already set. Use DEFAULT_CFLAGS in dg-runtest. + * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Remove dg-options + "-O2". + +2015-06-30 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.c++/c++.exp: Set DEFAULT_CFLAGS to -O2 if not + already set. Use DEFAULT_CFLAGS in dg-runtest. + * testsuite/libgomp.c++/atomic-16.C: Remove dg-options "-O2 -fopenmp". + * testsuite/libgomp.c++/pr64824.C: Same. + * testsuite/libgomp.c++/pr64868.C: Same. + * testsuite/libgomp.c++/pr66199-1.C: Same. + * testsuite/libgomp.c++/pr66199-2.C: Same. + * testsuite/libgomp.c++/target-2.C: Same. + * testsuite/libgomp.c++/for-7.C: Use dg-additional-options for + -std=<standard> option. + * testsuite/libgomp.c++/udr-11.C: Same. + * testsuite/libgomp.c++/udr-12.C: Same. + * testsuite/libgomp.c++/udr-13.C: Same. + * testsuite/libgomp.c++/udr-14.C: Same. + * testsuite/libgomp.c++/udr-15.C: Same. + * testsuite/libgomp.c++/udr-16.C: Same. + * testsuite/libgomp.c++/udr-17.C: Same. + * testsuite/libgomp.c++/udr-18.C: Same. + * testsuite/libgomp.c++/udr-19.C: Same. + * testsuite/libgomp.c++/atomic-1.C: Remove dg-options "-O2". + * testsuite/libgomp.c++/simd-1.C: Same. + * testsuite/libgomp.c++/simd-2.C: Same. + * testsuite/libgomp.c++/simd-3.C: Same. + * testsuite/libgomp.c++/simd-4.C: Same. + * testsuite/libgomp.c++/simd-5.C: Same. + * testsuite/libgomp.c++/simd-6.C: Same. + * testsuite/libgomp.c++/simd-7.C: Same. + * testsuite/libgomp.c++/simd-8.C: Same. + * testsuite/libgomp.c++/simd-9.C: Same. + * testsuite/libgomp.c++/simd10.C: Same. + * testsuite/libgomp.c++/simd11.C: Same. + * testsuite/libgomp.c++/simd12.C: Same. + * testsuite/libgomp.c++/simd13.C: Same. + +2015-06-30 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/66702 + * testsuite/libgomp.c++/pr66702-1.C: New test. + * testsuite/libgomp.c++/pr66702-2.C: New test. + +2015-06-30 Tom de Vries <tom@codesourcery.com> + + * testsuite/libgomp.c/parloops-exit-first-loop-alt-5.c: New test. + * testsuite/libgomp.c/parloops-exit-first-loop-alt-6.c: New test. + * testsuite/libgomp.c/parloops-exit-first-loop-alt-7.c: New test. + * testsuite/libgomp.c/parloops-exit-first-loop-alt.c: Update comment. + +2015-06-30 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/66652 + * testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c (f): Rewrite + using restrict pointers. + (main): Add arguments to calls to f. + * testsuite/libgomp.c/parloops-exit-first-loop-alt.c: Same. + 2015-06-23 Andreas Tobler <andreast@gcc.gnu.org> * configure.ac: Fix check for header <sys/sysctl.h>. diff --git a/libgomp/testsuite/libgomp.c++/atomic-1.C b/libgomp/testsuite/libgomp.c++/atomic-1.C index 73f6e7c4059..9eecfbbe77d 100644 --- a/libgomp/testsuite/libgomp.c++/atomic-1.C +++ b/libgomp/testsuite/libgomp.c++/atomic-1.C @@ -1,6 +1,5 @@ // PR c++/33894 // { dg-do run } -// { dg-options "-O2" } extern "C" void abort (); diff --git a/libgomp/testsuite/libgomp.c++/atomic-16.C b/libgomp/testsuite/libgomp.c++/atomic-16.C index afccd52bb66..432d36dd7da 100644 --- a/libgomp/testsuite/libgomp.c++/atomic-16.C +++ b/libgomp/testsuite/libgomp.c++/atomic-16.C @@ -1,5 +1,4 @@ // PR c/64824 // { dg-do run } -// { dg-options "-O2 -fopenmp" } #include "../libgomp.c/atomic-18.c" diff --git a/libgomp/testsuite/libgomp.c++/c++.exp b/libgomp/testsuite/libgomp.c++/c++.exp index da42e6213b0..0454f95588e 100644 --- a/libgomp/testsuite/libgomp.c++/c++.exp +++ b/libgomp/testsuite/libgomp.c++/c++.exp @@ -11,6 +11,11 @@ if [info exists lang_include_flags] then { unset lang_include_flags } +# If a testcase doesn't have special options, use these. +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS "-O2" +} + # Initialize dg. dg-init @@ -60,7 +65,7 @@ if { $lang_test_file_found } { } # Main loop. - dg-runtest $tests "" $libstdcxx_includes + dg-runtest $tests "" "$libstdcxx_includes $DEFAULT_CFLAGS" } # All done. diff --git a/libgomp/testsuite/libgomp.c++/for-7.C b/libgomp/testsuite/libgomp.c++/for-7.C index 9d626c028df..256a1312e4f 100644 --- a/libgomp/testsuite/libgomp.c++/for-7.C +++ b/libgomp/testsuite/libgomp.c++/for-7.C @@ -1,6 +1,6 @@ // PR c++/ // { dg-do run } -// { dg-options "-std=c++0x -fopenmp" } +// { dg-additional-options "-std=c++0x" } extern "C" void abort (); int cnt; diff --git a/libgomp/testsuite/libgomp.c++/pr64824.C b/libgomp/testsuite/libgomp.c++/pr64824.C index 348f6d6e0c2..00f23bb728c 100644 --- a/libgomp/testsuite/libgomp.c++/pr64824.C +++ b/libgomp/testsuite/libgomp.c++/pr64824.C @@ -1,5 +1,4 @@ // PR c/64824 // { dg-do run } -// { dg-options "-O2 -fopenmp" } #include "../libgomp.c/pr64824.c" diff --git a/libgomp/testsuite/libgomp.c++/pr64868.C b/libgomp/testsuite/libgomp.c++/pr64868.C index 2d730ac4924..661ec232dd3 100644 --- a/libgomp/testsuite/libgomp.c++/pr64868.C +++ b/libgomp/testsuite/libgomp.c++/pr64868.C @@ -1,5 +1,4 @@ // PR c/64868 // { dg-do run } -// { dg-options "-O2 -fopenmp" } #include "../libgomp.c/pr64868.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-1.C b/libgomp/testsuite/libgomp.c++/pr66199-1.C index 2139e11b51c..cb86a60fa26 100644 --- a/libgomp/testsuite/libgomp.c++/pr66199-1.C +++ b/libgomp/testsuite/libgomp.c++/pr66199-1.C @@ -1,5 +1,4 @@ // PR middle-end/66199 // { dg-do run } -// { dg-options "-O2 -fopenmp" } #include "../libgomp.c/pr66199-1.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66199-2.C b/libgomp/testsuite/libgomp.c++/pr66199-2.C index 36392da270a..1dbccb6c0e5 100644 --- a/libgomp/testsuite/libgomp.c++/pr66199-2.C +++ b/libgomp/testsuite/libgomp.c++/pr66199-2.C @@ -1,5 +1,4 @@ // PR middle-end/66199 // { dg-do run } -// { dg-options "-O2 -fopenmp" } #include "../libgomp.c/pr66199-2.c" diff --git a/libgomp/testsuite/libgomp.c++/pr66702-1.C b/libgomp/testsuite/libgomp.c++/pr66702-1.C new file mode 100644 index 00000000000..15772561b1a --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr66702-1.C @@ -0,0 +1,49 @@ +// PR middle-end/66702 +// { dg-options "-O2" } +// { dg-additional-options "-msse2" { target sse2_runtime } } +// { dg-additional-options "-mavx" { target avx_runtime } } + +void +bar (int &a, int &b, int *&c, int &d) +{ + volatile int x; + int *volatile y; + x = a; a = x; + x = b; b = x; + y = c; c = y; + x = d; d = x; +} + +void (*volatile barp) (int &, int &, int *&, int &) = bar; + +#pragma omp declare simd uniform(b, c) linear(d:2) aligned(c:32) notinbranch +int +foo (int a, int b, int *c, int d) +{ + a++; + b++; + c += 8; + d += 2; + barp (a, b, c, d); + return a + b + *c + d; +} + +volatile int e = 5; +int c[64] __attribute__((aligned (32))); + +int +main () +{ + int d = 7, r = 0; + int b = e; + for (int i = 0; i < 64; i++) + c[i] = i; + #pragma omp simd reduction(+:r) linear(d:2) + for (int i = 0; i < 64; i++) + { + r += foo (i, b, c, d); + d += 2; + } + if (r != 7584) + __builtin_abort (); +} diff --git a/libgomp/testsuite/libgomp.c++/pr66702-2.C b/libgomp/testsuite/libgomp.c++/pr66702-2.C new file mode 100644 index 00000000000..7de3de010a7 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr66702-2.C @@ -0,0 +1,34 @@ +// PR middle-end/66702 +// { dg-options "-O2" } +// { dg-additional-options "-msse2" { target sse2_runtime } } +// { dg-additional-options "-mavx" { target avx_runtime } } + +struct S { int s1, s2; }; +struct T { T (); ~T (); int t; }; + +T::T () : t(0) {} +T::~T () {} + +#pragma omp declare simd uniform(b, c) notinbranch +__attribute__((noinline)) int +foo (int a, S b, T c) +{ + a++; + b.s1++; + b.s2++; + c.t++; + return a + b.s1 + b.s2 + c.t; +} + +int +main () +{ + int r = 0; + S s = { 2, 3 }; + T t; + #pragma omp simd reduction(+:r) + for (int i = 0; i < 64; i++) + r += foo (i, s, t); + if (r != 2592) + __builtin_abort (); +} diff --git a/libgomp/testsuite/libgomp.c++/simd-1.C b/libgomp/testsuite/libgomp.c++/simd-1.C index 16ef159b827..139386f085a 100644 --- a/libgomp/testsuite/libgomp.c++/simd-1.C +++ b/libgomp/testsuite/libgomp.c++/simd-1.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-2.C b/libgomp/testsuite/libgomp.c++/simd-2.C index 6b12415bdce..8205d6449c8 100644 --- a/libgomp/testsuite/libgomp.c++/simd-2.C +++ b/libgomp/testsuite/libgomp.c++/simd-2.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-3.C b/libgomp/testsuite/libgomp.c++/simd-3.C index 1c6d8e01af9..195261d820e 100644 --- a/libgomp/testsuite/libgomp.c++/simd-3.C +++ b/libgomp/testsuite/libgomp.c++/simd-3.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-4.C b/libgomp/testsuite/libgomp.c++/simd-4.C index bdfacc65264..b81f230b25d 100644 --- a/libgomp/testsuite/libgomp.c++/simd-4.C +++ b/libgomp/testsuite/libgomp.c++/simd-4.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-5.C b/libgomp/testsuite/libgomp.c++/simd-5.C index 6c4627e210a..e7cea84548c 100644 --- a/libgomp/testsuite/libgomp.c++/simd-5.C +++ b/libgomp/testsuite/libgomp.c++/simd-5.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-6.C b/libgomp/testsuite/libgomp.c++/simd-6.C index cfc13d0a0f9..fa93dfd5989 100644 --- a/libgomp/testsuite/libgomp.c++/simd-6.C +++ b/libgomp/testsuite/libgomp.c++/simd-6.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-7.C b/libgomp/testsuite/libgomp.c++/simd-7.C index 5a6f4cef7c1..a0bdac5e1b7 100644 --- a/libgomp/testsuite/libgomp.c++/simd-7.C +++ b/libgomp/testsuite/libgomp.c++/simd-7.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-8.C b/libgomp/testsuite/libgomp.c++/simd-8.C index 7c758328529..bc13254fdd3 100644 --- a/libgomp/testsuite/libgomp.c++/simd-8.C +++ b/libgomp/testsuite/libgomp.c++/simd-8.C @@ -1,6 +1,5 @@ // PR libgomp/58482 // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd-9.C b/libgomp/testsuite/libgomp.c++/simd-9.C index 3c567b31c3e..8f21bf2209a 100644 --- a/libgomp/testsuite/libgomp.c++/simd-9.C +++ b/libgomp/testsuite/libgomp.c++/simd-9.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd10.C b/libgomp/testsuite/libgomp.c++/simd10.C index 390e65ffea3..6fab68852a4 100644 --- a/libgomp/testsuite/libgomp.c++/simd10.C +++ b/libgomp/testsuite/libgomp.c++/simd10.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd11.C b/libgomp/testsuite/libgomp.c++/simd11.C index b9668685601..fde22034a60 100644 --- a/libgomp/testsuite/libgomp.c++/simd11.C +++ b/libgomp/testsuite/libgomp.c++/simd11.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd12.C b/libgomp/testsuite/libgomp.c++/simd12.C index ecfc912aeea..7596cad8571 100644 --- a/libgomp/testsuite/libgomp.c++/simd12.C +++ b/libgomp/testsuite/libgomp.c++/simd12.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/simd13.C b/libgomp/testsuite/libgomp.c++/simd13.C index f7496209680..67a0f70ff16 100644 --- a/libgomp/testsuite/libgomp.c++/simd13.C +++ b/libgomp/testsuite/libgomp.c++/simd13.C @@ -1,5 +1,4 @@ // { dg-do run } -// { dg-options "-O2" } // { dg-additional-options "-msse2" { target sse2_runtime } } // { dg-additional-options "-mavx" { target avx_runtime } } diff --git a/libgomp/testsuite/libgomp.c++/target-2.C b/libgomp/testsuite/libgomp.c++/target-2.C index 83207cd51cd..35e910acc2e 100644 --- a/libgomp/testsuite/libgomp.c++/target-2.C +++ b/libgomp/testsuite/libgomp.c++/target-2.C @@ -1,4 +1,3 @@ -// { dg-options "-O2 -fopenmp" } // { dg-additional-sources "target-2-aux.cc" } extern "C" void abort (void); diff --git a/libgomp/testsuite/libgomp.c++/udr-11.C b/libgomp/testsuite/libgomp.c++/udr-11.C index 5d014467a9d..ee4bde319ad 100644 --- a/libgomp/testsuite/libgomp.c++/udr-11.C +++ b/libgomp/testsuite/libgomp.c++/udr-11.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-1.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-12.C b/libgomp/testsuite/libgomp.c++/udr-12.C index 58112eb6995..1d661baba56 100644 --- a/libgomp/testsuite/libgomp.c++/udr-12.C +++ b/libgomp/testsuite/libgomp.c++/udr-12.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-2.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-13.C b/libgomp/testsuite/libgomp.c++/udr-13.C index a9c8c600ca2..8e24ffd5007 100644 --- a/libgomp/testsuite/libgomp.c++/udr-13.C +++ b/libgomp/testsuite/libgomp.c++/udr-13.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-3.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-14.C b/libgomp/testsuite/libgomp.c++/udr-14.C index 6cb48293286..49fabcbbdfc 100644 --- a/libgomp/testsuite/libgomp.c++/udr-14.C +++ b/libgomp/testsuite/libgomp.c++/udr-14.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-4.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-15.C b/libgomp/testsuite/libgomp.c++/udr-15.C index d6aaf872029..e55101a0052 100644 --- a/libgomp/testsuite/libgomp.c++/udr-15.C +++ b/libgomp/testsuite/libgomp.c++/udr-15.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-5.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-16.C b/libgomp/testsuite/libgomp.c++/udr-16.C index acf4ff2028d..50fe6724bb2 100644 --- a/libgomp/testsuite/libgomp.c++/udr-16.C +++ b/libgomp/testsuite/libgomp.c++/udr-16.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-6.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-17.C b/libgomp/testsuite/libgomp.c++/udr-17.C index a5b62f8c67f..770b50d764d 100644 --- a/libgomp/testsuite/libgomp.c++/udr-17.C +++ b/libgomp/testsuite/libgomp.c++/udr-17.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-7.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-18.C b/libgomp/testsuite/libgomp.c++/udr-18.C index 5911e8e9a82..fb1f10c7508 100644 --- a/libgomp/testsuite/libgomp.c++/udr-18.C +++ b/libgomp/testsuite/libgomp.c++/udr-18.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-8.C" diff --git a/libgomp/testsuite/libgomp.c++/udr-19.C b/libgomp/testsuite/libgomp.c++/udr-19.C index 801cab4342e..40d2eb9aeed 100644 --- a/libgomp/testsuite/libgomp.c++/udr-19.C +++ b/libgomp/testsuite/libgomp.c++/udr-19.C @@ -1,4 +1,4 @@ // { dg-do run } -// { dg-options "-fopenmp -std=c++11" } +// { dg-additional-options "-std=c++11" } #include "udr-9.C" diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c index cb5bf9cb8c5..7de1377cd56 100644 --- a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c @@ -10,7 +10,7 @@ unsigned int *a; unsigned int __attribute__((noclone,noinline)) -f (unsigned int n) +f (unsigned int n, unsigned int *__restrict__ a) { int i; unsigned int sum = 1; @@ -32,7 +32,7 @@ main (void) array[i] = i % 7; a = &array[0]; - res = f (N); + res = f (N, a); if (res != 11995) abort (); diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-5.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-5.c new file mode 100644 index 00000000000..d8d49b41aa5 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-5.c @@ -0,0 +1,75 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-parallelize-loops=2" } */ + +/* Variable bound, vector addition, unsigned loop counter, unsigned bound. */ + +#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, unsigned int *__restrict__ a, unsigned int *__restrict__ b, + unsigned int *__restrict__ c) +{ + unsigned int i; + + for (i = 0; i < n; ++i) + c[i] = a[i] + b[i]; +} + +static void __attribute__((noclone,noinline)) +init (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; + } +} + +int +main (void) +{ + int i; + + init (); + + f (N, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = i + ((i * 3) % 7); + if (actual != expected) + abort (); + } + + /* Test low iteration count case. */ + + init (); + + f (10, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = (i < 10 + ? i + ((i * 3) % 7) + : i * 2); + if (actual != expected) + abort (); + } + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-6.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-6.c new file mode 100644 index 00000000000..99c61c0c967 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-6.c @@ -0,0 +1,75 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-parallelize-loops=2" } */ + +/* Variable bound, vector addition, unsigned loop counter, signed bound. */ + +#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 (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, + unsigned int *__restrict__ c) +{ + unsigned int i; + + for (i = 0; i < n; ++i) + c[i] = a[i] + b[i]; +} + +static void __attribute__((noclone,noinline)) +init (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; + } +} + +int +main (void) +{ + int i; + + init (); + + f (N, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = i + ((i * 3) % 7); + if (actual != expected) + abort (); + } + + /* Test low iteration count case. */ + + init (); + + f (10, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = (i < 10 + ? i + ((i * 3) % 7) + : i * 2); + if (actual != expected) + abort (); + } + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-7.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-7.c new file mode 100644 index 00000000000..1f6e5e42ea4 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt-7.c @@ -0,0 +1,75 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-parallelize-loops=2" } */ + +/* Variable bound, vector addition, signed loop counter, signed bound. */ + +#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 (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, + unsigned int *__restrict__ c) +{ + int i; + + for (i = 0; i < n; ++i) + c[i] = a[i] + b[i]; +} + +static void __attribute__((noclone,noinline)) +init (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; + } +} + +int +main (void) +{ + int i; + + init (); + + f (N, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = i + ((i * 3) % 7); + if (actual != expected) + abort (); + } + + /* Test low iteration count case. */ + + init (); + + f (10, a, b, c); + + for (i = 0; i < N; i++) + { + unsigned int actual = c[i]; + unsigned int expected = (i < 10 + ? i + ((i * 3) % 7) + : i * 2); + if (actual != expected) + abort (); + } + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c index 1c32ea33f7b..d67a4f67ece 100644 --- a/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c +++ b/libgomp/testsuite/libgomp.c/parloops-exit-first-loop-alt.c @@ -1,7 +1,7 @@ /* { dg-do run } */ /* { dg-additional-options "-ftree-parallelize-loops=2" } */ -/* Variable bound, vector addition. */ +/* Variable bound, vector addition, signed loop counter, unsigned bound. */ #include <stdio.h> #include <stdlib.h> @@ -13,7 +13,8 @@ unsigned int b[N]; unsigned int c[N]; void __attribute__((noclone,noinline)) -f (unsigned int n) +f (unsigned int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, + unsigned int *__restrict__ c) { int i; @@ -36,7 +37,7 @@ main (void) c[k] = k * 2; } - f (N); + f (N, a, b, c); for (i = 0; i < N; i++) { diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp index f486f9b97ba..80d135919cf 100644 --- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp +++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp @@ -13,6 +13,11 @@ if [info exists lang_include_flags] then { unset lang_include_flags } +# If a testcase doesn't have special options, use these. +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS "-O2" +} + # Initialize dg. dg-init @@ -96,7 +101,7 @@ if { $lang_test_file_found } { setenv ACC_DEVICE_TYPE $offload_target_openacc - dg-runtest $tests "$tagopt" $libstdcxx_includes + dg-runtest $tests "$tagopt" "$libstdcxx_includes $DEFAULT_CFLAGS" } } diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-3.c index a5be7287d22..680042892e4 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-3.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-3.c @@ -1,5 +1,4 @@ /* { dg-do run } */ -/* { dg-options "-O2" } */ #include <string.h> #include <stdlib.h> |