Hi Andrew, hi all,
Andrew Stubbs wrote:
The GCN bits look OK, although it would be nice if unsupported
tests didn't FAIL.
I actually wanted to have a look at this for a longer while,
but now I finally do so.
This patch now adds all missing context-selector -march tests
for AMD GCN – and it also handles the absent multilib issue,
that I was also running into before.
(Note that libgomp.c/declare-variant-4.c is with the default
options, i.e. for that test, I expect that linking is always
successful.)
Downside is only that we might miss some fails due to
UNRESOLVED if something fails early, but there is probably
nothing we can do ...
Does this look OK for mainline?
Tobias
PS: On my system, I get:
XPASS: libgomp.c/declare-variant-4-gfx1036.c (test for excess errors)
XPASS: libgomp.c/declare-variant-4-gfx11-generic.c (test for excess errors)
XPASS: libgomp.c/declare-variant-4-gfx1100.c (test for excess errors)
XPASS: libgomp.c/declare-variant-4-gfx900.c (test for excess errors)
XPASS: libgomp.c/declare-variant-4-gfx906.c (test for excess errors)
XPASS: libgomp.c/declare-variant-4-gfx908.c (test for excess errors)
XPASS: libgomp.c/declare-variant-4-gfx90a.c (test for excess errors)
=== libgomp Summary ===
# of expected passes 27
# of unexpected successes 7
# of expected failures 22
# of unresolved testcases 7
# of untested testcases 1
And unresolved are the following ones - because mkoffload
fails early with:
gcn mkoffload: fatal error: GCC was built without library support
for '-march=gfx1101'; consider compiling for the associated
generic architecture '-march=gfx11-generic' instead
UNRESOLVED: libgomp.c/declare-variant-4-gfx1101.c scan-amdgcn-amdhsa-offload-tree-dump
optimized "= gfx1101 \\(\\);"
UNRESOLVED: libgomp.c/declare-variant-4-gfx1102.c scan-amdgcn-amdhsa-offload-tree-dump
optimized "= gfx1102 \\(\\);"
UNRESOLVED: libgomp.c/declare-variant-4-gfx1103.c scan-amdgcn-amdhsa-offload-tree-dump
optimized "= gfx1103 \\(\\);"
UNRESOLVED: libgomp.c/declare-variant-4-gfx1150.c scan-amdgcn-amdhsa-offload-tree-dump
optimized "= gfx1150 \\(\\);"
UNRESOLVED: libgomp.c/declare-variant-4-gfx1151.c scan-amdgcn-amdhsa-offload-tree-dump
optimized "= gfx1151 \\(\\);"
UNRESOLVED: libgomp.c/declare-variant-4-gfx1152.c scan-amdgcn-amdhsa-offload-tree-dump
optimized "= gfx1152 \\(\\);"
UNRESOLVED: libgomp.c/declare-variant-4-gfx1153.c scan-amdgcn-amdhsa-offload-tree-dump
optimized "= gfx1153 \\(\\);"
libgomp.c/declare-variant-4-gfx*: Add missing archs + dg-excess-errors
Add missing tests for gfx* context selectors; mark all but the
default-arch declare-variant-4.c with 'dg-excess-errors' to
silence libgomp not-found errors (still passing the
scan-offload-tree-dump check) - or at least causing just
UNRESOLVED errors if the error is
"built without library support ... consider compiling for
the associated generic architecture".
In case the multilib is configured, the result will be
an XPASS.
libgomp/ChangeLog:
* testsuite/libgomp.c/declare-variant-4-gfx10-3-generic.c: Add
dg-excess-errors to handle possible missing libgomp multi lib.
* testsuite/libgomp.c/declare-variant-4-gfx1030.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx1036.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx11-generic.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx1100.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx1103.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx9-4-generic.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx9-generic.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx900.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx906.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx908.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx90a.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx90c.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx942.c: Likewise.
* testsuite/libgomp.c/declare-variant-4-gfx1031.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx1032.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx1033.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx1034.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx1035.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx1101.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx1102.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx1150.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx1151.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx1152.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx1153.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx902.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx904.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx909.c: New test.
* testsuite/libgomp.c/declare-variant-4-gfx950.c: New test.
.../libgomp.c/declare-variant-4-gfx10-3-generic.c | 17 +++++++++++
.../libgomp.c/declare-variant-4-gfx1030.c | 25 ++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1031.c | 33 ++++++++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1032.c | 33 ++++++++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1033.c | 33 ++++++++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1034.c | 33 ++++++++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1035.c | 33 ++++++++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1036.c | 25 ++++++++++++++++
.../libgomp.c/declare-variant-4-gfx11-generic.c | 17 +++++++++++
.../libgomp.c/declare-variant-4-gfx1100.c | 25 ++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1101.c | 33 ++++++++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1102.c | 33 ++++++++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1103.c | 25 ++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1150.c | 33 ++++++++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1151.c | 33 ++++++++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1152.c | 33 ++++++++++++++++++++++
.../libgomp.c/declare-variant-4-gfx1153.c | 33 ++++++++++++++++++++++
.../libgomp.c/declare-variant-4-gfx9-4-generic.c | 17 +++++++++++
.../libgomp.c/declare-variant-4-gfx9-generic.c | 17 +++++++++++
.../testsuite/libgomp.c/declare-variant-4-gfx900.c | 25 ++++++++++++++++
.../testsuite/libgomp.c/declare-variant-4-gfx902.c | 33 ++++++++++++++++++++++
.../testsuite/libgomp.c/declare-variant-4-gfx904.c | 33 ++++++++++++++++++++++
.../testsuite/libgomp.c/declare-variant-4-gfx906.c | 25 ++++++++++++++++
.../testsuite/libgomp.c/declare-variant-4-gfx908.c | 25 ++++++++++++++++
.../testsuite/libgomp.c/declare-variant-4-gfx909.c | 33 ++++++++++++++++++++++
.../testsuite/libgomp.c/declare-variant-4-gfx90a.c | 25 ++++++++++++++++
.../testsuite/libgomp.c/declare-variant-4-gfx90c.c | 25 ++++++++++++++++
.../testsuite/libgomp.c/declare-variant-4-gfx942.c | 25 ++++++++++++++++
.../testsuite/libgomp.c/declare-variant-4-gfx950.c | 33 ++++++++++++++++++++++
29 files changed, 813 insertions(+)
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx10-3-generic.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx10-3-generic.c
index 3df81a34fc9..b7b95e68ad8 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx10-3-generic.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx10-3-generic.c
@@ -6,3 +6,20 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx10_3_generic \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available (as this is a generic config),
+ scan-offload-tree-dump will PASS - but linking fails with the
+ following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1030.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1030.c
index d98d5ef54ec..3703e961c0b 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1030.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1030.c
@@ -6,3 +6,28 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1030 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1031.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1031.c
new file mode 100644
index 00000000000..e0d62894444
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1031.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1031 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1031 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1032.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1032.c
new file mode 100644
index 00000000000..46174cc2afc
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1032.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1032 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1032 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1033.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1033.c
new file mode 100644
index 00000000000..1bd6e661e10
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1033.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1033 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1033 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1034.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1034.c
new file mode 100644
index 00000000000..4f67a73bc48
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1034.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1034 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1034 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1035.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1035.c
new file mode 100644
index 00000000000..a69d5e7e808
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1035.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1035 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1035 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1036.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1036.c
index 93b8641b3e1..8c258c4011d 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1036.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1036.c
@@ -6,3 +6,28 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1036 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx11-generic.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx11-generic.c
index ca03f4a2ede..fa9efb4cea4 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx11-generic.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx11-generic.c
@@ -6,3 +6,20 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx11_generic \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available (as this is a generic config),
+ scan-offload-tree-dump will PASS - but linking fails with the
+ following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1100.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1100.c
index 6ade35224cc..f0b7c6db1ae 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1100.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1100.c
@@ -6,3 +6,28 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1100 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1101.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1101.c
new file mode 100644
index 00000000000..213e904fc9c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1101.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1101 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1101 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1102.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1102.c
new file mode 100644
index 00000000000..3f68dc8cc7c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1102.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1102 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1102 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1103.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1103.c
index 6a6dc4fba3f..c1eed448f8b 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1103.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1103.c
@@ -6,3 +6,28 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1103 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1150.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1150.c
new file mode 100644
index 00000000000..39d64ca789d
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1150.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1150 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1150 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1151.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1151.c
new file mode 100644
index 00000000000..2a0c7322724
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1151.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1151 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1151 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1152.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1152.c
new file mode 100644
index 00000000000..3c987ddbac8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1152.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1152 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1152 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1153.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1153.c
new file mode 100644
index 00000000000..7d38b82c2a4
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx1153.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx1153 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx1153 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx9-4-generic.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx9-4-generic.c
index 3921bddbf80..07d1254bbb6 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx9-4-generic.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx9-4-generic.c
@@ -6,3 +6,20 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx9_4_generic \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available (as this is a generic config),
+ scan-offload-tree-dump will PASS - but linking fails with the
+ following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx9-generic.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx9-generic.c
index 5aa8a2e3224..d6ba097ce39 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx9-generic.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx9-generic.c
@@ -6,3 +6,20 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx9_generic \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available (as this is a generic config),
+ scan-offload-tree-dump will PASS - but linking fails with the
+ following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx900.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx900.c
index f3f5244c7bc..37005fc5c7f 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx900.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx900.c
@@ -6,3 +6,28 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx900 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx902.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx902.c
new file mode 100644
index 00000000000..82981c5cbcc
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx902.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx902 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx902 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx904.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx904.c
new file mode 100644
index 00000000000..89815fe760e
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx904.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx904 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx904 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx906.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx906.c
index ac43388a59f..aeef690f870 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx906.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx906.c
@@ -6,3 +6,28 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx906 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx908.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx908.c
index f60741f202f..799b5465bd4 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx908.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx908.c
@@ -6,3 +6,28 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx908 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx909.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx909.c
new file mode 100644
index 00000000000..e8a6f63a047
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx909.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx909 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx909 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx90a.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx90a.c
index 832d174e4a5..de5626efff8 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx90a.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx90a.c
@@ -6,3 +6,28 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx90a \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx90c.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx90c.c
index 44629a806b4..dfad7ece1c9 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx90c.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx90c.c
@@ -6,3 +6,28 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx90c \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx942.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx942.c
index d1df5500d5f..c8c744662b1 100644
--- a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx942.c
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx942.c
@@ -6,3 +6,28 @@
#include "declare-variant-4.h"
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx942 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */
diff --git a/libgomp/testsuite/libgomp.c/declare-variant-4-gfx950.c b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx950.c
new file mode 100644
index 00000000000..af81f1116d1
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/declare-variant-4-gfx950.c
@@ -0,0 +1,33 @@
+/* { dg-do link { target { offload_target_amdgcn } } } */
+/* { dg-additional-options -foffload=amdgcn-amdhsa } */
+/* { dg-additional-options -foffload=-march=gfx950 } */
+/* { dg-additional-options "-foffload=-fdump-tree-optimized" } */
+
+#include "declare-variant-4.h"
+
+/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump "= gfx950 \\(\\);" "optimized" } } */
+
+
+/* This code will link nicely if the multilib for that GPU architecture
+ has been build for GCC. In that case, scan-offload-tree-dump will
+ PASS and the linking will yield an XPASS message due to following line: */
+
+/* { dg-excess-errors "ld: error: unable to find library -lgomp|gcn mkoffload: fatal error" } */
+
+/* If the multi-lib config is not available, there are two options:
+
+ * If the generic multi-lib is available, mkoffload fails early,
+ yielding UNRESOLVED for scan-offload-tree-dump and an XFAIL
+ for the message:
+ gcn mkoffload: fatal error: GCC was built without library support
+ for '-march=gfx...'; consider compiling for the associated
+ generic architecture '-march=gfx...-generic' instead
+
+ * Or compling succeeds - then scan-offload-tree-dump will PASS -
+ but linking fails with the following error (XFAIL):
+ ld: error: unable to find library -lgomp
+ collect2: error: ld returned 1 exit status
+ gcn mkoffload: fatal error: ...-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status
+ compilation terminated.
+ lto-wrapper: fatal error: .../amdgcn-amdhsa/mkoffload returned 1 exit status
+ compilation terminated. */