This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gomp4] Also test -O0 for OpenACC C, C++ offloading test cases


Hi!

On Thu, 24 Mar 2016 22:31:29 +0100, I wrote:
> On Wed, 23 Mar 2016 19:57:50 +0100, Bernd Schmidt <bschmidt@redhat.com> wrote:
> > Ok with [...].
> 
> Thanks for the review; committed in r234471:

>     Also test -O0 for OpenACC C, C++ offloading test cases

Merged into gomp-4_0-branch in r234664:

commit 9973610b0d5cb41f380fa18eabacb5f967fe4d0e
Merge: e252cf1 0266264
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Apr 1 08:41:44 2016 +0000

    svn merge -r 234469:234471 svn+ssh://gcc.gnu.org/svn/gcc/trunk
    
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@234664 138bc75d-0d04-0410-961f-82ee72b054a4

 libgomp/ChangeLog                                  | 36 ++++++++++++++
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         | 55 +++++++++-------------
 .../libgomp.oacc-c-c++-common/acc-on-device-2.c    |  5 +-
 .../libgomp.oacc-c-c++-common/acc-on-device.c      |  3 +-
 .../libgomp.oacc-c-c++-common/avoid-offloading-1.c |  3 ++
 .../libgomp.oacc-c-c++-common/avoid-offloading-2.c |  3 ++
 .../libgomp.oacc-c-c++-common/gang-static-2.c      |  4 +-
 .../libgomp.oacc-c-c++-common/host_data-1.c        |  1 +
 libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c |  2 +
 .../libgomp.oacc-c-c++-common/loop-auto-1.c        |  6 ++-
 .../loop-default-compile.c                         |  6 ++-
 .../loop-default-runtime.c                         |  6 ++-
 .../testsuite/libgomp.oacc-c-c++-common/loop-g-1.c |  6 ++-
 .../testsuite/libgomp.oacc-c-c++-common/loop-g-2.c |  6 ++-
 .../libgomp.oacc-c-c++-common/loop-gwv-1.c         |  5 +-
 .../libgomp.oacc-c-c++-common/loop-red-g-1.c       |  6 ++-
 .../libgomp.oacc-c-c++-common/loop-red-gwv-1.c     |  5 +-
 .../libgomp.oacc-c-c++-common/loop-red-v-1.c       |  5 +-
 .../libgomp.oacc-c-c++-common/loop-red-v-2.c       |  5 +-
 .../libgomp.oacc-c-c++-common/loop-red-w-1.c       |  6 ++-
 .../libgomp.oacc-c-c++-common/loop-red-w-2.c       |  6 ++-
 .../libgomp.oacc-c-c++-common/loop-red-wv-1.c      |  5 +-
 .../testsuite/libgomp.oacc-c-c++-common/loop-v-1.c |  5 +-
 .../testsuite/libgomp.oacc-c-c++-common/loop-w-1.c |  6 ++-
 .../libgomp.oacc-c-c++-common/loop-wv-1.c          |  5 +-
 .../libgomp.oacc-c-c++-common/routine-3.c          |  8 ++--
 .../libgomp.oacc-c-c++-common/routine-g-1.c        |  6 ++-
 .../libgomp.oacc-c-c++-common/routine-gwv-1.c      |  5 +-
 .../libgomp.oacc-c-c++-common/routine-v-1.c        |  5 +-
 .../libgomp.oacc-c-c++-common/routine-vec-1.c      |  5 +-
 .../libgomp.oacc-c-c++-common/routine-w-1.c        |  6 ++-
 .../libgomp.oacc-c-c++-common/routine-work-1.c     |  6 ++-
 .../libgomp.oacc-c-c++-common/routine-wv-1.c       |  5 +-
 .../libgomp.oacc-c-c++-common/routine-wv-2.c       |  5 +-
 .../libgomp.oacc-c-c++-common/worker-partn-8.c     |  2 -
 libgomp/testsuite/libgomp.oacc-c/c.exp             | 54 +++++++++------------
 36 files changed, 187 insertions(+), 121 deletions(-)

diff --git libgomp/ChangeLog libgomp/ChangeLog
index 5f2c401..e0cd567 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -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
diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp libgomp/testsuite/libgomp.oacc-c++/c++.exp
index f513d87..5a07d6a 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -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
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
index e5d9c36..bfcb67d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
@@ -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;
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
index 88c000e..e0d8710 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c
index 2037484..8f50ba3 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c
@@ -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)
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c
index ee30aa6..41bd6d5 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c
@@ -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)
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/gang-static-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/gang-static-2.c
index 20a866d..ce9632c 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/gang-static-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/gang-static-2.c
@@ -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>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
index 51745ba..b97d877 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-1.c
@@ -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>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
index 5398905..ade064d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/if-1.c
@@ -1,3 +1,5 @@
+/* { dg-xfail-run-if "TODO" { *-*-* } { "-O0" } { "" } } */
+
 #include <openacc.h>
 #include <stdlib.h>
 #include <stdbool.h>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
index 7081fe1..0248ad7 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
@@ -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>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-compile.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-compile.c
index 640d827..ec3ca52 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-compile.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-compile.c
@@ -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>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-runtime.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-runtime.c
index 79ab468..e61203d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-runtime.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-default-runtime.c
@@ -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>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
index 7afb89b..c7b43b7 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
index db83692..6c4c0d2 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
index 26b2df9..42b612a 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
index 129a8c8..6b86de6 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
index 3de8b09..3b104cf 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
index bae5c66..b77ae76 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
index ada92e3..16d8f9f 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
index fadf7d5..8b4dc45 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
index 68d3d7a..174a3ff 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c
index 398b7cc..eeeb1d7 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
index b9ec95b..2974807 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
index 28c6d0b..34c00a3 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
index fcb9079..578cfad 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-3.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-3.c
index a191758..2cdd6bf 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-3.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-3.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
index d38917b..33c8a62 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
index 8fc4cb5..ace2f49 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
index fefeb93..2503e8d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-vec-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-vec-1.c
index 8cbd2e7..fa1f96d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-vec-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-vec-1.c
@@ -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>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
index f21c0a2..c295e66 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-work-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-work-1.c
index a92cafc..daf9bea 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-work-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-work-1.c
@@ -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>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
index bd9f1df..5e45fad 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
@@ -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>
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c
index 6d0b455..b5cbc90 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-2.c
@@ -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>
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/worker-partn-8.c libgomp/testsuite/libgomp.oacc-c-c++-common/worker-partn-8.c
index e787947..6ed736a 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/worker-partn-8.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/worker-partn-8.c
@@ -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.  */
 
diff --git libgomp/testsuite/libgomp.oacc-c/c.exp libgomp/testsuite/libgomp.oacc-c/c.exp
index 03fe3a4..e4be086 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -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


GrÃÃe
 Thomas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]