public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3633] Add 'libgomp.oacc-c-c++-common/broadcast-many.c'
@ 2021-09-17 19:08 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2021-09-17 19:08 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8251f90e87f67e09f5203e8edd77bfe73b68a54d
commit r12-3633-g8251f90e87f67e09f5203e8edd77bfe73b68a54d
Author: Julian Brown <julian@codesourcery.com>
Date: Mon Jun 29 13:16:52 2020 -0700
Add 'libgomp.oacc-c-c++-common/broadcast-many.c'
libgomp/
* testsuite/libgomp.oacc-c-c++-common/broadcast-many.c: New test.
Diff:
---
.../libgomp.oacc-c-c++-common/broadcast-many.c | 77 ++++++++++++++++++++++
1 file changed, 77 insertions(+)
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/broadcast-many.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/broadcast-many.c
new file mode 100644
index 00000000000..d763a754a11
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/broadcast-many.c
@@ -0,0 +1,77 @@
+#include <assert.h>
+#include <stdio.h>
+
+#define LOCAL(n) double n = input;
+#define LOCALS(n) LOCAL(n##1) LOCAL(n##2) LOCAL(n##3) LOCAL(n##4) \
+ LOCAL(n##5) LOCAL(n##6) LOCAL(n##7) LOCAL(n##8)
+#define LOCALS2(n) LOCALS(n##a) LOCALS(n##b) LOCALS(n##c) LOCALS(n##d) \
+ LOCALS(n##e) LOCALS(n##f) LOCALS(n##g) LOCALS(n##h)
+
+#define USE(n) n
+#define USES(n,OP) USE(n##1) OP USE(n##2) OP USE(n##3) OP USE (n##4) OP \
+ USE(n##5) OP USE(n##6) OP USE(n##7) OP USE (n##8)
+#define USES2(n,OP) USES(n##a,OP) OP USES(n##b,OP) OP USES(n##c,OP) OP \
+ USES(n##d,OP) OP USES(n##e,OP) OP USES(n##f,OP) OP \
+ USES(n##g,OP) OP USES(n##h,OP)
+
+int main (void)
+{
+ int ret;
+ int input = 1;
+
+ #pragma acc parallel num_gangs(1) num_workers(32) copyout(ret)
+ {
+ int w = 0;
+ LOCALS2(h);
+
+ #pragma acc loop worker reduction(+:w)
+ for (int i = 0; i < 32; i++)
+ {
+ int u = USES2(h,+);
+ w += u;
+ }
+
+ printf ("w=%d\n", w);
+ /* { dg-output "w=2048(\n|\r\n|\r)" } */
+
+ LOCALS2(i);
+
+ #pragma acc loop worker reduction(+:w)
+ for (int i = 0; i < 32; i++)
+ {
+ int u = USES2(i,+);
+ w += u;
+ }
+
+ printf ("w=%d\n", w);
+ /* { dg-output "w=4096(\n|\r\n|\r)" } */
+
+ LOCALS2(j);
+ LOCALS2(k);
+
+ #pragma acc loop worker reduction(+:w)
+ for (int i = 0; i < 32; i++)
+ {
+ int u = USES2(j,+);
+ w += u;
+ }
+
+ printf ("w=%d\n", w);
+ /* { dg-output "w=6144(\n|\r\n|\r)" } */
+
+ #pragma acc loop worker reduction(+:w)
+ for (int i = 0; i < 32; i++)
+ {
+ int u = USES2(k,+);
+ w += u;
+ }
+
+ ret = (w == 64 * 32 * 4);
+ printf ("w=%d\n", w);
+ /* { dg-output "w=8192(\n|\r\n|\r)" } */
+ }
+
+ assert (ret);
+
+ return 0;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-17 19:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 19:08 [gcc r12-3633] Add 'libgomp.oacc-c-c++-common/broadcast-many.c' Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).