[gomp4] remove kernel-specific launch

2015-07-19 Thread Nathan Sidwell

Tom,
as we discussed this patch removes the GOACC_kernels call, which forwards to 
GOACC_parallel.  We simply call GOACC_parallel directly.


ok for gomp4 branch?

nathan
2015-07-19  Nathan Sidwell  

	gcc/
	* omp-low.c (expand_omp_target): Convert to
	BUILT_IN_GOACC_PARALLEL. Remove BUILT_IN_GOACC_KERNELS cases.
	* omp-builtins.def (BUILT_IN_GOACC_KERNELS): Delete.

	libgomp/
	* oacc-parallel.c (GOACC_kernels): Delete.

Index: gcc/omp-builtins.def
===
--- gcc/omp-builtins.def	(revision 225982)
+++ gcc/omp-builtins.def	(working copy)
@@ -48,9 +48,6 @@ DEF_GOACC_BUILTIN_FNSPEC (BUILT_IN_GOACC
 			  BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_INT_INT_INT_SIZE_INT_INT_VAR,
 			  ATTR_FNSPEC_DOT_DOT_DOT_DOT_r_r_r_NOTHROW_LIST,
 			  ATTR_NOTHROW_LIST, "rrr")
-DEF_GOACC_BUILTIN (BUILT_IN_GOACC_KERNELS, "GOACC_kernels",
-		   BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_INT_INT_INT_SIZE_INT_INT_VAR,
-		   ATTR_NOTHROW_LIST)
 DEF_GOACC_BUILTIN (BUILT_IN_GOACC_PARALLEL, "GOACC_parallel",
 		   BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_INT_INT_INT_SIZE_INT_INT_VAR,
 		   ATTR_NOTHROW_LIST)
Index: gcc/omp-low.c
===
--- gcc/omp-low.c	(revision 225982)
+++ gcc/omp-low.c	(working copy)
@@ -9339,14 +9339,15 @@ expand_omp_target (struct omp_region *re
 	  /* Don't emit the library call.  We've already done that.  */
 	  do_emit_library_call = false;
 	  /* Transform BUILT_IN_GOACC_KERNELS_INTERNAL into
-	 BUILT_IN_GOACC_KERNELS_INTERNAL.  Now that the function body will be
-	 split off, we can no longer regard the omp_data_array reference as
-	 non-escaping.  */
+	 BUILT_IN_GOACC_PARALLELL.  Now that the function
+	 body will be split off, we can no longer regard the
+	 omp_data_array reference as non-escaping.  */
 	  gsi = gsi_last_bb (entry_bb);
 	  gsi_prev (&gsi);
 	  gcall *call = as_a  (gsi_stmt (gsi));
-	  gcc_assert (gimple_call_builtin_p (call, BUILT_IN_GOACC_KERNELS_INTERNAL));
-	  tree fndecl = builtin_decl_explicit (BUILT_IN_GOACC_KERNELS);
+	  gcc_assert (gimple_call_builtin_p
+		  (call, BUILT_IN_GOACC_KERNELS_INTERNAL));
+	  tree fndecl = builtin_decl_explicit (BUILT_IN_GOACC_PARALLEL);
 	  gimple_call_set_fndecl (call, fndecl);
 	  gimple_call_set_fntype (call, TREE_TYPE (fndecl));
 	  gimple_call_reset_alias_info (call);
@@ -9723,7 +9724,6 @@ expand_omp_target (struct omp_region *re
 case BUILT_IN_GOACC_DATA_START:
 case BUILT_IN_GOACC_DECLARE:
 case BUILT_IN_GOACC_ENTER_EXIT_DATA:
-case BUILT_IN_GOACC_KERNELS:
 case BUILT_IN_GOACC_KERNELS_INTERNAL:
 case BUILT_IN_GOACC_PARALLEL:
 case BUILT_IN_GOACC_UPDATE:
@@ -9743,7 +9743,6 @@ expand_omp_target (struct omp_region *re
 case BUILT_IN_GOMP_TARGET_DATA:
 case BUILT_IN_GOMP_TARGET_UPDATE:
   break;
-case BUILT_IN_GOACC_KERNELS:
 case BUILT_IN_GOACC_KERNELS_INTERNAL:
 case BUILT_IN_GOACC_PARALLEL:
   {
Index: libgomp/oacc-parallel.c
===
--- libgomp/oacc-parallel.c	(revision 225982)
+++ libgomp/oacc-parallel.c	(working copy)
@@ -530,37 +530,6 @@ GOACC_enter_exit_data (int device, size_
   acc_dev->openacc.async_set_async_func (acc_async_sync);
 }
 
-void
-GOACC_kernels (int device, void (*fn) (void *),
-	   size_t mapnum, void **hostaddrs, size_t *sizes,
-	   unsigned short *kinds,
-	   int num_gangs, int num_workers, int vector_length,
-	   size_t shared_size, int async, int num_waits, ...)
-{
-#ifdef HAVE_INTTYPES_H
-  gomp_debug (0, "%s: mapnum=%"PRIu64", hostaddrs=%p, sizes=%p, kinds=%p\n",
-	  __FUNCTION__, (uint64_t) mapnum, hostaddrs, sizes, kinds);
-#else
-  gomp_debug (0, "%s: mapnum=%lu, hostaddrs=%p, sizes=%p, kinds=%p\n",
-	  __FUNCTION__, (unsigned long) mapnum, hostaddrs, sizes, kinds);
-#endif
-
-  va_list ap;
-
-  goacc_lazy_initialize ();
-
-  va_start (ap, num_waits);
-
-  if (num_waits > 0)
-goacc_wait (async, num_waits, ap);
-
-  va_end (ap);
-
-  GOACC_parallel (device, fn, mapnum, hostaddrs, sizes, kinds,
-		  num_gangs, num_workers, vector_length, shared_size,
-		  async, 0);
-}
-
 static void
 goacc_wait (int async, int num_waits, va_list ap)
 {


Refactor openacc wait routine

2015-07-19 Thread Nathan Sidwell
this trunk patch refactors libgomp's goacc_wait, which is used for two different 
purposes.


1) when openacc pragmas specify a (non-zero) waits.

2) when the wait pragma itself specifies a zero number of waits.

this leads to #2 calling goacc_wait with num_waits=0, and forces #1 to never do 
that.


Fixed by breaking out the num_waits == 0 handling from goacc_wait into 
GOACC_wait, the wait pragma handler.  I have kept the num_wait=0 checks 
elsewhere, but they are now for efficiency rather than correctness.


ok for trunk (& gomp4)

nathan
Index: libgomp/oacc-parallel.c
===
--- libgomp/oacc-parallel.c	(revision 225959)
+++ libgomp/oacc-parallel.c	(working copy)
@@ -105,13 +105,13 @@ GOACC_parallel (int device, void (*fn) (
   return;
 }
 
-  va_start (ap, num_waits);
+  if (num_waits)
+{
+  va_start (ap, num_waits);
+  goacc_wait (async, num_waits, ap);
+  va_end (ap);
+}
   
-  if (num_waits > 0)
-goacc_wait (async, num_waits, ap);
-
-  va_end (ap);
-
   acc_dev->openacc.async_set_async_func (async);
 
   if (!(acc_dev->capabilities & GOMP_OFFLOAD_CAP_NATIVE_EXEC))
@@ -225,14 +225,12 @@ GOACC_enter_exit_data (int device, size_
   || host_fallback)
 return;
 
-  if (num_waits > 0)
+  if (num_waits)
 {
   va_list ap;
 
   va_start (ap, num_waits);
-
   goacc_wait (async, num_waits, ap);
-
   va_end (ap);
 }
 
@@ -350,47 +348,21 @@ goacc_wait (int async, int num_waits, va
 {
   struct goacc_thread *thr = goacc_thread ();
   struct gomp_device_descr *acc_dev = thr->dev;
-  int i;
-
-  assert (num_waits >= 0);
-
-  if (async == acc_async_sync && num_waits == 0)
-{
-  acc_wait_all ();
-  return;
-}
-
-  if (async == acc_async_sync && num_waits)
-{
-  for (i = 0; i < num_waits; i++)
-{
-  int qid = va_arg (ap, int);
-
-  if (acc_async_test (qid))
-continue;
 
-  acc_wait (qid);
-}
-  return;
-}
-
-  if (async == acc_async_noval && num_waits == 0)
-{
-  acc_dev->openacc.async_wait_all_async_func (acc_async_noval);
-  return;
-}
-
-  for (i = 0; i < num_waits; i++)
+  while (num_waits--)
 {
   int qid = va_arg (ap, int);
 
   if (acc_async_test (qid))
 	continue;
 
-  /* If we're waiting on the same asynchronous queue as we're launching on,
- the queue itself will order work as required, so there's no need to
-	 wait explicitly.  */
-  if (qid != async)
+  if (async == acc_async_sync)
+	acc_wait (qid);
+  else if (qid == async)
+	;/* If we're waiting on the same asynchronous queue as we're
+	launching on, the queue itself will order work as
+	required, so there's no need to wait explicitly.  */
+  else
 	acc_dev->openacc.async_wait_async_func (qid, async);
 }
 }
@@ -412,14 +384,12 @@ GOACC_update (int device, size_t mapnum,
   || host_fallback)
 return;
 
-  if (num_waits > 0)
+  if (num_waits)
 {
   va_list ap;
 
   va_start (ap, num_waits);
-
   goacc_wait (async, num_waits, ap);
-
   va_end (ap);
 }
 
@@ -455,13 +425,18 @@ GOACC_update (int device, size_t mapnum,
 void
 GOACC_wait (int async, int num_waits, ...)
 {
-  va_list ap;
-
-  va_start (ap, num_waits);
-
-  goacc_wait (async, num_waits, ap);
+  if (num_waits)
+{
+  va_list ap;
 
-  va_end (ap);
+  va_start (ap, num_waits);
+  goacc_wait (async, num_waits, ap);
+  va_end (ap);
+}
+  else if (async == acc_async_sync)
+acc_wait_all ();
+  else if (async == acc_async_noval)
+acc_dev->openacc.async_wait_all_async_func (acc_async_noval);
 }
 
 int


Re: [gomp4] remove kernel-specific launch

2015-07-19 Thread Tom de Vries

On 19/07/15 14:27, Nathan Sidwell wrote:

Tom,
as we discussed this patch removes the GOACC_kernels call, which
forwards to GOACC_parallel.  We simply call GOACC_parallel directly.

ok for gomp4 branch?



Hi Nathan,

yes, that looks good.

Thanks,
- Tom



[v3 PATCH] Implement N4089 and N4387

2015-07-19 Thread Ville Voutilainen
Tested on Linux-PPC64.

2015-07-19  Ville Voutilainen  
Implement N4089 Safe conversions in unique_ptr (LWG 2118)
and N4387 LWG 2228: Missing SFINAE rule in unique_ptr
templated assignment
* include/bits/unique_ptr.h
(__remove_cv, __is_derived_Tp): Remove.
(default_delete::default_delete(const default_delete<_Up[]>)):
Constrain with array convertibility.
(default_delete::operator(_Up*)): Turn into a template,
constrain with array convertibility.
(__safe_conversion_up): New, single object version.
(unique_ptr(unique_ptr<_Up, _Ep>&& __u)): Constrain with array
convertibility.
(unique_ptr::operator=(unique_ptr<_Up, _Ep>&& __u)): Likewise, and add
is_assignable as a constraint.
(__safe_conversion_up): Array version, renamed from __safe_conversion,
updated to implement N4089.
(__safe_conversion_raw): New.
(unique_ptr(_Up __p)): Turn into a template, constrain with array
convertibility.
(unique_ptr(_Up __p,
typename conditional::value,
deleter_type, const deleter_type&>::type __d)): Likewise.
(unique_ptr(_Up __p, typename
 remove_reference::type&& __d)): Likewise.
(unique_ptr(unique_ptr<_Up, _Ep>&& __u)): Likewise.
(operator=(unique_ptr<_Up, _Ep>&& __u)): Likewise, and add
is_assignable as a constraint (array version).
(reset(_Up __p)): Turn into a template, constrain with array
convertibility.
(reset(nullptr_t p)): New.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust.
* testsuite/20_util/unique_ptr/assign/48635.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/cv_qual.cc: Likewise.
* testsuite/20_util/unique_ptr/cons/cv_qual.cc: Likewise.
* testsuite/20_util/unique_ptr/dr2228.cc: New.
* testsuite/20_util/unique_ptr/modifiers/cv_qual.cc: Adjust.


unique_ptr_fixes.diff.gz
Description: GNU Zip compressed data


Re: [v3 PATCH] Implement N4089 and N4387

2015-07-19 Thread Ville Voutilainen
On 19 July 2015 at 19:56, Ville Voutilainen  wrote:
> Tested on Linux-PPC64.
>
> 2015-07-19  Ville Voutilainen  
> Implement N4089 Safe conversions in unique_ptr (LWG 2118)
> and N4387 LWG 2228: Missing SFINAE rule in unique_ptr
> templated assignment
> * include/bits/unique_ptr.h
> (__remove_cv, __is_derived_Tp): Remove.
> (default_delete::default_delete(const default_delete<_Up[]>)):
> Constrain with array convertibility.
> (default_delete::operator(_Up*)): Turn into a template,
> constrain with array convertibility.
> (__safe_conversion_up): New, single object version.
> (unique_ptr(unique_ptr<_Up, _Ep>&& __u)): Constrain with array
> convertibility.
> (unique_ptr::operator=(unique_ptr<_Up, _Ep>&& __u)): Likewise, and add
> is_assignable as a constraint.
> (__safe_conversion_up): Array version, renamed from __safe_conversion,
> updated to implement N4089.
> (__safe_conversion_raw): New.
> (unique_ptr(_Up __p)): Turn into a template, constrain with array
> convertibility.
> (unique_ptr(_Up __p,
> typename conditional::value,
> deleter_type, const deleter_type&>::type __d)): Likewise.
> (unique_ptr(_Up __p, typename
>  remove_reference::type&& __d)): Likewise.
> (unique_ptr(unique_ptr<_Up, _Ep>&& __u)): Likewise.
> (operator=(unique_ptr<_Up, _Ep>&& __u)): Likewise, and add
> is_assignable as a constraint (array version).
> (reset(_Up __p)): Turn into a template, constrain with array
> convertibility.
> (reset(nullptr_t p)): New.
> * testsuite/20_util/default_delete/48631_neg.cc: Adjust.
> * testsuite/20_util/unique_ptr/assign/48635.cc: Likewise.
> * testsuite/20_util/unique_ptr/assign/48635_neg.cc: Likewise.
> * testsuite/20_util/unique_ptr/assign/cv_qual.cc: Likewise.
> * testsuite/20_util/unique_ptr/cons/cv_qual.cc: Likewise.
> * testsuite/20_util/unique_ptr/dr2228.cc: New.
> * testsuite/20_util/unique_ptr/modifiers/cv_qual.cc: Adjust.

Minor changelog fix, the single-pointer functions aren't constrained with
array compatibility, but with deleter compatibility.

2015-07-19  Ville Voutilainen  
Implement N4089 Safe conversions in unique_ptr (LWG 2118)
and N4387 LWG 2228: Missing SFINAE rule in unique_ptr
templated assignment
* include/bits/unique_ptr.h
(__remove_cv, __is_derived_Tp): Remove.
(default_delete::default_delete(const default_delete<_Up[]>)):
Constrain with array convertibility.
(default_delete::operator(_Up*)): Turn into a template,
constrain with array convertibility.
(__safe_conversion_up): New, single object version.
(unique_ptr(unique_ptr<_Up, _Ep>&& __u)): Constrain with deleter
convertibility.
(unique_ptr::operator=(unique_ptr<_Up, _Ep>&& __u)): Likewise, and add
is_assignable as a constraint.
(__safe_conversion_up): Array version, renamed from __safe_conversion,
updated to implement N4089.
(__safe_conversion_raw): New.
(unique_ptr(_Up __p)): Turn into a template, constrain with array
convertibility.
(unique_ptr(_Up __p,
typename conditional::value,
deleter_type, const deleter_type&>::type __d)): Likewise.
(unique_ptr(_Up __p, typename
 remove_reference::type&& __d)): Likewise.
(unique_ptr(unique_ptr<_Up, _Ep>&& __u)): Likewise.
(operator=(unique_ptr<_Up, _Ep>&& __u)): Likewise, and add
is_assignable as a constraint (array version).
(reset(_Up __p)): Turn into a template, constrain with array
convertibility.
(reset(nullptr_t p)): New.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust.
* testsuite/20_util/unique_ptr/assign/48635.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/cv_qual.cc: Likewise.
* testsuite/20_util/unique_ptr/cons/cv_qual.cc: Likewise.
* testsuite/20_util/unique_ptr/dr2228.cc: New.
* testsuite/20_util/unique_ptr/modifiers/cv_qual.cc: Adjust.


Re: [v3 PATCH] Implement N4089 and N4387

2015-07-19 Thread Ville Voutilainen
On 19 July 2015 at 20:13, Ville Voutilainen  wrote:
> Minor changelog fix, the single-pointer functions aren't constrained with
> array compatibility, but with deleter compatibility.

And that should be single-object, not single-pointer, not that it has any
effect on the corrected changelog. :)


[patch] Fix wrong URL for N4279 in libstdc++ manual.

2015-07-19 Thread Jonathan Wakely

Committed to trunk.

commit bfd6e14c25de5e2f97dd1ab037a53b35df4f
Author: Jonathan Wakely 
Date:   Sun Jul 19 19:31:16 2015 +0100

	* doc/xml/manual/status_cxx2017.xml: Fix URL for N4279.
	* doc/html/manual/status.html: Regenerate.

diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
index 491e024..c0bca84 100644
--- a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
+++ b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml
@@ -118,7 +118,7 @@ not in any particular release.
 
   
   
-	http://www.w3.org/1999/xlink"; xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4279.pdf";>
+	http://www.w3.org/1999/xlink"; xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4279.html";>
 	  N4279
 	
   


[PATCH] Refactor graphite-isl-ast-to-gimple.c

2015-07-19 Thread Aditya Kumar
Refactor graphite-isl-ast-to-gimple.c:
Refactor so that each function can access 'region'. This will help
maintain a parameter rename_map within a region. No functional change intended.
This patch will be followed by another set of patches
where translate_isl_ast_to_gimple::region is used to keep parameters which needs
renaming. Since we are planning to remove limit_scops, we now have to maintain a
set of parameters which needs renaming. This refactoring helps avoid passing
`region' to many functions.

gcc/ChangeLog:

2015-07-19  Aditya Kumar  

* graphite-isl-ast-to-gimple.c:
Refactor so that each function can access 'region'. This will help
maintain a parameter rename_map within a region.
---
 gcc/graphite-isl-ast-to-gimple.c | 153 +++
 1 file changed, 122 insertions(+), 31 deletions(-)

diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index b32781a..86a921b 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -124,9 +124,84 @@ void ivs_params_clear (ivs_params &ip)
 }
 }
 
-static tree
-gcc_expression_from_isl_expression (tree type, __isl_take isl_ast_expr *,
-   ivs_params &ip);
+class translate_isl_ast_to_gimple
+{
+public:
+  translate_isl_ast_to_gimple (sese r)
+   : region (r)
+  { }
+
+  edge translate_isl_ast (loop_p context_loop, __isl_keep isl_ast_node *node,
+ edge next_e, ivs_params &ip);
+
+  edge translate_isl_ast_node_for (loop_p context_loop,
+  __isl_keep isl_ast_node *node,
+  edge next_e, ivs_params &ip);
+
+  edge translate_isl_ast_for_loop (loop_p context_loop,
+  __isl_keep isl_ast_node *node_for,
+  edge next_e,
+  tree type, tree lb, tree ub,
+  ivs_params &ip);
+
+  edge translate_isl_ast_node_if (loop_p context_loop,
+ __isl_keep isl_ast_node *node,
+ edge next_e, ivs_params &ip);
+
+  edge translate_isl_ast_node_user (__isl_keep isl_ast_node *node,
+   edge next_e, ivs_params &ip);
+
+  edge translate_isl_ast_node_block (loop_p context_loop,
+__isl_keep isl_ast_node *node,
+edge next_e, ivs_params &ip);
+
+  tree unary_op_to_tree (tree type, __isl_take isl_ast_expr *expr,
+ivs_params &ip);
+
+  tree binary_op_to_tree (tree type, __isl_take isl_ast_expr *expr,
+ ivs_params &ip);
+
+  tree ternary_op_to_tree (tree type, __isl_take isl_ast_expr *expr,
+  ivs_params &ip);
+
+  tree nary_op_to_tree (tree type, __isl_take isl_ast_expr *expr,
+   ivs_params &ip);
+
+  tree gcc_expression_from_isl_expression (tree type,
+  __isl_take isl_ast_expr *,
+  ivs_params &ip);
+
+  tree gcc_expression_from_isl_ast_expr_id (tree type,
+   __isl_keep isl_ast_expr *expr_id,
+   ivs_params &ip);
+
+  tree gcc_expression_from_isl_expr_int (tree type,
+__isl_take isl_ast_expr *expr);
+
+  tree gcc_expression_from_isl_expr_op (tree type,
+   __isl_take isl_ast_expr *expr,
+   ivs_params &ip);
+
+  struct loop *graphite_create_new_loop (edge entry_edge,
+__isl_keep isl_ast_node *node_for,
+loop_p outer, tree type,
+tree lb, tree ub, ivs_params &ip);
+
+  edge graphite_create_new_guard (edge entry_edge,
+ __isl_take isl_ast_expr *if_cond,
+ ivs_params &ip);
+
+  edge graphite_create_new_loop_guard (edge entry_edge,
+  __isl_keep isl_ast_node *node_for,
+  tree *type,
+  tree *lb, tree *ub, ivs_params &ip);
+
+  void build_iv_mapping (vec iv_map, gimple_bb_p gbb,
+__isl_keep isl_ast_expr *user_expr, ivs_params &ip,
+sese region);
+private:
+  sese region;
+};
 
 /* Return the tree variable that corresponds to the given isl ast identifier
expression (an isl_ast_expr of type isl_ast_expr_id).
@@ -136,7 +211,8 @@ gcc_expression_from_isl_expression (tree type, __isl_take 
isl_ast_expr *,
converting type sizes may be problematic when we switch to smaller
types.  */
 
-static tree
+tree
+translate_isl_ast_to_gimple::
 gcc_expression_from_isl_ast_expr_id (tree type,
 

RE: [PATCH] Rename parameters which are within scop

2015-07-19 Thread Aditya K



> Date: Sat, 18 Jul 2015 02:22:19 +0200
> From: tob...@grosser.es
> To: hiradi...@msn.com; gcc-patches@gcc.gnu.org
> CC: seb...@gmail.com; richard.guent...@gmail.com
> Subject: Re: [PATCH] Rename parameters which are within scop
>
> Hi Aditya,
>
> could you possible expand the commit message a little bit to explain
> what you are doing?


My bad,
I sent a different patch which did not have the updated commit message. I have 
send another patch (https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01614.html)
which has comments and the email title is also relevant to the change. Sorry 
for the confusion.


-Aditya


>
> Tobias
>
>
> On 07/18/2015 01:00 AM, Aditya Kumar wrote:> ---
>> gcc/graphite-isl-ast-to-gimple.c | 153 
>> +++
>> 1 file changed, 122 insertions(+), 31 deletions(-)
>>
>> diff --git a/gcc/graphite-isl-ast-to-gimple.c 
>> b/gcc/graphite-isl-ast-to-gimple.c
>> index b32781a..3e2c1fa 100644
>> --- a/gcc/graphite-isl-ast-to-gimple.c
>> +++ b/gcc/graphite-isl-ast-to-gimple.c
>> @@ -124,9 +124,84 @@ void ivs_params_clear (ivs_params &ip)
>> }
>> }
>>
>> -static tree
>> -gcc_expression_from_isl_expression (tree type, __isl_take isl_ast_expr *,
>> - ivs_params &ip);
>> +class translate_isl_ast_to_gimple
>> +{
>> +public:
>> + translate_isl_ast_to_gimple (sese r)
>> + : region (r)
>> + { }
>> +
>> + edge translate_isl_ast (loop_p context_loop, __isl_keep isl_ast_node *node,
>> + edge next_e, ivs_params &ip);
>> +
>> + edge translate_isl_ast_node_for (loop_p context_loop,
>> + __isl_keep isl_ast_node *node,
>> + edge next_e, ivs_params &ip);
>> +
>> + edge translate_isl_ast_for_loop (loop_p context_loop,
>> + __isl_keep isl_ast_node *node_for,
>> + edge next_e,
>> + tree type, tree lb, tree ub,
>> + ivs_params &ip);
>> +
>> + edge translate_isl_ast_node_if (loop_p context_loop,
>> + __isl_keep isl_ast_node *node,
>> + edge next_e, ivs_params &ip);
>> +
>> + edge translate_isl_ast_node_user (__isl_keep isl_ast_node *node,
>> + edge next_e, ivs_params &ip);
>> +
>> + edge translate_isl_ast_node_block (loop_p context_loop,
>> + __isl_keep isl_ast_node *node,
>> + edge next_e, ivs_params &ip);
>> +
>> + tree unary_op_to_tree (tree type, __isl_take isl_ast_expr *expr,
>> + ivs_params &ip);
>> +
>> + tree binary_op_to_tree (tree type, __isl_take isl_ast_expr *expr,
>> + ivs_params &ip);
>> +
>> + tree ternary_op_to_tree (tree type, __isl_take isl_ast_expr *expr,
>> + ivs_params &ip);
>> +
>> + tree nary_op_to_tree (tree type, __isl_take isl_ast_expr *expr,
>> + ivs_params &ip);
>> +
>> + tree gcc_expression_from_isl_expression (tree type,
>> + __isl_take isl_ast_expr *,
>> + ivs_params &ip);
>> +
>> + tree gcc_expression_from_isl_ast_expr_id (tree type,
>> + __isl_keep isl_ast_expr *expr_id,
>> + ivs_params &ip);
>> +
>> + tree gcc_expression_from_isl_expr_int (tree type,
>> + __isl_take isl_ast_expr *expr);
>> +
>> + tree gcc_expression_from_isl_expr_op (tree type,
>> + __isl_take isl_ast_expr *expr,
>> + ivs_params &ip);
>> +
>> + struct loop *graphite_create_new_loop (edge entry_edge,
>> + __isl_keep isl_ast_node *node_for,
>> + loop_p outer, tree type,
>> + tree lb, tree ub, ivs_params &ip);
>> +
>> + edge graphite_create_new_guard (edge entry_edge,
>> + __isl_take isl_ast_expr *if_cond,
>> + ivs_params &ip);
>> +
>> + edge graphite_create_new_loop_guard (edge entry_edge,
>> + __isl_keep isl_ast_node *node_for,
>> + tree *type,
>> + tree *lb, tree *ub, ivs_params &ip);
>> +
>> + void build_iv_mapping (vec iv_map, gimple_bb_p gbb,
>> + __isl_keep isl_ast_expr *user_expr, ivs_params &ip,
>> + sese region);
>> +private:
>> + sese region;
>> +};
>>
>> /* Return the tree variable that corresponds to the given isl ast identifier
>> expression (an isl_ast_expr of type isl_ast_expr_id).
>> @@ -136,7 +211,8 @@ gcc_expression_from_isl_expression (tree type, 
>> __isl_take isl_ast_expr *,
>> converting type sizes may be problematic when we switch to smaller
>> types. */
>>
>> -static tree
>> +tree
>> +translate_isl_ast_to_gimple::
>> gcc_expression_from_isl_ast_expr_id (tree type,
>> __isl_keep isl_ast_expr *expr_id,
>> ivs_params &ip)
>> @@ -147,7 +223,7 @@ gcc_expression_from_isl_ast_expr_id (tree type,
>> res = ip.find (tmp_isl_id);
>> isl_id_free (tmp_isl_id);
>> gcc_assert (res != ip.end () &&
>> - "Could not map isl_id to tree expression");
>> + "Could not map isl_id to tree expression");
>> isl_ast_expr_free (expr_id);
>> return fold_convert (type, res->second);
>> }
>> @@ -155,7 +231,8 @@ gcc_expression_from_isl_ast_expr_id (tree type,
>> /* Converts an isl_ast_expr_int expression E to a GCC expression tree of
>> type TYPE. */
>>
>> -static tree
>> +tree
>> +translate_isl_ast_to_gimple::
>> gcc_expression_from_isl_expr_int (tree type, __isl_take isl_ast_expr *expr)
>> {
>> gcc_assert (isl_ast_expr_get_type (expr) == isl_ast_expr_int);
>> @@ -176,7 +253,8 @@ gcc_expression_from_isl_expr_int (tree type, __isl_take 
>> isl_ast_expr *expr

Re: [PATCH] Refactor graphite-isl-ast-to-gimple.c

2015-07-19 Thread Tobias Grosser

On 07/19/2015 09:46 PM, Aditya Kumar wrote:

Refactor graphite-isl-ast-to-gimple.c:
Refactor so that each function can access 'region'. This will help
maintain a parameter rename_map within a region. No functional change intended.
This patch will be followed by another set of patches
where translate_isl_ast_to_gimple::region is used to keep parameters which needs
renaming. Since we are planning to remove limit_scops, we now have to maintain a
set of parameters which needs renaming. This refactoring helps avoid passing
`region' to many functions.


Ah, OK. Now I get it. Generally this looks fine to me (assuming it 
passes a bootstrap), but I wonder if it would not make more sense to 
move the comments inside the class right over the function declarations.


Best,
Tobias


gcc/ChangeLog:

2015-07-19  Aditya Kumar  

 * graphite-isl-ast-to-gimple.c:
Refactor so that each function can access 'region'. This will help
maintain a parameter rename_map within a region.
---
  gcc/graphite-isl-ast-to-gimple.c | 153 +++
  1 file changed, 122 insertions(+), 31 deletions(-)

diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index b32781a..86a921b 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -124,9 +124,84 @@ void ivs_params_clear (ivs_params &ip)
  }
  }

-static tree
-gcc_expression_from_isl_expression (tree type, __isl_take isl_ast_expr *,
-   ivs_params &ip);
+class translate_isl_ast_to_gimple
+{
+public:
+  translate_isl_ast_to_gimple (sese r)
+   : region (r)
+  { }
+
+  edge translate_isl_ast (loop_p context_loop, __isl_keep isl_ast_node *node,
+ edge next_e, ivs_params &ip);
+
+  edge translate_isl_ast_node_for (loop_p context_loop,
+  __isl_keep isl_ast_node *node,
+  edge next_e, ivs_params &ip);
+
+  edge translate_isl_ast_for_loop (loop_p context_loop,
+  __isl_keep isl_ast_node *node_for,
+  edge next_e,
+  tree type, tree lb, tree ub,
+  ivs_params &ip);
+
+  edge translate_isl_ast_node_if (loop_p context_loop,
+ __isl_keep isl_ast_node *node,
+ edge next_e, ivs_params &ip);
+
+  edge translate_isl_ast_node_user (__isl_keep isl_ast_node *node,
+   edge next_e, ivs_params &ip);
+
+  edge translate_isl_ast_node_block (loop_p context_loop,
+__isl_keep isl_ast_node *node,
+edge next_e, ivs_params &ip);
+
+  tree unary_op_to_tree (tree type, __isl_take isl_ast_expr *expr,
+ivs_params &ip);
+
+  tree binary_op_to_tree (tree type, __isl_take isl_ast_expr *expr,
+ ivs_params &ip);
+
+  tree ternary_op_to_tree (tree type, __isl_take isl_ast_expr *expr,
+  ivs_params &ip);
+
+  tree nary_op_to_tree (tree type, __isl_take isl_ast_expr *expr,
+   ivs_params &ip);
+
+  tree gcc_expression_from_isl_expression (tree type,
+  __isl_take isl_ast_expr *,
+  ivs_params &ip);
+
+  tree gcc_expression_from_isl_ast_expr_id (tree type,
+   __isl_keep isl_ast_expr *expr_id,
+   ivs_params &ip);
+
+  tree gcc_expression_from_isl_expr_int (tree type,
+__isl_take isl_ast_expr *expr);
+
+  tree gcc_expression_from_isl_expr_op (tree type,
+   __isl_take isl_ast_expr *expr,
+   ivs_params &ip);
+
+  struct loop *graphite_create_new_loop (edge entry_edge,
+__isl_keep isl_ast_node *node_for,
+loop_p outer, tree type,
+tree lb, tree ub, ivs_params &ip);
+
+  edge graphite_create_new_guard (edge entry_edge,
+ __isl_take isl_ast_expr *if_cond,
+ ivs_params &ip);
+
+  edge graphite_create_new_loop_guard (edge entry_edge,
+  __isl_keep isl_ast_node *node_for,
+  tree *type,
+  tree *lb, tree *ub, ivs_params &ip);
+
+  void build_iv_mapping (vec iv_map, gimple_bb_p gbb,
+__isl_keep isl_ast_expr *user_expr, ivs_params &ip,
+sese region);
+private:
+  sese region;
+};

  /* Return the tree variable that corresponds to the given isl ast identifier
 expression (an isl_ast_expr of type isl_ast_expr_id).
@@ -136

Re: [gomp4] remove kernel-specific launch

2015-07-19 Thread Thomas Schwinge
Hi!

On Sun, 19 Jul 2015 08:27:44 -0400, Nathan Sidwell  wrote:
> Tom,
> as we discussed this patch removes the GOACC_kernels call, which forwards to 
> GOACC_parallel.  We simply call GOACC_parallel directly.
> 
> ok for gomp4 branch?

>   gcc/
>   * omp-low.c (expand_omp_target): Convert to
>   BUILT_IN_GOACC_PARALLEL. Remove BUILT_IN_GOACC_KERNELS cases.
>   * omp-builtins.def (BUILT_IN_GOACC_KERNELS): Delete.
> 
>   libgomp/
>   * oacc-parallel.c (GOACC_kernels): Delete.

Yes, thanks for the cleanup.  Please also adjust/remove the following:

gcc/tree-parloops.c:/* Remove GOACC_kernels.  */
libgomp/libgomp.map:GOACC_kernels;
libgomp/libgomp_g.h:extern void GOACC_kernels (int, void (*) (void *), 
size_t,

Does it make sense then to rename GOACC_kernels_internal to
GOACC_kernels?


Grüße,
 Thomas


signature.asc
Description: PGP signature


Re: [gomp4] remove kernel-specific launch

2015-07-19 Thread Tom de Vries

On 19/07/15 22:30, Thomas Schwinge wrote:

Does it make sense then to rename GOACC_kernels_internal to
GOACC_kernels?


I prefer to keep the name GOACC_kernels_internal, IMO it's clearer.

Thanks,
- Tom


Fix PTX loaded module data

2015-07-19 Thread Nathan Sidwell

Hi,
this patch fixes the ptx plugin's management of offloaded functions.  Currently 
it has a single global list of functions.  But it should track this information 
per ptx device instance.  I've moved the linked list  into the per-device data.


We were also not managing the plugin-allocated vector of offloaded functions, 
with some totally bogus code in the unload routine.  This is currently not used, 
because there is no unloading destructor.  The patch fixes that.


A followup patch will then be able to enable unloading.

ok for trunk?

nathan
2015-07-18  Nathan Sidwell  

	* plugin/plugin-nvptx.c (struct targ_fn_descriptor): Move later.
	(struct ptx_image_data): Move earlier, add fns field.
	(struct ptx_device): Add images and image_lock fields.
	(ptx_images, ptx_image_lock): Delete.
	(nvptx_open_device): Initialize images and image_lock fields.
	(nvptx_close_device): Destroy image_lock.
	(GOMP_OFFLOAD_load_image): Register image to device-specific fields.
	(GOMP_OFFLOAD_unload_image): Unregister image from device-specific
	fields.

Index: libgomp/plugin/plugin-nvptx.c
===
--- libgomp/plugin/plugin-nvptx.c	(revision 225984)
+++ libgomp/plugin/plugin-nvptx.c	(working copy)
@@ -127,12 +127,6 @@ cuda_error (CUresult r)
   return &errmsg[0];
 }
 
-struct targ_fn_descriptor
-{
-  CUfunction fn;
-  const char *name;
-};
-
 static unsigned int instantiated_devices = 0;
 static pthread_mutex_t ptx_dev_lock = PTHREAD_MUTEX_INITIALIZER;
 
@@ -288,6 +282,25 @@ map_push (struct ptx_stream *s, int asyn
   return;
 }
 
+/* Descriptor of a loaded function.  */
+
+struct targ_fn_descriptor
+{
+  CUfunction fn;
+  const char *name;
+};
+
+/* A loaded PTX image.  */
+struct ptx_image_data
+{
+  const void *target_data;
+  CUmodule module;
+
+  struct targ_fn_descriptor *fns;  /* Array of functions.  */
+  
+  struct ptx_image_data *next;
+};
+
 struct ptx_device
 {
   CUcontext ctx;
@@ -311,6 +324,9 @@ struct ptx_device
   int  mode;
   bool mkern;
 
+  struct ptx_image_data *images;  /* Images loaded on device.  */
+  pthread_mutex_t image_lock; /* Lock for above list.  */
+  
   struct ptx_device *next;
 };
 
@@ -332,21 +348,11 @@ struct ptx_event
   struct ptx_event *next;
 };
 
-struct ptx_image_data
-{
-  const void *target_data;
-  CUmodule module;
-  struct ptx_image_data *next;
-};
-
 static pthread_mutex_t ptx_event_lock;
 static struct ptx_event *ptx_events;
 
 static struct ptx_device **ptx_devices;
 
-static struct ptx_image_data *ptx_images = NULL;
-static pthread_mutex_t ptx_image_lock = PTHREAD_MUTEX_INITIALIZER;
-
 #define _XSTR(s) _STR(s)
 #define _STR(s) #s
 
@@ -590,6 +596,7 @@ select_stream_for_async (int async, pthr
 
 /* Initialize the device.  Return TRUE on success, else FALSE.  PTX_DEV_LOCK
should be locked on entry and remains locked on exit.  */
+
 static bool
 nvptx_init (void)
 {
@@ -746,6 +753,9 @@ nvptx_open_device (int n)
   if (r != CUDA_SUCCESS)
 async_engines = 1;
 
+  ptx_dev->images = NULL;
+  pthread_mutex_init (&ptx_dev->image_lock, NULL);
+
   init_streams_for_device (ptx_dev, async_engines);
 
   return ptx_dev;
@@ -760,6 +770,8 @@ nvptx_close_device (struct ptx_device *p
 return;
 
   fini_streams_for_device (ptx_dev);
+  
+  pthread_mutex_destroy (&ptx_dev->image_lock);
 
   if (!ptx_dev->ctx_shared)
 {
@@ -1632,6 +1644,9 @@ typedef struct nvptx_tdata
   size_t fn_num;
 } nvptx_tdata_t;
 
+/* Load the (partial) program described by TARGET_DATA to device
+   number ORD.  Allocate and return TARGET_TABLE.  */
+
 int
 GOMP_OFFLOAD_load_image (int ord, const void *target_data,
 			 struct addr_pair **target_table)
@@ -1641,23 +1656,19 @@ GOMP_OFFLOAD_load_image (int ord, const
   unsigned int fn_entries, var_entries, i, j;
   CUresult r;
   struct targ_fn_descriptor *targ_fns;
+  struct addr_pair *targ_tbl;
   const nvptx_tdata_t *img_header = (const nvptx_tdata_t *) target_data;
   struct ptx_image_data *new_image;
+  struct ptx_device *dev;
 
   GOMP_OFFLOAD_init_device (ord);
 
+  dev = ptx_devices[ord];
+  
   nvptx_attach_host_thread_to_device (ord);
 
   link_ptx (&module, img_header->ptx_src);
 
-  pthread_mutex_lock (&ptx_image_lock);
-  new_image = GOMP_PLUGIN_malloc (sizeof (struct ptx_image_data));
-  new_image->target_data = target_data;
-  new_image->module = module;
-  new_image->next = ptx_images;
-  ptx_images = new_image;
-  pthread_mutex_unlock (&ptx_image_lock);
-
   /* The mkoffload utility emits a struct of pointers/integers at the
  start of each offload image.  The array of kernel names and the
  functions addresses form a one-to-one correspondence.  */
@@ -1667,12 +1678,24 @@ GOMP_OFFLOAD_load_image (int ord, const
   fn_entries = img_header->fn_num;
   fn_names = img_header->fn_names;
 
-  *target_table = GOMP_PLUGIN_malloc (sizeof (struct addr_pair)
-  * (fn_entries + var_entries));
+  targ_tbl = GOMP_PLUGIN_malloc (sizeof (struct addr_pair)
+ * (fn_e

Re: [gomp4] remove kernel-specific launch

2015-07-19 Thread Nathan Sidwell

On 07/19/15 16:30, Thomas Schwinge wrote:


 gcc/tree-parloops.c:/* Remove GOACC_kernels.  */
 libgomp/libgomp.map:GOACC_kernels;
 libgomp/libgomp_g.h:extern void GOACC_kernels (int, void (*) (void *), 
size_t,


I fixed all byt the parloops comment.  That comment didn't really make sense to 
me -- it seems to be doing something with the pragma not the call.   Perhaps Tom 
could correct/clarify it?



Does it make sense then to rename GOACC_kernels_internal to
GOACC_kernels?


I  agree with Tom.  But perhaps it should be an internal fn? IIUC those are for 
pseudo-funcs that should be converted to something else before the end of 
compilation.


nathan
2015-07-19  Nathan Sidwell  

	gcc/
	* omp-low.c (expand_omp_target): Convert to
	BUILT_IN_GOACC_PARALLEL. Remove BUILT_IN_GOACC_KERNELS cases.
	* omp-builtins.def (BUILT_IN_GOACC_KERNELS): Delete.

	libgomp/
	* oacc-parallel.c (GOACC_kernels): Delete.
	* libgomp.map: Remove GOACC_kernels.
	* libgomp_g.h (GOACC_kernels): Remove.

Index: gcc/omp-low.c
===
--- gcc/omp-low.c	(revision 225982)
+++ gcc/omp-low.c	(working copy)
@@ -9339,14 +9339,15 @@ expand_omp_target (struct omp_region *re
 	  /* Don't emit the library call.  We've already done that.  */
 	  do_emit_library_call = false;
 	  /* Transform BUILT_IN_GOACC_KERNELS_INTERNAL into
-	 BUILT_IN_GOACC_KERNELS_INTERNAL.  Now that the function body will be
-	 split off, we can no longer regard the omp_data_array reference as
-	 non-escaping.  */
+	 BUILT_IN_GOACC_PARALLELL.  Now that the function
+	 body will be split off, we can no longer regard the
+	 omp_data_array reference as non-escaping.  */
 	  gsi = gsi_last_bb (entry_bb);
 	  gsi_prev (&gsi);
 	  gcall *call = as_a  (gsi_stmt (gsi));
-	  gcc_assert (gimple_call_builtin_p (call, BUILT_IN_GOACC_KERNELS_INTERNAL));
-	  tree fndecl = builtin_decl_explicit (BUILT_IN_GOACC_KERNELS);
+	  gcc_assert (gimple_call_builtin_p
+		  (call, BUILT_IN_GOACC_KERNELS_INTERNAL));
+	  tree fndecl = builtin_decl_explicit (BUILT_IN_GOACC_PARALLEL);
 	  gimple_call_set_fndecl (call, fndecl);
 	  gimple_call_set_fntype (call, TREE_TYPE (fndecl));
 	  gimple_call_reset_alias_info (call);
@@ -9723,7 +9724,6 @@ expand_omp_target (struct omp_region *re
 case BUILT_IN_GOACC_DATA_START:
 case BUILT_IN_GOACC_DECLARE:
 case BUILT_IN_GOACC_ENTER_EXIT_DATA:
-case BUILT_IN_GOACC_KERNELS:
 case BUILT_IN_GOACC_KERNELS_INTERNAL:
 case BUILT_IN_GOACC_PARALLEL:
 case BUILT_IN_GOACC_UPDATE:
@@ -9743,7 +9743,6 @@ expand_omp_target (struct omp_region *re
 case BUILT_IN_GOMP_TARGET_DATA:
 case BUILT_IN_GOMP_TARGET_UPDATE:
   break;
-case BUILT_IN_GOACC_KERNELS:
 case BUILT_IN_GOACC_KERNELS_INTERNAL:
 case BUILT_IN_GOACC_PARALLEL:
   {
Index: gcc/omp-builtins.def
===
--- gcc/omp-builtins.def	(revision 225982)
+++ gcc/omp-builtins.def	(working copy)
@@ -48,9 +48,6 @@ DEF_GOACC_BUILTIN_FNSPEC (BUILT_IN_GOACC
 			  BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_INT_INT_INT_SIZE_INT_INT_VAR,
 			  ATTR_FNSPEC_DOT_DOT_DOT_DOT_r_r_r_NOTHROW_LIST,
 			  ATTR_NOTHROW_LIST, "rrr")
-DEF_GOACC_BUILTIN (BUILT_IN_GOACC_KERNELS, "GOACC_kernels",
-		   BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_INT_INT_INT_SIZE_INT_INT_VAR,
-		   ATTR_NOTHROW_LIST)
 DEF_GOACC_BUILTIN (BUILT_IN_GOACC_PARALLEL, "GOACC_parallel",
 		   BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_INT_INT_INT_SIZE_INT_INT_VAR,
 		   ATTR_NOTHROW_LIST)
Index: libgomp/libgomp.map
===
--- libgomp/libgomp.map	(revision 225982)
+++ libgomp/libgomp.map	(working copy)
@@ -331,7 +331,6 @@ GOACC_2.0.GOMP_4_BRANCH {
   global:
 	GOACC_deviceptr;
 	GOACC_get_ganglocal_ptr;
-	GOACC_kernels;
 	GOACC_register_static;
 } GOACC_2.0;
 
Index: libgomp/oacc-parallel.c
===
--- libgomp/oacc-parallel.c	(revision 225982)
+++ libgomp/oacc-parallel.c	(working copy)
@@ -530,37 +530,6 @@ GOACC_enter_exit_data (int device, size_
   acc_dev->openacc.async_set_async_func (acc_async_sync);
 }
 
-void
-GOACC_kernels (int device, void (*fn) (void *),
-	   size_t mapnum, void **hostaddrs, size_t *sizes,
-	   unsigned short *kinds,
-	   int num_gangs, int num_workers, int vector_length,
-	   size_t shared_size, int async, int num_waits, ...)
-{
-#ifdef HAVE_INTTYPES_H
-  gomp_debug (0, "%s: mapnum=%"PRIu64", hostaddrs=%p, sizes=%p, kinds=%p\n",
-	  __FUNCTION__, (uint64_t) mapnum, hostaddrs, sizes, kinds);
-#else
-  gomp_debug (0, "%s: mapnum=%lu, hostaddrs=%p, sizes=%p, kinds=%p\n",
-	  __FUNCTION__, (unsigned long) mapnum, hostaddrs, sizes, kinds);
-#endif
-
-  va_list ap;
-
-  goacc_lazy_initialize ();
-
-  va_start (ap, num_waits);
-
-  if (num_waits > 0)
-goacc_wait (async, num_waits, ap);
-
-  va_end (ap);
-

Re: [PATCH] gcc: fix building w/isl-0.15

2015-07-19 Thread james harvey
This patch and https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01506.html

Appear to do the trick.  I'm building with ISL 0.15 just fine now.

On Tue, Jul 14, 2015 at 2:45 PM, Mike Frysinger  wrote:
> ---
>  gcc/config.in   |  6 ++
>  gcc/configure   | 31 +++
>  gcc/configure.ac| 14 ++
>  gcc/graphite-dependences.c  | 14 +++---
>  gcc/graphite-optimize-isl.c |  8 ++--
>  gcc/graphite-poly.h |  5 +
>  6 files changed, 69 insertions(+), 9 deletions(-)
>
> diff --git a/gcc/config.in b/gcc/config.in
> index b031a62..23e1757 100644
> --- a/gcc/config.in
> +++ b/gcc/config.in
> @@ -1326,6 +1326,12 @@
>  #endif
>
>
> +/* Define if isl_options_set_schedule_serialize_sccs exists. */
> +#ifndef USED_FOR_TARGET
> +#undef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS
> +#endif
> +
> +
>  /* Define if isl_schedule_constraints_compute_schedule exists. */
>  #ifndef USED_FOR_TARGET
>  #undef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE
> diff --git a/gcc/configure b/gcc/configure
> index 9561e5c..6e81298 100755
> --- a/gcc/configure
> +++ b/gcc/configure
> @@ -28456,6 +28456,8 @@ fi
>
>  # Check whether isl_schedule_constraints_compute_schedule is available;
>  # it's new in ISL-0.13.
> +# Check whether isl_options_set_schedule_serialize_sccs is available;
> +# it's new in ISL-0.15.
>  if test "x${ISLLIBS}" != "x" ; then
>saved_CXXFLAGS="$CXXFLAGS"
>CXXFLAGS="$CXXFLAGS $ISLINC"
> @@ -28485,6 +28487,29 @@ rm -f core conftest.err conftest.$ac_objext \
>{ $as_echo "$as_me:${as_lineno-$LINENO}: result: 
> $ac_has_isl_schedule_constraints_compute_schedule" >&5
>  $as_echo "$ac_has_isl_schedule_constraints_compute_schedule" >&6; }
>
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking for 
> isl_options_set_schedule_serialize_sccs" >&5
> +$as_echo_n "checking Checking for isl_options_set_schedule_serialize_sccs... 
> " >&6; }
> +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#include 
> +int
> +main ()
> +{
> +isl_options_set_schedule_serialize_sccs (NULL, 0);
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_cxx_try_link "$LINENO"; then :
> +  ac_has_isl_options_set_schedule_serialize_sccs=yes
> +else
> +  ac_has_isl_options_set_schedule_serialize_sccs=no
> +fi
> +rm -f core conftest.err conftest.$ac_objext \
> +conftest$ac_exeext conftest.$ac_ext
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: 
> $ac_has_isl_options_set_schedule_serialize_sccs" >&5
> +$as_echo "$ac_has_isl_options_set_schedule_serialize_sccs" >&6; }
> +
>LIBS="$saved_LIBS"
>CXXFLAGS="$saved_CXXFLAGS"
>
> @@ -28493,6 +28518,12 @@ $as_echo 
> "$ac_has_isl_schedule_constraints_compute_schedule" >&6; }
>  $as_echo "#define HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE 1" >>confdefs.h
>
>fi
> +
> +  if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then
> +
> +$as_echo "#define HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS 1" 
> >>confdefs.h
> +
> +  fi
>  fi
>
>  # Check for plugin support
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> index cb14639..7fb964a 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -5725,6 +5725,8 @@ fi
>
>  # Check whether isl_schedule_constraints_compute_schedule is available;
>  # it's new in ISL-0.13.
> +# Check whether isl_options_set_schedule_serialize_sccs is available;
> +# it's new in ISL-0.15.
>  if test "x${ISLLIBS}" != "x" ; then
>saved_CXXFLAGS="$CXXFLAGS"
>CXXFLAGS="$CXXFLAGS $ISLINC"
> @@ -5738,6 +5740,13 @@ if test "x${ISLLIBS}" != "x" ; then
>[ac_has_isl_schedule_constraints_compute_schedule=no])
>AC_MSG_RESULT($ac_has_isl_schedule_constraints_compute_schedule)
>
> +  AC_MSG_CHECKING([Checking for isl_options_set_schedule_serialize_sccs])
> +  AC_TRY_LINK([#include ],
> +  [isl_options_set_schedule_serialize_sccs (NULL, 0);],
> +  [ac_has_isl_options_set_schedule_serialize_sccs=yes],
> +  [ac_has_isl_options_set_schedule_serialize_sccs=no])
> +  AC_MSG_RESULT($ac_has_isl_options_set_schedule_serialize_sccs)
> +
>LIBS="$saved_LIBS"
>CXXFLAGS="$saved_CXXFLAGS"
>
> @@ -5745,6 +5754,11 @@ if test "x${ISLLIBS}" != "x" ; then
>   AC_DEFINE(HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE, 1,
> [Define if isl_schedule_constraints_compute_schedule exists.])
>fi
> +
> +  if test x"$ac_has_isl_options_set_schedule_serialize_sccs" = x"yes"; then
> + AC_DEFINE(HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS, 1,
> +   [Define if isl_options_set_schedule_serialize_sccs exists.])
> +  fi
>  fi
>
>  GCC_ENABLE_PLUGINS
> diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
> index 50fe73e..9a0986d 100644
> --- a/gcc/graphite-dependences.c
> +++ b/gcc/graphite-dependences.c
> @@ -205,7 +205,7 @@ scop_get_transformed_schedule (scop_p scop, 
> vec pbbs)
>  /* Helper function used on each MAP of a isl_union_map.  Compute

Re: [PATCH] gcc/: Fix building with isl-0.15.0; includes

2015-07-19 Thread james harvey
These two patches appear to do the trick.  I'm building with ISL 0.15
just fine now.

On Fri, Jul 17, 2015 at 11:10 AM, Bernhard Reutner-Fischer
 wrote:
> In addition to Mike's "[PATCH] gcc: fix building w/isl-0.15" in
> https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01162.html
> I seem to also need a couple of more includes for isl-0.15.0:
>
> 2015-07-15  Bernhard Reutner-Fischer  
>
> * graphite-blocking.c, graphite-dependences.c,
> graphite-interchange.c, graphite-isl-ast-to-gimple.c,
> graphite-optimize-isl.c, graphite-poly.c,
> graphite-scop-detection.c, graphite-sese-to-poly.c,
> graphite.c: Add missing isl includes.
> ---
>  gcc/graphite-blocking.c  |1 +
>  gcc/graphite-dependences.c   |1 +
>  gcc/graphite-interchange.c   |1 +
>  gcc/graphite-isl-ast-to-gimple.c |2 ++
>  gcc/graphite-optimize-isl.c  |2 ++
>  gcc/graphite-poly.c  |1 +
>  gcc/graphite-scop-detection.c|1 +
>  gcc/graphite-sese-to-poly.c  |1 +
>  gcc/graphite.c   |1 +
>  9 files changed, 11 insertions(+)
>
> diff --git a/gcc/graphite-blocking.c b/gcc/graphite-blocking.c
> index 73d7c59..172bdcd 100644
> --- a/gcc/graphite-blocking.c
> +++ b/gcc/graphite-blocking.c
> @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.  If not see
>  /* Workaround for GMP 5.1.3 bug, see PR56019.  */
>  #include 
>
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
> index 9a0986d..df52e54 100644
> --- a/gcc/graphite-dependences.c
> +++ b/gcc/graphite-dependences.c
> @@ -25,6 +25,7 @@ along with GCC; see the file COPYING3.  If not see
>  /* Workaround for GMP 5.1.3 bug, see PR56019.  */
>  #include 
>
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/gcc/graphite-interchange.c b/gcc/graphite-interchange.c
> index aee51a8..bcf7f3b 100644
> --- a/gcc/graphite-interchange.c
> +++ b/gcc/graphite-interchange.c
> @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.  If not see
>  /* Workaround for GMP 5.1.3 bug, see PR56019.  */
>  #include 
>
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/gcc/graphite-isl-ast-to-gimple.c 
> b/gcc/graphite-isl-ast-to-gimple.c
> index b32781a..7aafee2 100644
> --- a/gcc/graphite-isl-ast-to-gimple.c
> +++ b/gcc/graphite-isl-ast-to-gimple.c
> @@ -24,7 +24,9 @@ along with GCC; see the file COPYING3.  If not see
>  /* Workaround for GMP 5.1.3 bug, see PR56019.  */
>  #include 
>
> +#include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c
> index 388e25c..2b55783 100644
> --- a/gcc/graphite-optimize-isl.c
> +++ b/gcc/graphite-optimize-isl.c
> @@ -24,7 +24,9 @@ along with GCC; see the file COPYING3.  If not see
>  /* Workaround for GMP 5.1.3 bug, see PR56019.  */
>  #include 
>
> +#include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
> index bcd08d8..e3ddd57 100644
> --- a/gcc/graphite-poly.c
> +++ b/gcc/graphite-poly.c
> @@ -25,6 +25,7 @@ along with GCC; see the file COPYING3.  If not see
>  /* Workaround for GMP 5.1.3 bug, see PR56019.  */
>  #include 
>
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
> index 47e0da0..22fdde3 100644
> --- a/gcc/graphite-scop-detection.c
> +++ b/gcc/graphite-scop-detection.c
> @@ -25,6 +25,7 @@ along with GCC; see the file COPYING3.  If not see
>  /* Workaround for GMP 5.1.3 bug, see PR56019.  */
>  #include 
>
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
> index 5064247..7b10289 100644
> --- a/gcc/graphite-sese-to-poly.c
> +++ b/gcc/graphite-sese-to-poly.c
> @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3.  If not see
>  /* Workaround for GMP 5.1.3 bug, see PR56019.  */
>  #include 
>
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/gcc/graphite.c b/gcc/graphite.c
> index a81ef6a..32f405a 100644
> --- a/gcc/graphite.c
> +++ b/gcc/graphite.c
> @@ -38,6 +38,7 @@ along with GCC; see the file COPYING3.  If not see
>  /* Workaround for GMP 5.1.3 bug, see PR56019.  */
>  #include 
>
> +#include 
>  #include 
>  #include 
>  #include 
> --
> 1.7.10.4
>


Re: [v3 PATCH] Implement N4089 and N4387

2015-07-19 Thread Ville Voutilainen
On 19 July 2015 at 20:14, Ville Voutilainen  wrote:
> On 19 July 2015 at 20:13, Ville Voutilainen  
> wrote:
>> Minor changelog fix, the single-pointer functions aren't constrained with
>> array compatibility, but with deleter compatibility.
>
> And that should be single-object, not single-pointer, not that it has any
> effect on the corrected changelog. :)

Argh, the paper number in the status table was wrong, although the
link was correct,
so the paper number for the missing sfinae condition in the changelog
was also wrong.

2015-07-19  Ville Voutilainen  
Implement N4089 Safe conversions in unique_ptr (LWG 2118)
and N4366 LWG 2228: Missing SFINAE rule in unique_ptr
templated assignment
* include/bits/unique_ptr.h
(__remove_cv, __is_derived_Tp): Remove.
(default_delete::default_delete(const default_delete<_Up[]>)):
Constrain with array convertibility.
(default_delete::operator(_Up*)): Turn into a template,
constrain with array convertibility.
(__safe_conversion_up): New, single object version.
(unique_ptr(unique_ptr<_Up, _Ep>&& __u)): Constrain with deleter
convertibility.
(unique_ptr::operator=(unique_ptr<_Up, _Ep>&& __u)): Likewise, and add
is_assignable as a constraint.
(__safe_conversion_up): Array version, renamed from __safe_conversion,
updated to implement N4089.
(__safe_conversion_raw): New.
(unique_ptr(_Up __p)): Turn into a template, constrain with array
convertibility.
(unique_ptr(_Up __p,
typename conditional::value,
deleter_type, const deleter_type&>::type __d)): Likewise.
(unique_ptr(_Up __p, typename
 remove_reference::type&& __d)): Likewise.
(unique_ptr(unique_ptr<_Up, _Ep>&& __u)): Likewise.
(operator=(unique_ptr<_Up, _Ep>&& __u)): Likewise, and add
is_assignable as a constraint (array version).
(reset(_Up __p)): Turn into a template, constrain with array
convertibility.
(reset(nullptr_t p)): New.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust.
* testsuite/20_util/unique_ptr/assign/48635.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/assign/cv_qual.cc: Likewise.
* testsuite/20_util/unique_ptr/cons/cv_qual.cc: Likewise.
* testsuite/20_util/unique_ptr/dr2228.cc: New.
* testsuite/20_util/unique_ptr/modifiers/cv_qual.cc: Adjust.


Re: [PATCH] gcc/: Fix building with isl-0.15.0; includes

2015-07-19 Thread Tobias Grosser

On 07/19/2015 11:10 PM, james harvey wrote:

These two patches appear to do the trick.  I'm building with ISL 0.15
just fine now.


Nice.

Tobias


[PATCH] config/bfin/bfin.c (hwloop_optimize): Recognize direct jump case and emit lsetup at loop head.

2015-07-19 Thread Chen Gang
2015-07-20  Chen Gang  

* config/bfin/bfin.c (hwloop_optimize): Recognize direct jump
case and emit lsetup at loop head.
---
 gcc/config/bfin/bfin.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index a131053..1c70040 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -3456,7 +3456,7 @@ hwloop_optimize (hwloop_info loop)
   rtx seq_end;
   rtx_insn *seq;
   int length;
-  bool clobber0, clobber1;
+  bool clobber0, clobber1, direct_jmp = false;
 
   if (loop->depth > MAX_LOOP_DEPTH)
 {
@@ -3519,7 +3519,13 @@ hwloop_optimize (hwloop_info loop)
  || !(loop->incoming->last ()->flags & EDGE_FALLTHRU))
{
  gcc_assert (JUMP_P (insn));
- insn = PREV_INSN (insn);
+ if (JUMP_LABEL (insn) != loop->start_label)
+   insn = PREV_INSN (insn);
+ else
+   {
+ direct_jmp = true;
+ insn = loop->start_label;
+   }
}
 
   for (; insn && insn != loop->start_label; insn = NEXT_INSN (insn))
@@ -3783,7 +3789,7 @@ hwloop_optimize (hwloop_info loop)
   seq = get_insns ();
   end_sequence ();
 
-  if (loop->incoming_src)
+  if (loop->incoming_src && !direct_jmp)
 {
   rtx_insn *prev = BB_END (loop->incoming_src);
   if (vec_safe_length (loop->incoming) > 1
-- 
1.9.3


Re: [PATCH 1/2] Allow REG_EQUAL for ZERO_EXTRACT

2015-07-19 Thread Kugan
I have made a mistake while addressing the review comments for this
patch. Unfortunately, It was not detected in my earlier testing. My
sincere graphology for the mistake.

I have basically missed the STRICT_LOW_PART check for the first if-check
thus the second part (which is the ZERO_EXTRACT part) will never get
executed. Attached patch fixes this along with some minor changes.

Bootstrapped and regression tested on arm-none-linux (Chromebook) and
x86-64-linux-gnu with no new regression along with the ARM ennoblement
patch.

Also did a complete arm qemu regression testing with Chriophe's scripts
with no new regression.
(http://people.linaro.org/~christophe.lyon/cross-validation/gcc-test-patches/225987-reg4/report-build-info.html)

Is this OK for trunk,


Thanks,
Kugan

gcc/ChangeLog:

2015-07-20  Kugan Vivekanandarajah  

* cse.c (cse_insn): Fix missing check for STRICT_LOW_PART and minor
clean up.
diff --git a/gcc/cse.c b/gcc/cse.c
index 1c14d83..96adf18 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -4529,10 +4529,10 @@ cse_insn (rtx_insn *insn)
  this case, and if it isn't set, then there will be no equivalence
  for the destination.  */
   if (n_sets == 1 && REG_NOTES (insn) != 0
-  && (tem = find_reg_note (insn, REG_EQUAL, NULL_RTX)) != 0)
+  && (tem = find_reg_note (insn, REG_EQUAL, NULL_RTX)) != 0
+  && (! rtx_equal_p (XEXP (tem, 0), SET_SRC (sets[0].rtl
 {
-  if ((! rtx_equal_p (XEXP (tem, 0), SET_SRC (sets[0].rtl)))
- || GET_CODE (SET_DEST (sets[0].rtl)) == STRICT_LOW_PART)
+  if (GET_CODE (SET_DEST (sets[0].rtl)) == STRICT_LOW_PART)
src_eqv = copy_rtx (XEXP (tem, 0));
 
   /* If DEST is of the form ZERO_EXTACT, as in:
@@ -4544,14 +4544,14 @@ cse_insn (rtx_insn *insn)
 point.  Note that this is different from SRC_EQV. We can however
 calculate SRC_EQV with the position and width of ZERO_EXTRACT.  */
   else if (GET_CODE (SET_DEST (sets[0].rtl)) == ZERO_EXTRACT
-  && CONST_INT_P (src_eqv)
+  && CONST_INT_P (XEXP (tem, 0))
   && CONST_INT_P (XEXP (SET_DEST (sets[0].rtl), 1))
   && CONST_INT_P (XEXP (SET_DEST (sets[0].rtl), 2)))
{
  rtx dest_reg = XEXP (SET_DEST (sets[0].rtl), 0);
  rtx width = XEXP (SET_DEST (sets[0].rtl), 1);
  rtx pos = XEXP (SET_DEST (sets[0].rtl), 2);
- HOST_WIDE_INT val = INTVAL (src_eqv);
+ HOST_WIDE_INT val = INTVAL (XEXP (tem, 0));
  HOST_WIDE_INT mask;
  unsigned int shift;
  if (BITS_BIG_ENDIAN)


[PATCH] libierty: change _ANSIDECL_H to ANSIDECL_H

2015-07-19 Thread Lawrence D'Anna
ansidecl.h is using _ANSIDECL_H as it's guard #ifdef.  But names that start with
underscore are reserved, and the latest version of Xcode seems to be exercising
its prerogative to define _ANSIDECL_H.

This patch changes _ANSIDECL_H to ANSIDECL_H so Xcode can still be used to
bootstrap gcc.

Signed-off-by: Lawrence D'Anna 
---
 include/ansidecl.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/ansidecl.h b/include/ansidecl.h
index 224627d..0d6cd89 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -33,8 +33,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 
MA 02110-1301, USA.
wrappers around __attribute__.  Also, __extension__ will be #defined
to nothing if it doesn't work.  See below.  */
 
-#ifndef_ANSIDECL_H
-#define _ANSIDECL_H1
+#ifndefANSIDECL_H
+#define ANSIDECL_H 1
 
 #ifdef __cplusplus
 extern "C" {
-- 
2.3.8 (Apple Git-58)