From: "de Vries, Tom" <Tom_deVries@mentor.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
"Schwinge, Thomas" <Thomas_Schwinge@mentor.com>
Subject: Re: [PATCH, PR81844] Fix condition folding in c_parser_omp_for_loop
Date: Thu, 14 Sep 2017 19:34:00 -0000 [thread overview]
Message-ID: <1505417653837.14909@mentor.com> (raw)
In-Reply-To: <20170914105503.GH1701@tucnak>
[-- Attachment #1: Type: text/plain, Size: 332 bytes --]
> I know we don't have
> libgomp.c-c++-common (maybe we should add that)
Like so?
Ran:
- make check-target-libgomp RUNTESTFLAGS=c.exp=cancel-taskgroup-1.c
- make check-target-libgomp RUNTESTFLAGS=c++.exp=cancel-taskgroup-1.c
Currently running make check-target-libgomp.
OK for trunk if tests pass?
Thanks,
- Tom
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Introduce-libgomp-testsuite-libgomp.c-c-common.patch --]
[-- Type: text/x-patch; name="0001-Introduce-libgomp-testsuite-libgomp.c-c-common.patch", Size: 6283 bytes --]
Introduce libgomp/testsuite/libgomp.c-c++-common
2017-09-14 Tom de Vries <tom@codesourcery.com>
* testsuite/libgomp.c++/cancel-taskgroup-1.C: Remove.
* testsuite/libgomp.c/cancel-taskgroup-1.c: Move to ...
* testsuite/libgomp.c-c++-common/cancel-taskgroup-1.c: ... here.
* testsuite/libgomp.c/c.exp: Include test-cases from
libgomp.c-c++-common.
* testsuite/libgomp.c++/c++.exp: Same. Force c++-mode compilation of .c
files.
---
libgomp/testsuite/libgomp.c++/c++.exp | 9 ++-
libgomp/testsuite/libgomp.c++/cancel-taskgroup-1.C | 4 --
.../libgomp.c-c++-common/cancel-taskgroup-1.c | 70 ++++++++++++++++++++++
libgomp/testsuite/libgomp.c/c.exp | 4 +-
libgomp/testsuite/libgomp.c/cancel-taskgroup-1.c | 70 ----------------------
5 files changed, 81 insertions(+), 76 deletions(-)
diff --git a/libgomp/testsuite/libgomp.c++/c++.exp b/libgomp/testsuite/libgomp.c++/c++.exp
index 0454f95..146b2ba 100644
--- a/libgomp/testsuite/libgomp.c++/c++.exp
+++ b/libgomp/testsuite/libgomp.c++/c++.exp
@@ -22,6 +22,11 @@ dg-init
# Turn on OpenMP.
lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
+# Switch into C++ mode. Otherwise, the libgomp.c-c++-common/*.c
+# files would be compiled as C files.
+set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST"
+set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++"
+
set blddir [lookfor_file [get_multilibs] libgomp]
@@ -47,7 +52,9 @@ if { $blddir != "" } {
if { $lang_test_file_found } {
# Gather a list of all tests.
- set tests [lsort [find $srcdir/$subdir *.C]]
+ set tests [lsort [concat \
+ [find $srcdir/$subdir *.C] \
+ [find $srcdir/$subdir/../libgomp.c-c++-common *.c]]]
if { $blddir != "" } {
set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
diff --git a/libgomp/testsuite/libgomp.c++/cancel-taskgroup-1.C b/libgomp/testsuite/libgomp.c++/cancel-taskgroup-1.C
deleted file mode 100644
index 4f66859..0000000
--- a/libgomp/testsuite/libgomp.c++/cancel-taskgroup-1.C
+++ /dev/null
@@ -1,4 +0,0 @@
-// { dg-do run }
-// { dg-set-target-env-var OMP_CANCELLATION "true" }
-
-#include "../libgomp.c/cancel-taskgroup-1.c"
diff --git a/libgomp/testsuite/libgomp.c-c++-common/cancel-taskgroup-1.c b/libgomp/testsuite/libgomp.c-c++-common/cancel-taskgroup-1.c
new file mode 100644
index 0000000..5a80811
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/cancel-taskgroup-1.c
@@ -0,0 +1,70 @@
+/* { dg-do run } */
+/* { dg-set-target-env-var OMP_CANCELLATION "true" } */
+
+#include <stdlib.h>
+#include <omp.h>
+
+struct T { struct T *children[2]; int val; };
+
+struct T *
+search (struct T *tree, int val, int lvl)
+{
+ if (tree == NULL || tree->val == val)
+ return tree;
+ struct T *ret = NULL;
+ int i;
+ for (i = 0; i < 2; i++)
+ #pragma omp task shared(ret) if(lvl < 10)
+ {
+ struct T *r = search (tree->children[i], val, lvl + 1);
+ if (r)
+ {
+ #pragma omp atomic write
+ ret = r;
+ #pragma omp cancel taskgroup
+ }
+ }
+ #pragma omp taskwait
+ return ret;
+}
+
+struct T *
+searchp (struct T *tree, int val)
+{
+ struct T *ret;
+ #pragma omp parallel shared(ret) firstprivate (tree, val)
+ #pragma omp single
+ #pragma omp taskgroup
+ ret = search (tree, val, 0);
+ return ret;
+}
+
+int
+main ()
+{
+ /* Must be power of two minus 1. */
+ int size = 0x7ffff;
+ struct T *trees = (struct T *) malloc (size * sizeof (struct T));
+ if (trees == NULL)
+ return 0;
+ int i, l = 1, b = 0;
+ for (i = 0; i < size; i++)
+ {
+ if (i == l)
+ {
+ b = l;
+ l = l * 2 + 1;
+ }
+ trees[i].val = i;
+ trees[i].children[0] = l == size ? NULL : &trees[l + (i - b) * 2];
+ trees[i].children[1] = l == size ? NULL : &trees[l + (i - b) * 2 + 1];
+ }
+ for (i = 0; i < 50; i++)
+ {
+ int v = random () & size;
+ if (searchp (&trees[0], v) != &trees[v])
+ abort ();
+ }
+ free (trees);
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c/c.exp b/libgomp/testsuite/libgomp.c/c.exp
index 300b921..31bdd57 100644
--- a/libgomp/testsuite/libgomp.c/c.exp
+++ b/libgomp/testsuite/libgomp.c/c.exp
@@ -24,7 +24,9 @@ dg-init
lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
# Gather a list of all tests.
-set tests [lsort [find $srcdir/$subdir *.c]]
+set tests [lsort [concat \
+ [find $srcdir/$subdir *.c] \
+ [find $srcdir/$subdir/../libgomp.c-c++-common *.c]]]
set ld_library_path $always_ld_library_path
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
diff --git a/libgomp/testsuite/libgomp.c/cancel-taskgroup-1.c b/libgomp/testsuite/libgomp.c/cancel-taskgroup-1.c
deleted file mode 100644
index 5a80811..0000000
--- a/libgomp/testsuite/libgomp.c/cancel-taskgroup-1.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* { dg-do run } */
-/* { dg-set-target-env-var OMP_CANCELLATION "true" } */
-
-#include <stdlib.h>
-#include <omp.h>
-
-struct T { struct T *children[2]; int val; };
-
-struct T *
-search (struct T *tree, int val, int lvl)
-{
- if (tree == NULL || tree->val == val)
- return tree;
- struct T *ret = NULL;
- int i;
- for (i = 0; i < 2; i++)
- #pragma omp task shared(ret) if(lvl < 10)
- {
- struct T *r = search (tree->children[i], val, lvl + 1);
- if (r)
- {
- #pragma omp atomic write
- ret = r;
- #pragma omp cancel taskgroup
- }
- }
- #pragma omp taskwait
- return ret;
-}
-
-struct T *
-searchp (struct T *tree, int val)
-{
- struct T *ret;
- #pragma omp parallel shared(ret) firstprivate (tree, val)
- #pragma omp single
- #pragma omp taskgroup
- ret = search (tree, val, 0);
- return ret;
-}
-
-int
-main ()
-{
- /* Must be power of two minus 1. */
- int size = 0x7ffff;
- struct T *trees = (struct T *) malloc (size * sizeof (struct T));
- if (trees == NULL)
- return 0;
- int i, l = 1, b = 0;
- for (i = 0; i < size; i++)
- {
- if (i == l)
- {
- b = l;
- l = l * 2 + 1;
- }
- trees[i].val = i;
- trees[i].children[0] = l == size ? NULL : &trees[l + (i - b) * 2];
- trees[i].children[1] = l == size ? NULL : &trees[l + (i - b) * 2 + 1];
- }
- for (i = 0; i < 50; i++)
- {
- int v = random () & size;
- if (searchp (&trees[0], v) != &trees[v])
- abort ();
- }
- free (trees);
- return 0;
-}
next prev parent reply other threads:[~2017-09-14 19:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-14 8:43 Tom de Vries
2017-09-14 10:55 ` Jakub Jelinek
2017-09-14 19:34 ` de Vries, Tom [this message]
2017-09-14 19:38 ` Jakub Jelinek
2017-12-15 9:07 ` [PATCH, libgomp, testsuite] Move tests to libgomp.c-c++-common Tom de Vries
2018-02-15 19:28 ` Jason Merrill
2017-12-10 14:00 ` [PATCH, PR81844] Fix condition folding in c_parser_omp_for_loop Tom de Vries
2017-12-10 14:57 ` Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1505417653837.14909@mentor.com \
--to=tom_devries@mentor.com \
--cc=Thomas_Schwinge@mentor.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).