Also test -O0 for OpenACC C, C++ offloading test cases
authorThomas Schwinge <thomas@codesourcery.com>
Thu, 24 Mar 2016 21:29:55 +0000 (22:29 +0100)
committerThomas Schwinge <tschwinge@gcc.gnu.org>
Thu, 24 Mar 2016 21:29:55 +0000 (22:29 +0100)
libgomp/
* 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.

From-SVN: r234471

27 files changed:
libgomp/ChangeLog
libgomp/testsuite/libgomp.oacc-c++/c++.exp
libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/acc-on-device.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta-3.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-alias-ipa-pta.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-dim-default.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/routine-g-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/routine-gwv-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/routine-v-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/routine-w-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/routine-wv-1.c
libgomp/testsuite/libgomp.oacc-c/c.exp

index 5f2c401e461297a73f825730e65f701bd3741d34..e0cd567d0d1e3e75d1cfc88d9283b692f9948ce0 100644 (file)
@@ -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
index 88b0269e3f35c8cff2b91f5cadabd13e9888bf23..bbdbe2f9ec4bb4b4fcdc50ebfb4642a9e8a5a797 100644 (file)
@@ -2,6 +2,7 @@
 
 load_lib libgomp-dg.exp
 load_gcc_lib gcc-dg.exp
+load_gcc_lib torture-options.exp
 
 global shlib_ext
 
@@ -13,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"
@@ -104,7 +101,26 @@ if { $lang_test_file_found } {
 
        setenv ACC_DEVICE_TYPE $offload_target_openacc
 
-       dg-runtest $tests "$tagopt" "$libstdcxx_includes $DEFAULT_CFLAGS"
+       # 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 $offload_target_openacc {
+           host {
+               set-torture-options [list \
+                                        { -O2 } ]
+           }
+           default {
+               set-torture-options [list \
+                                        { -O0 } \
+                                        { -O2 } ]
+           }
+       }
+
+       gcc-dg-runtest $tests "$tagopt" "$libstdcxx_includes"
     }
 }
 
@@ -112,4 +128,5 @@ if { $lang_test_file_found } {
 set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
 
 # All done.
+torture-finish
 dg-finish
index e5d9c36b107466e0be1972a85fe47c954db54a20..bfcb67d58b60a0e5282694b5c0ab88536dc273ea 100644 (file)
@@ -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;
index 88c000e62f0b3456aa86d1e305c0e422f0a3adfe..e0d87107d78fb2c3e82cc84e8d99a08517e89186 100644 (file)
@@ -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>
 
index 0f323c82d2cabc4b2f2e3d553eb8c9d9dedbdc9d..e8d65df8208f777e1be912288cccc6a1d1769f7b 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2 -fipa-pta" } */
+/* { dg-additional-options "-fipa-pta" } */
 
 #include <stdlib.h>
 
index 654e750c3b4e3589c805d0666c267e41ffaa4f5a..dd8ca871d59afb1aab48ab1a5ce6f79f77cfe4c6 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2 -fipa-pta" } */
+/* { dg-additional-options "-fipa-pta" } */
 
 #include <stdlib.h>
 
index 44d4fd25cd2971b9ca9dd1733d25a0a8ef6a51cb..50e7dc14888466a36338687a89749cd1b3555a13 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-additional-options "-O2 -fipa-pta" } */
+/* { dg-additional-options "-fipa-pta" } */
 
 #include <stdlib.h>
 
index 4922c9c00a064f9415f83ffac643b1ac402e93f1..622bbdffaeadb481a97e711f7247563838d3d428 100644 (file)
@@ -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>
 #include <openacc.h>
index 36b882ff330207c8ef4b1f5be4cdabcb9118f858..c433b80da9359cc504d834698d8b47a33a8d26b4 100644 (file)
@@ -1,5 +1,7 @@
-
-/* { dg-additional-options "-O2 -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" } { "" } } */
+/* { dg-additional-options "-fopenacc-dim=16:16" } */
 
 #include <openacc.h>
 #include <alloca.h>
index 23c2a75f1e9e4f54ea332b3e77a1e7773876715c..7bff6cddf84e2d0da2e08ae17f969745850e76d9 100644 (file)
@@ -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>
 
index 1a93db375bdc060d59b9f2914a8846786e2f6a97..92b82a01eb06e33d5152e66171d6ad275e98eb1e 100644 (file)
@@ -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>
 
index 26b2df9259ad8330d924fd6ed9007fa99a476608..42b612a29d8de7cb28dfbd7443cb5812453501ae 100644 (file)
@@ -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>
 
index c14bdddef5faaa371eeb9f93bc1e72cfe9452c47..a8684f9587e8ef3ea3fb187233c9c93d42cb1ee9 100644 (file)
@@ -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>
 
index 3de8b09ddc1aa3d7471e4a4876137abdc9f084cd..3b104cf2f4733694aa1032a89e820d37fdcd6ed6 100644 (file)
@@ -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>
 
index bae5c66cc1f890ae6dd4c5977f381b0da8c0f7c9..b77ae76e321c18ee104b7406f3dd52dd7fb84498 100644 (file)
@@ -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>
 
index ada92e392c14e393dac9d01acec0d7ea0f55b2d2..16d8f9fbf2c87e35cd89cd630fc047cc91b2e454 100644 (file)
@@ -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>
 
index 706d0d8d73628185b112b4fc20afe4646ea869d7..9cc12b3add8098749dbcb6220fa8b417576db685 100644 (file)
@@ -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>
 
index a073ac857ffa2d911c8a780c872f4fbeebd28c61..f0c9d8182e8e3a4cdce9234bf6a11a7a23f42610 100644 (file)
@@ -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>
 
index b9ec95b77c16456304444bb4464adda6c3157e92..2974807925a8d1647041d892d962a5d820c00700 100644 (file)
@@ -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>
 
index 539e41d0b3125b9e0eca504d6a3c9fb218a8d53b..33b6eae9e44cd37ea115d23ceeb8169444d65c8f 100644 (file)
@@ -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>
 
index fcb9079d592ee1fa78b82777c479b72ef8457c2f..578cfadd4d142b3ef4a37d167c6dd3b6f23fd925 100644 (file)
@@ -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>
 
index 201dc72694c2f63b2ab2933f0f2f75de3ffb2af0..9d14c3bd3130ddab83c8223583999b5b3420f3ef 100644 (file)
@@ -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>
 
index 8fc4cb5f66c4c4e36d770e9fe1cd8e62e9f8db44..ace2f499b1fa3d514255596149336a7bd7e24ea1 100644 (file)
@@ -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>
 
index fefeb93430876d844d6dcbcd0631c5a2954333ea..2503e8d7d9d7deb45f108edb93b7a53052815550 100644 (file)
@@ -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>
 
index 01d1dc8676a2c7551702be20dba52369973bb3c2..80cd4620b091fd6d0c0bec2f156d943c3743154d 100644 (file)
@@ -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>
 
index bd9f1df5f42651e43470d1465cd0cad1e41d452d..5e45fad176f485606978e3ede3a0615ccc635c79 100644 (file)
@@ -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>
 
index 5020e6a0691edcb8336c540415921ea8d5538980..b509a1098159c277bd5b402b605617ba2b288b49 100644 (file)
@@ -13,14 +13,11 @@ if [info exists lang_include_flags] then {
 
 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"
@@ -67,8 +64,28 @@ foreach offload_target_openacc $offload_targets_s_openacc {
 
     setenv ACC_DEVICE_TYPE $offload_target_openacc
 
-    dg-runtest $tests "$tagopt" $DEFAULT_CFLAGS
+    # 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 $offload_target_openacc {
+       host {
+           set-torture-options [list \
+                                    { -O2 } ]
+       }
+       default {
+           set-torture-options [list \
+                                    { -O0 } \
+                                    { -O2 } ]
+       }
+    }
+
+    gcc-dg-runtest $tests "$tagopt" ""
 }
 
 # All done.
+torture-finish
 dg-finish