aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2021-04-21 20:07:19 +0200
committerTobias Burnus <tobias@codesourcery.com>2021-04-21 20:07:19 +0200
commit95dfc3ac7baca19157bb976ee4c8c69753e1e178 (patch)
treee06cd260038bdf1f7379edbdefae5c1cf8c74a80 /libgomp
parentc2fc1702cb3a3d5cc9c40de47f63b4c8f3f1d09c (diff)
downloadgcc-95dfc3ac7baca19157bb976ee4c8c69753e1e178.zip
gcc-95dfc3ac7baca19157bb976ee4c8c69753e1e178.tar.gz
gcc-95dfc3ac7baca19157bb976ee4c8c69753e1e178.tar.bz2
libgomp/testsuite: Fix checks for dg-excess-errors
For the tests modified below, the effective target line has to be effective when compiling for an offload target, except that variable-not-offloaded.c would compile with unified-share memory and pr86416-*.c if long double/float128 is supported. The previous check used a run-time device ability check. This new variant now enables those dg- lines when _compiling_ for nvptx or gcn. libgomp/ChangeLog: * testsuite/lib/libgomp.exp (offload_target_to_openacc_device_type): New, based on check_effective_target_offload_target_nvptx. (check_effective_target_offload_target_nvptx): Call it. (check_effective_target_offload_target_amdgcn): New. * testsuite/libgomp.c-c++-common/function-not-offloaded.c: Require target offload_target_nvptx || offload_target_amdgcn. * testsuite/libgomp.c-c++-common/variable-not-offloaded.c: Likewise. * testsuite/libgomp.c/pr86416-1.c: Likewise. * testsuite/libgomp.c/pr86416-2.c: Likewise.
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/testsuite/lib/libgomp.exp20
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/function-not-offloaded.c2
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c4
-rw-r--r--libgomp/testsuite/libgomp.c/pr86416-1.c4
-rw-r--r--libgomp/testsuite/libgomp.c/pr86416-2.c4
5 files changed, 23 insertions, 11 deletions
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 14dcfdf..46cce9b 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -340,8 +340,10 @@ proc offload_target_to_openacc_device_type { offload_target } {
}
}
-# Return 1 if compiling for offload target nvptx.
-proc check_effective_target_offload_target_nvptx { } {
+# Return 1 if compiling for the specified offload target
+# Takes -foffload=... into account by checking OFFLOAD_TARGET_NAMES=
+# in the -v compiler output.
+proc libgomp_check_effective_target_offload_target { target_name } {
# Consider all actual options, including the flags passed to
# 'gcc-dg-runtest', or 'gfortran-dg-runtest' (see the 'libgomp.*/*.exp'
# files; in particular, '-foffload', 'libgomp.oacc-*/*.exp'), which don't
@@ -354,13 +356,23 @@ proc check_effective_target_offload_target_nvptx { } {
set gcc_output [libgomp_target_compile "" "" "none" $options]
if [regexp "(?n)^OFFLOAD_TARGET_NAMES=(.*)" $gcc_output dummy offload_targets] {
verbose "compiling for offload targets: $offload_targets"
- return [string match "*:nvptx*:*" ":$offload_targets:"]
+ return [string match "*:$target_name*:*" ":$offload_targets:"]
}
- verbose "not compiling for any offload targets"
+ verbose "not compiling for $target_name offload target"
return 0
}
+# Return 1 if compiling for offload target nvptx.
+proc check_effective_target_offload_target_nvptx { } {
+ return [libgomp_check_effective_target_offload_target "nvptx"]
+}
+
+# Return 1 if compiling for offload target amdgcn
+proc check_effective_target_offload_target_amdgcn { } {
+ return [libgomp_check_effective_target_offload_target "amdgcn"]
+}
+
# Return 1 if offload device is available.
proc check_effective_target_offload_device { } {
return [check_runtime_nocache offload_device_available_ {
diff --git a/libgomp/testsuite/libgomp.c-c++-common/function-not-offloaded.c b/libgomp/testsuite/libgomp.c-c++-common/function-not-offloaded.c
index 9e59ef8..bc1ae68 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/function-not-offloaded.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/function-not-offloaded.c
@@ -1,5 +1,5 @@
/* { dg-do link } */
-/* { dg-excess-errors "unresolved symbol foo, lto1, mkoffload and lto-wrapper fatal errors" { target offload_device_nonshared_as } } */
+/* { dg-excess-errors "unresolved symbol foo, lto1, mkoffload and lto-wrapper fatal errors" { target { offload_target_nvptx || offload_target_amdgcn } } } */
/* { dg-additional-sources "function-not-offloaded-aux.c" } */
#pragma omp declare target
diff --git a/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c b/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c
index bc4b916..fe2a8b2 100644
--- a/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c
+++ b/libgomp/testsuite/libgomp.c-c++-common/variable-not-offloaded.c
@@ -1,7 +1,7 @@
/* { dg-do link } */
-/* { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" { target offload_device_nonshared_as } } */
+/* { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" { target { offload_target_nvptx || offload_target_amdgcn } } } */
-int var; /* { dg-error "variable 'var' has been referenced in offloaded code but hasn't been marked to be included in the offloaded code" "" { target offload_device_nonshared_as } } */
+int var; /* { dg-error "variable 'var' has been referenced in offloaded code but hasn't been marked to be included in the offloaded code" "" { target { offload_target_nvptx || offload_target_amdgcn } } } */
#pragma omp declare target
void __attribute__((noinline, noclone))
diff --git a/libgomp/testsuite/libgomp.c/pr86416-1.c b/libgomp/testsuite/libgomp.c/pr86416-1.c
index ad9370f..6d38692 100644
--- a/libgomp/testsuite/libgomp.c/pr86416-1.c
+++ b/libgomp/testsuite/libgomp.c/pr86416-1.c
@@ -2,8 +2,8 @@
/* { dg-require-effective-target large_long_double } */
/* PR middle-end/86416 */
-/* { dg-error "bit-precision floating-point numbers unsupported .mode '.F'." "" { target offload_device } 0 } */
-/* { dg-excess-errors "Follow-up errors from mkoffload and lto-wrapper" { target offload_device } } */
+/* { dg-error "bit-precision floating-point numbers unsupported .mode '.F'." "" { target { offload_target_nvptx || offload_target_amdgcn } } 0 } */
+/* { dg-excess-errors "Follow-up errors from mkoffload and lto-wrapper" { target { offload_target_nvptx || offload_target_amdgcn } } } */
#include <stdlib.h> /* For abort. */
diff --git a/libgomp/testsuite/libgomp.c/pr86416-2.c b/libgomp/testsuite/libgomp.c/pr86416-2.c
index ec45e40..cffeb3f 100644
--- a/libgomp/testsuite/libgomp.c/pr86416-2.c
+++ b/libgomp/testsuite/libgomp.c/pr86416-2.c
@@ -2,8 +2,8 @@
/* { dg-add-options __float128 } */
/* PR middle-end/86416 */
-/* { dg-error "bit-precision floating-point numbers unsupported .mode '.F'." "" { target offload_device } 0 } */
-/* { dg-excess-errors "Follow-up errors from mkoffload and lto-wrapper" { target offload_device } } */
+/* { dg-error "bit-precision floating-point numbers unsupported .mode '.F'." "" { target { offload_target_nvptx || offload_target_amdgcn } } 0 } */
+/* { dg-excess-errors "Follow-up errors from mkoffload and lto-wrapper" { target { offload_target_nvptx || offload_target_amdgcn } } } */
#include <stdlib.h> /* For abort. */