aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2015-10-27 22:16:19 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2015-10-27 22:16:19 +0000
commit6e91acf8bbf95ec5f19c7b93ddf10b61e5cc37e6 (patch)
treef7d5ff7dcddc915999eca654a5d091ec5114edca
parent0956e359c48b8526e6159d2e88e7de294929576d (diff)
downloadgcc-6e91acf8bbf95ec5f19c7b93ddf10b61e5cc37e6.zip
gcc-6e91acf8bbf95ec5f19c7b93ddf10b61e5cc37e6.tar.gz
gcc-6e91acf8bbf95ec5f19c7b93ddf10b61e5cc37e6.tar.bz2
target-insns.def (oacc_fork, oacc_join): Define.
* target-insns.def (oacc_fork, oacc_join): Define. * target.def (goacc.validate_dims): Adjust doc to avoid warning. (goacc.fork_join): New GOACC hook. * targhooks.h (default_goacc_fork_join): Declare. * omp-low.c (default_goacc_forkjoin): New. * doc/tm.texi.in (TARGET_GOACC_FORK_JOIN): Add. * doc/tm.texi: Regenerate. From-SVN: r229465
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/doc/tm.texi10
-rw-r--r--gcc/doc/tm.texi.in2
-rw-r--r--gcc/omp-low.c13
-rw-r--r--gcc/target-insns.def2
-rw-r--r--gcc/target.def12
-rw-r--r--gcc/targhooks.h1
7 files changed, 48 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c3a8e3b..5011caf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,15 @@
2015-10-27 Nathan Sidwell <nathan@codesourcery.com>
+ * target-insns.def (oacc_fork, oacc_join): Define.
+ * target.def (goacc.validate_dims): Adjust doc to avoid warning.
+ (goacc.fork_join): New GOACC hook.
+ * targhooks.h (default_goacc_fork_join): Declare.
+ * omp-low.c (default_goacc_forkjoin): New.
+ * doc/tm.texi.in (TARGET_GOACC_FORK_JOIN): Add.
+ * doc/tm.texi: Regenerate.
+
+2015-10-27 Nathan Sidwell <nathan@codesourcery.com>
+
* omp-low.c (oacc_init_rediction_array): New.
(oacc_initialize_reduction_data): Initialize array.
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 606ddb6..4d23c23 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -5765,7 +5765,7 @@ usable. In that case, the smaller the number is, the more desirable it is
to use it.
@end deftypefn
-@deftypefn {Target Hook} bool TARGET_GOACC_VALIDATE_DIMS (tree @var{decl}, int @var{dims[]}, int @var{fn_level})
+@deftypefn {Target Hook} bool TARGET_GOACC_VALIDATE_DIMS (tree @var{decl}, int *@var{dims}, int @var{fn_level})
This hook should check the launch dimensions provided for an OpenACC
compute region, or routine. Defaulted values are represented as -1
and non-constant values as 0. The @var{fn_level} is negative for the
@@ -5777,6 +5777,14 @@ true, if changes have been made. You must override this hook to
provide dimensions larger than 1.
@end deftypefn
+@deftypefn {Target Hook} bool TARGET_GOACC_FORK_JOIN (gcall *@var{call}, const int *@var{dims}, bool @var{is_fork})
+This hook should convert IFN_GOACC_FORK and IFN_GOACC_JOIN function
+calls to target-specific gimple. It is executed during the
+oacc_device_lower pass. It should return true, if the functions
+should be deleted. The default hook returns true, if there are no
+RTL expanders for them.
+@end deftypefn
+
@node Anchored Addresses
@section Anchored Addresses
@cindex anchored addresses
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 93620eb..afa00f7 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -4262,6 +4262,8 @@ address; but often a machine-dependent strategy can generate better code.
@hook TARGET_GOACC_VALIDATE_DIMS
+@hook TARGET_GOACC_FORK_JOIN
+
@node Anchored Addresses
@section Anchored Addresses
@cindex anchored addresses
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index f06daa1..ea6ccfe 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -17642,6 +17642,19 @@ oacc_validate_dims (tree fn, tree attrs, int *dims)
return fn_level;
}
+/* Default fork/join early expander. Delete the function calls if
+ there is no RTL expander. */
+
+bool
+default_goacc_fork_join (gcall *ARG_UNUSED (call),
+ const int *ARG_UNUSED (dims), bool is_fork)
+{
+ if (is_fork)
+ return targetm.have_oacc_fork ();
+ else
+ return targetm.have_oacc_join ();
+}
+
/* Main entry point for oacc transformations which run on the device
compiler after LTO, so we know what the target device is at this
point (including the host fallback). */
diff --git a/gcc/target-insns.def b/gcc/target-insns.def
index d79fdf2..41d488a 100644
--- a/gcc/target-insns.def
+++ b/gcc/target-insns.def
@@ -64,6 +64,8 @@ DEF_TARGET_INSN (memory_barrier, (void))
DEF_TARGET_INSN (movstr, (rtx x0, rtx x1, rtx x2))
DEF_TARGET_INSN (nonlocal_goto, (rtx x0, rtx x1, rtx x2, rtx x3))
DEF_TARGET_INSN (nonlocal_goto_receiver, (void))
+DEF_TARGET_INSN (oacc_fork, (rtx x0, rtx x1, rtx x2))
+DEF_TARGET_INSN (oacc_join, (rtx x0, rtx x1, rtx x2))
DEF_TARGET_INSN (prefetch, (rtx x0, rtx x1, rtx x2))
DEF_TARGET_INSN (probe_stack, (rtx x0))
DEF_TARGET_INSN (probe_stack_address, (rtx x0))
diff --git a/gcc/target.def b/gcc/target.def
index b74887d..bc4b5bd 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -1655,9 +1655,19 @@ should fill in anything that needs to default to non-unity and verify\n\
non-defaults. Diagnostics should be issued as appropriate. Return\n\
true, if changes have been made. You must override this hook to\n\
provide dimensions larger than 1.",
-bool, (tree decl, int dims[], int fn_level),
+bool, (tree decl, int *dims, int fn_level),
default_goacc_validate_dims)
+DEFHOOK
+(fork_join,
+"This hook should convert IFN_GOACC_FORK and IFN_GOACC_JOIN function\n\
+calls to target-specific gimple. It is executed during the\n\
+oacc_device_lower pass. It should return true, if the functions\n\
+should be deleted. The default hook returns true, if there are no\n\
+RTL expanders for them.",
+bool, (gcall *call, const int *dims, bool is_fork),
+default_goacc_fork_join)
+
HOOK_VECTOR_END (goacc)
/* Functions relating to vectorization. */
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index e13e087..36715c3 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -110,6 +110,7 @@ extern void default_destroy_cost_data (void *);
/* OpenACC hooks. */
extern bool default_goacc_validate_dims (tree, int [], int);
+extern bool default_goacc_fork_join (gcall *, const int [], bool);
/* These are here, and not in hooks.[ch], because not all users of
hooks.h include tm.h, and thus we don't have CUMULATIVE_ARGS. */