aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@baylibre.com>2025-05-15 18:10:05 +0200
committerThomas Schwinge <tschwinge@baylibre.com>2025-05-22 18:14:30 +0200
commitd83af9fe9929772362a78d76084fcf485fa04dca (patch)
treefe2cc0c4865f5ae6a8fd453751506a5a31e1c626
parent3a3b24aec2a849efff37433e28617ec6fd18ad2e (diff)
downloadgcc-d83af9fe9929772362a78d76084fcf485fa04dca.zip
gcc-d83af9fe9929772362a78d76084fcf485fa04dca.tar.gz
gcc-d83af9fe9929772362a78d76084fcf485fa04dca.tar.bz2
Add 'libgomp.c-c++-common/target-abi-struct-1-O0.c', 'libgomp.oacc-c-c++-common/abi-struct-1.c'
libgomp/ * testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c: New. * testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c: Likewise. (cherry picked from commit 45efda05c47f770a617b44cf85713a696bcf0384)
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c3
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c96
2 files changed, 99 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c b/libgomp/testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c
new file mode 100644
index 0000000..35ec75d
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/target-abi-struct-1-O0.c
@@ -0,0 +1,3 @@
+/* { dg-additional-options -O0 } */
+
+#include "../libgomp.oacc-c-c++-common/abi-struct-1.c"
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c
new file mode 100644
index 0000000..379e9fd
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/abi-struct-1.c
@@ -0,0 +1,96 @@
+/* Inspired by 'gcc.target/nvptx/abi-struct-arg.c', 'gcc.target/nvptx/abi-struct-ret.c'. */
+
+/* See also '../libgomp.c-c++-common/target-abi-struct-1-O0.c'. */
+
+typedef struct {char a;} schar;
+typedef struct {short a;} sshort;
+typedef struct {int a;} sint;
+typedef struct {long long a;} slonglong;
+typedef struct {int a, b[12];} sint_13;
+
+#pragma omp declare target
+
+#define M(T) ({T t; t.a = sizeof t; t;})
+
+#pragma acc routine
+static schar rschar(void)
+{
+ return M(schar);
+}
+
+#pragma acc routine
+static sshort rsshort(void)
+{
+ return M(sshort);
+}
+
+#pragma acc routine
+static sint rsint(void)
+{
+ return M(sint);
+}
+
+#pragma acc routine
+static slonglong rslonglong(void)
+{
+ return M(slonglong);
+}
+
+#pragma acc routine
+static sint_13 rsint_13(void)
+{
+ return M(sint_13);
+}
+
+#pragma acc routine
+static void aschar(schar schar)
+{
+ if (schar.a != sizeof (char))
+ __builtin_abort();
+}
+
+#pragma acc routine
+static void asshort(sshort sshort)
+{
+ if (sshort.a != sizeof (short))
+ __builtin_abort();
+}
+
+#pragma acc routine
+static void asint(sint sint)
+{
+ if (sint.a != sizeof (int))
+ __builtin_abort();
+}
+
+#pragma acc routine
+static void aslonglong(slonglong slonglong)
+{
+ if (slonglong.a != sizeof (long long))
+ __builtin_abort();
+}
+
+#pragma acc routine
+static void asint_13(sint_13 sint_13)
+{
+ if (sint_13.a != (sizeof (int) * 13))
+ __builtin_abort();
+}
+
+#pragma omp end declare target
+
+int main()
+{
+#pragma omp target
+#pragma acc serial
+ /* { dg-bogus {using 'vector_length \(32\)', ignoring 1} {} { target openacc_nvidia_accel_selected xfail *-*-* } .-1 } */
+ {
+ aschar(rschar());
+ asshort(rsshort());
+ asint(rsint());
+ aslonglong(rslonglong());
+ asint_13(rsint_13());
+ }
+
+ return 0;
+}