2020-03-18  Tobias Burnus  <tobias@codesourcery.com>

	* testsuite/libgomp.oacc-c++/firstprivate-mappings-1.C: Add
	#define DO_LONG_DOUBLE; set to 1, except for nvidia + gcn.
	* libgomp.oacc-c-c++-common/firstprivate-mappings-1.c: Likewise.

	* g++.dg/goacc/firstprivate-mappings-1.C: Only set DO_LONG_DOUBLE if
	not defined; update comments.
	* c-c++-common/goacc/firstprivate-mappings-1.c: Likewise.

 gcc/testsuite/c-c++-common/goacc/firstprivate-mappings-1.c   | 12 ++++--------
 gcc/testsuite/g++.dg/goacc/firstprivate-mappings-1.C         | 12 ++++--------
 libgomp/testsuite/libgomp.oacc-c++/firstprivate-mappings-1.C |  9 +++++++++
 .../libgomp.oacc-c-c++-common/firstprivate-mappings-1.c      |  9 +++++++++
 4 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/gcc/testsuite/c-c++-common/goacc/firstprivate-mappings-1.c b/gcc/testsuite/c-c++-common/goacc/firstprivate-mappings-1.c
index 33576c50eca..7987beaed9a 100644
--- a/gcc/testsuite/c-c++-common/goacc/firstprivate-mappings-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/firstprivate-mappings-1.c
@@ -2,7 +2,9 @@
 
 /* This file is also sourced from
    '../../../../libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-mappings-1.c'
-   as an execution test.  */
+   as an execution test.
+
+   'long double' tests are compiled/used unless DO_LONG_DOUBLE is set to 0.  */
 
 /* See also '../../g++.dg/goacc/firstprivate-mappings-1.C'.  */
 
@@ -24,13 +26,7 @@
 # define HAVE_INT128 0
 #endif
 
-
-/* The one is only relevant for offloading compilation; will always be enabled
-   when doing tree scanning.  */
-#ifdef ACC_DEVICE_TYPE_nvidia
-/* PR71064.  */
-# define DO_LONG_DOUBLE 0
-#else
+#ifndef DO_LONG_DOUBLE
 # define DO_LONG_DOUBLE 1
 #endif
 
diff --git a/gcc/testsuite/g++.dg/goacc/firstprivate-mappings-1.C b/gcc/testsuite/g++.dg/goacc/firstprivate-mappings-1.C
index 639bf3f3299..1b1badb1a90 100644
--- a/gcc/testsuite/g++.dg/goacc/firstprivate-mappings-1.C
+++ b/gcc/testsuite/g++.dg/goacc/firstprivate-mappings-1.C
@@ -2,7 +2,9 @@
 
 /* This file is also sourced from
    '../../../../libgomp/testsuite/libgomp.oacc-c++/firstprivate-mappings-1.C'
-   as an execution test.  */
+   as an execution test.
+
+   'long double' tests are compiled/used unless DO_LONG_DOUBLE is set to 0.  */
 
 /* See also '../../c-c++-common/goacc/firstprivate-mappings-1.c'.  */
 
@@ -21,13 +23,7 @@
 # define HAVE_INT128 0
 #endif
 
-
-/* The one is only relevant for offloading compilation; will always be enabled
-   when doing tree scanning.  */
-#ifdef ACC_DEVICE_TYPE_nvidia
-/* PR71064.  */
-# define DO_LONG_DOUBLE 0
-#else
+#ifndef DO_LONG_DOUBLE
 # define DO_LONG_DOUBLE 1
 #endif
 
diff --git a/libgomp/testsuite/libgomp.oacc-c++/firstprivate-mappings-1.C b/libgomp/testsuite/libgomp.oacc-c++/firstprivate-mappings-1.C
index c8dba9e5d1c..7b3e670073c 100644
--- a/libgomp/testsuite/libgomp.oacc-c++/firstprivate-mappings-1.C
+++ b/libgomp/testsuite/libgomp.oacc-c++/firstprivate-mappings-1.C
@@ -1,3 +1,12 @@
 /* Verify OpenACC 'firstprivate' mappings for C++ reference types.  */
 
+/* PR middle-end/48591 */
+/* PR other/71064 */
+/* Set to 0 for offloading targets not supporting long double.  */
+#if defined(ACC_DEVICE_TYPE_nvidia) || defined(ACC_DEVICE_TYPE_gcn)
+# define DO_LONG_DOUBLE 0
+#else
+# define DO_LONG_DOUBLE 1
+#endif
+
 #include "../../../gcc/testsuite/g++.dg/goacc/firstprivate-mappings-1.C"
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-mappings-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-mappings-1.c
index 4a8b310414c..253f8bf0bd0 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-mappings-1.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-mappings-1.c
@@ -3,4 +3,13 @@
 /* { dg-additional-options "-Wno-psabi" } as apparently we're doing funny
    things with vector arguments.  */
 
+/* PR middle-end/48591 */
+/* PR other/71064 */
+/* Set to 0 for offloading targets not supporting long double.  */
+#if defined(ACC_DEVICE_TYPE_nvidia) || defined(ACC_DEVICE_TYPE_gcn)
+# define DO_LONG_DOUBLE 0
+#else
+# define DO_LONG_DOUBLE 1
+#endif
+
 #include "../../../gcc/testsuite/c-c++-common/goacc/firstprivate-mappings-1.c"

