diff mbox

[gomp4] internal fns for id & nid

Message ID 87si7rj5m1.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge Aug. 10, 2015, 7:39 p.m. UTC
Hi!

On Mon, 3 Aug 2015 16:43:04 -0400, Nathan Sidwell <nathan@acm.org> wrote:
> I've committed this to gomp4 branch.  It replaces the regular builtins 
> __builtin_GOACC_nid/__builtin_GOACC_id with internal functions IFN_OACC_DIM_SIZE 
> and IFN_OACC_DIM_POS -- moving further away from the PTX-specific naming of id & 
> nid.

Thanks!

> --- gcc/internal-fn.c	(revision 226515)
> +++ gcc/internal-fn.c	(working copy)

> +static void
> +expand_GOACC_DIM_SIZE (gcall *stmt)
> +{
> +  tree lhs = gimple_call_lhs (stmt);
> +
> +  if (!lhs)
> +    return;
> +  
> +  rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
> +  rtx val = expand_expr (gimple_call_arg (stmt, 0), NULL_RTX,
> +			 VOIDmode, EXPAND_NORMAL);
> +#ifdef HAVE_oacc_dim_size
> +  emit_insn (gen_oacc_dim_size (target, val));
> +#else
> +  emit_move_insn (target, const1_rtx);
> +#endif
> +}
> +
> +static void
> +expand_GOACC_DIM_POS (gcall *stmt)
> +{
> +  tree lhs = gimple_call_lhs (stmt);
> +
> +  if (!lhs)
> +    return;
> +  
> +  rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
> +  rtx val = expand_expr (gimple_call_arg (stmt, 0), NULL_RTX,
> +			 VOIDmode, EXPAND_NORMAL);
> +#ifdef HAVE_oacc_dim_pos
> +  emit_insn (gen_oacc_dim_pos (target, val));
> +#else
> +  emit_move_insn (target, const0_rtx);
> +#endif
> +}

Bootstrap failure:

    [...]/source-gcc/gcc/internal-fn.c: In function 'void expand_GOACC_DIM_SIZE(gcall*)':
    [...]/source-gcc/gcc/internal-fn.c:1996:7: error: unused variable 'val' [-Werror=unused-variable]
       rtx val = expand_expr (gimple_call_arg (stmt, 0), NULL_RTX,
           ^
    [...]/source-gcc/gcc/internal-fn.c: In function 'void expand_GOACC_DIM_POS(gcall*)':
    [...]/source-gcc/gcc/internal-fn.c:2014:7: error: unused variable 'val' [-Werror=unused-variable]
       rtx val = expand_expr (gimple_call_arg (stmt, 0), NULL_RTX,
           ^

I'm assuming it is permissible to not expand_expr the call argument (for
side effects) in these two cases (please shout if that's wrong);
committed to gomp-4_0-branch in r226767:

commit f3907d648a9c9420deb4fb9f295b6e192a209f8d
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Aug 10 19:37:49 2015 +0000

    Address -Werror=unused-variable diagnostic
    
    Fixup for r226531.
    
    	gcc/
    	* internal-fn.c (expand_GOACC_DIM_SIZE) [!HAVE_oacc_dim_size]:
    	Don't define and set variable val.
    	(expand_GOACC_DIM_POS) [!HAVE_oacc_dim_pos]: Likewise.
    	* internal-fn.c (expand_GOACC_DIM_SIZE, expand_GOACC_DIM_POS)
    	[!HAVE_oacc_dim_size]: Don't define and set variable val.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@226767 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog.gomp |    6 ++++++
 gcc/internal-fn.c  |    8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)



Grüße,
 Thomas
diff mbox

Patch

diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index 62f5e59..542b1af 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,3 +1,9 @@ 
+2015-08-10  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* internal-fn.c (expand_GOACC_DIM_SIZE) [!HAVE_oacc_dim_size]:
+	Don't define and set variable val.
+	(expand_GOACC_DIM_POS) [!HAVE_oacc_dim_pos]: Likewise.
+
 2015-08-06  Cesar Philippidis  <cesar@codesourcery.com>
 
 	* config/nvptx/nvptx.c (nvptx_expand_lock_unlock): Pass an
diff --git gcc/internal-fn.c gcc/internal-fn.c
index 72bb0bd..05321e1 100644
--- gcc/internal-fn.c
+++ gcc/internal-fn.c
@@ -1993,9 +1993,9 @@  expand_GOACC_DIM_SIZE (gcall *stmt)
     return;
   
   rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
-  rtx val = expand_expr (gimple_call_arg (stmt, 0), NULL_RTX,
-			 VOIDmode, EXPAND_NORMAL);
 #ifdef HAVE_oacc_dim_size
+  rtx val = expand_expr (gimple_call_arg (stmt, 0), NULL_RTX,
+			 VOIDmode, EXPAND_NORMAL);
   emit_insn (gen_oacc_dim_size (target, val));
 #else
   emit_move_insn (target, const1_rtx);
@@ -2011,9 +2011,9 @@  expand_GOACC_DIM_POS (gcall *stmt)
     return;
   
   rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
-  rtx val = expand_expr (gimple_call_arg (stmt, 0), NULL_RTX,
-			 VOIDmode, EXPAND_NORMAL);
 #ifdef HAVE_oacc_dim_pos
+  rtx val = expand_expr (gimple_call_arg (stmt, 0), NULL_RTX,
+			 VOIDmode, EXPAND_NORMAL);
   emit_insn (gen_oacc_dim_pos (target, val));
 #else
   emit_move_insn (target, const0_rtx);