@@ -1,3 +1,39 @@
+2016-03-24 Thomas Schwinge <thomas@codesourcery.com>
+
+ * testsuite/libgomp.oacc-c++/c++.exp: Set up torture testing, use
+ gcc-dg-runtest.
+ * testsuite/libgomp.oacc-c/c.exp: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c: Specify
+ -fno-builtin-acc_on_device instead of -O0.
+ * testsuite/libgomp.oacc-c-c++-common/acc-on-device.c: Skip for
+ -O0.
+ * testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c:
+ Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-g-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-g-2.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-v-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/routine-g-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/routine-v-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/routine-w-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c: Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c:
+ Don't specify -O2.
+ * testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c:
+ Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c:
+ Likewise.
+
2016-03-24 Martin Liska <mliska@suse.cz>
* plugin/plugin-hsa.c (packet_store_release): New function
@@ -1,14 +1,8 @@
# This whole file adapted from libgomp.c++/c++.exp.
-# To avoid testing time exploding too much, limit any torture testing to -O0
-# and -O2 only, under the assumption that between -O0 and -O[something] there
-# is the biggest difference in the overall structure of the generated code.
-set TORTURE_OPTIONS [list \
- { -O0 } \
- { -O2 } ]
-
load_lib libgomp-dg.exp
load_gcc_lib gcc-dg.exp
+load_gcc_lib torture-options.exp
global shlib_ext
@@ -20,13 +14,9 @@ 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
+torture-init
# Turn on OpenACC.
lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
@@ -64,22 +54,6 @@ if { $lang_test_file_found } {
set tests [lsort [concat \
[find $srcdir/$subdir *.C] \
[find $srcdir/$subdir/../libgomp.oacc-c-c++-common *.c]]]
- # To get better test coverage for device-specific code that is only ever
- # used in offloading configurations, we'd like more thorough (torture)
- # testing for test cases that are dealing with the specifics of
- # gang/worker/vector single/redundant/partitioned modes. They're selected
- # based on their file names -- not a perfect property to detect such test
- # cases, but should be sufficient.
- set ttests [lsort -unique [concat \
- [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *gang*.c] \
- [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *worker*.c] \
- [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *vec*.c]]]
- # tests := tests - ttests.
- foreach t $ttests {
- set i [lsearch -exact $tests $t]
- set tests [lreplace $tests $i $i]
- }
-
if { $blddir != "" } {
set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
@@ -130,15 +104,32 @@ if { $lang_test_file_found } {
}
set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared -foffload=$offload_target_openacc"
- dg-runtest $tests "$tagopt" "$libstdcxx_includes $DEFAULT_CFLAGS"
- gcc-dg-runtest $ttests "$tagopt" "$libstdcxx_includes"
+ # To get better test coverage for device-specific code that is only
+ # ever used in offloading configurations, we'd like more thorough
+ # testing for test cases that deal with offloading, which most of all
+ # OpenACC test cases are. We enable torture testing, but limit it to
+ # -O0 and -O2 only, to avoid testing times exploding too much, under
+ # the assumption that between -O0 and -O[something] there is the
+ # biggest difference in the overall structure of the generated code.
+ switch -glob $offload_target_openacc {
+ disable {
+ set-torture-options [list \
+ { -O2 } ]
+ }
+ default {
+ set-torture-options [list \
+ { -O0 } \
+ { -O2 } ]
+ }
+ }
+
+ gcc-dg-runtest $tests "$tagopt" "$libstdcxx_includes"
}
}
# See above.
set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
-unset TORTURE_OPTIONS
-
# All done.
+torture-finish
dg-finish
@@ -1,9 +1,8 @@
-/* { dg-additional-options "-O0" } */
+/* Test the acc_on_device library function. */
+/* { dg-additional-options "-fno-builtin-acc_on_device" } */
#include <openacc.h>
-/* acc_on_device might not be folded at -O0, but it should work. */
-
int main ()
{
int dev;
@@ -1,5 +1,6 @@
/* { dg-do compile } */
-/* { dg-additional-options "-O2" } */
+/* We don't expect this to work with optimizations disabled.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <openacc.h>
@@ -1,5 +1,8 @@
/* Test that the compiler decides to "avoid offloading". */
+/* The warning is only triggered for -O2 and higher.
+ { dg-xfail-if "n/a" { openacc_nvidia_accel_selected } { "-O0" "-O1" } { "" } } */
+
#include <openacc.h>
int main(void)
@@ -1,6 +1,9 @@
/* Test that a user can override the compiler's "avoid offloading"
decision. */
+/* The warning is only triggered for -O2 and higher.
+ { dg-xfail-if "n/a" { openacc_nvidia_accel_selected } { "-O0" "-O1" } { "" } } */
+
#include <openacc.h>
int main(void)
@@ -1,5 +1,7 @@
/* { dg-do run { target openacc_nvidia_accel_selected } } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <assert.h>
#include <openacc.h>
@@ -1,5 +1,6 @@
/* { dg-do run { target openacc_nvidia_accel_selected } } */
/* { dg-additional-options "-lcuda -lcublas -lcudart" } */
+/* { dg-xfail-run-if "TODO" { *-*-* } { "-O0" } { "" } } */
#include <stdlib.h>
#include <openacc.h>
@@ -1,3 +1,5 @@
+/* { dg-xfail-run-if "TODO" { *-*-* } { "-O0" } { "" } } */
+
#include <openacc.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
#include <openacc.h>
@@ -1,5 +1,7 @@
-
-/* { dg-additional-options "-O2 -fopenacc-dim=16:16" } */
+/* { dg-additional-options "-fopenacc-dim=16:16" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include "loop-default.h"
#include <stdlib.h>
@@ -1,5 +1,7 @@
-
-/* { dg-additional-options "-O2 -fopenacc-dim=-:-" } */
+/* { dg-additional-options "-fopenacc-dim=-:-" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include "loop-default.h"
#include <stdlib.h>
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,6 +1,8 @@
-
-/* { dg-do run } */
-/* { dg-xfail-if "foo not found" { openacc_host_selected } } */
+/* At -O0, we do get the expected "undefined reference to `foo'" link-time
+ error message (but the check needs to be done differently; compare to
+ routine-nohost-1.c), but for -O2 we don't; presumably because the function
+ gets inlined.
+ { dg-xfail-if "TODO" { *-*-* } { "-O0" } { "" } } */
#include <stdlib.h>
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O1" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
#include <openacc.h>
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,7 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O1 -w" } */
+/* { dg-additional-options "-w" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
#include <openacc.h>
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O2" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
@@ -1,5 +1,6 @@
-/* { dg-do run } */
-/* { dg-additional-options "-O1" } */
+/* This code uses nvptx inline assembly guarded with acc_on_device, which is
+ not optimized away at -O0, and then confuses the target assembler.
+ { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
#include <stdio.h>
#include <openacc.h>
@@ -1,5 +1,3 @@
-/* { dg-additional-options "-O0" } */
-
/* With -O0, variables are on the stack, not in registers. Check that worker
state propagation handles the stack frame. */
@@ -11,23 +11,13 @@ if [info exists lang_include_flags] then {
unset lang_include_flags
}
-# To avoid testing time exploding too much, limit any torture testing to -O0
-# and -O2 only, under the assumption that between -O0 and -O[something] there
-# is the biggest difference in the overall structure of the generated code.
-set TORTURE_OPTIONS [list \
- { -O0 } \
- { -O2 } ]
-
load_lib libgomp-dg.exp
load_gcc_lib gcc-dg.exp
-
-# If a testcase doesn't have special options, use these.
-if ![info exists DEFAULT_CFLAGS] then {
- set DEFAULT_CFLAGS "-O2"
-}
+load_gcc_lib torture-options.exp
# Initialize dg.
dg-init
+torture-init
# Turn on OpenACC.
lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
@@ -36,21 +26,6 @@ lappend ALWAYS_CFLAGS "additional_flags=-fopenacc"
set tests [lsort [concat \
[find $srcdir/$subdir *.c] \
[find $srcdir/$subdir/../libgomp.oacc-c-c++-common *.c]]]
-# To get better test coverage for device-specific code that is only ever
-# used in offloading configurations, we'd like more thorough (torture)
-# testing for test cases that are dealing with the specifics of
-# gang/worker/vector single/redundant/partitioned modes. They're selected
-# based on their file names -- not a perfect property to detect such test
-# cases, but should be sufficient.
-set ttests [lsort -unique [concat \
- [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *gang*.c] \
- [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *worker*.c] \
- [find $srcdir/$subdir/../libgomp.oacc-c-c++-common *vec*.c]]]
-# tests := tests - ttests.
-foreach t $ttests {
- set i [lsearch -exact $tests $t]
- set tests [lreplace $tests $i $i]
-}
set ld_library_path $always_ld_library_path
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
@@ -90,11 +65,28 @@ foreach offload_target_openacc $offload_targets_s_openacc {
}
set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared -foffload=$offload_target_openacc"
- dg-runtest $tests "$tagopt" $DEFAULT_CFLAGS
- gcc-dg-runtest $ttests "$tagopt" ""
-}
+ # To get better test coverage for device-specific code that is only
+ # ever used in offloading configurations, we'd like more thorough
+ # testing for test cases that deal with offloading, which most of all
+ # OpenACC test cases are. We enable torture testing, but limit it to
+ # -O0 and -O2 only, to avoid testing times exploding too much, under
+ # the assumption that between -O0 and -O[something] there is the
+ # biggest difference in the overall structure of the generated code.
+ switch -glob $offload_target_openacc {
+ disable {
+ set-torture-options [list \
+ { -O2 } ]
+ }
+ default {
+ set-torture-options [list \
+ { -O0 } \
+ { -O2 } ]
+ }
+ }
-unset TORTURE_OPTIONS
+ gcc-dg-runtest $tests "$tagopt" ""
+}
# All done.
+torture-finish
dg-finish