Hi!

It's me, again.  ;-)

On Thu, 09 Jul 2015 20:25:22 -0400, Nathan Sidwell <nat...@acm.org> wrote:
> This is the patch I committed.  [...]

> --- config/nvptx/nvptx.c      (revision 225323)
> +++ config/nvptx/nvptx.c      (working copy)

> +/* Direction of the spill/fill and looping setup/teardown indicator.  */
> +
> +enum propagate_mask
> +  {
> +    PM_read = 1 << 0,
> +    PM_write = 1 << 1,
> +    PM_loop_begin = 1 << 2,
> +    PM_loop_end = 1 << 3,
> +
> +    PM_read_write = PM_read | PM_write
> +  };
> +
> +/* Generate instruction(s) to spill or fill register REG to/from the
> +   worker broadcast array.  PM indicates what is to be done, REP
> +   how many loop iterations will be executed (0 for not a loop).  */
> +   
> +static rtx
> +nvptx_gen_wcast (rtx reg, propagate_mask pm, unsigned rep, wcast_data_t 
> *data)
> +{
> +  rtx  res;
> +  machine_mode mode = GET_MODE (reg);
> +
> +  switch (mode)
> +    {
> +    case BImode:
> +      {
> +     rtx tmp = gen_reg_rtx (SImode);
> +     
> +     start_sequence ();
> +     if (pm & PM_read)
> +       emit_insn (gen_sel_truesi (tmp, reg, GEN_INT (1), const0_rtx));
> +     emit_insn (nvptx_gen_wcast (tmp, pm, rep, data));
> +     if (pm & PM_write)
> +       emit_insn (gen_rtx_SET (BImode, reg,
> +                               gen_rtx_NE (BImode, tmp, const0_rtx)));
> +     res = get_insns ();
> +     end_sequence ();
> +      }
> +      break;
> +
> +    default:
> +      {
> +     rtx addr = data->ptr;
> +
> +     if (!addr)
> +       {
> +         unsigned align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT;
> +
> +         if (align > worker_bcast_align)
> +           worker_bcast_align = align;
> +         data->offset = (data->offset + align - 1) & ~(align - 1);
> +         addr = data->base;
> +         if (data->offset)
> +           addr = gen_rtx_PLUS (Pmode, addr, GEN_INT (data->offset));
> +       }
> +     
> +     addr = gen_rtx_MEM (mode, addr);
> +     addr = gen_rtx_UNSPEC (mode, gen_rtvec (1, addr), UNSPEC_SHARED_DATA);
> +     if (pm & PM_read)
> +       res = gen_rtx_SET (mode, addr, reg);
> +     if (pm & PM_write)
> +       res = gen_rtx_SET (mode, reg, addr);
> +
> +     if (data->ptr)
> +       {
> +         /* We're using a ptr, increment it.  */
> +         start_sequence ();
> +         
> +         emit_insn (res);
> +         emit_insn (gen_adddi3 (data->ptr, data->ptr,
> +                                GEN_INT (GET_MODE_SIZE (GET_MODE (res)))));
> +         res = get_insns ();
> +         end_sequence ();
> +       }
> +     else
> +       rep = 1;
> +     data->offset += rep * GET_MODE_SIZE (GET_MODE (reg));
> +      }
> +      break;
> +    }
> +  return res;
> +}

OK to commit the following, or should other PM_* combinations be handled
here, such as (PM_read | PM_write)?  (But I don't think so.)

commit a1909fecb28267aa76df538ad9e01e4d228f5f9a
Author: Thomas Schwinge <tho...@codesourcery.com>
Date:   Tue Jul 14 09:59:48 2015 +0200

    nvptx: Avoid -Wuninitialized diagnostic
    
        [...]/source-gcc/gcc/config/nvptx/nvptx.c: In function 'rtx_def* 
nvptx_gen_wcast(rtx, propagate_mask, unsigned int, wcast_data_t*)':
        [...]/source-gcc/gcc/config/nvptx/nvptx.c:1258:8: warning: 'res' may be 
used uninitialized in this function [-Wuninitialized]
    
        gcc/
        * config/nvptx/nvptx.c (nvptx_gen_wcast): Mark unreachable code
        path.
---
 gcc/config/nvptx/nvptx.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git gcc/config/nvptx/nvptx.c gcc/config/nvptx/nvptx.c
index 0e1e764..dfe5d34 100644
--- gcc/config/nvptx/nvptx.c
+++ gcc/config/nvptx/nvptx.c
@@ -1253,10 +1253,12 @@ nvptx_gen_wcast (rtx reg, propagate_mask pm, unsigned 
rep, wcast_data_t *data)
        
        addr = gen_rtx_MEM (mode, addr);
        addr = gen_rtx_UNSPEC (mode, gen_rtvec (1, addr), UNSPEC_SHARED_DATA);
-       if (pm & PM_read)
+       if (pm == PM_read)
          res = gen_rtx_SET (addr, reg);
-       if (pm & PM_write)
+       else if (pm == PM_write)
          res = gen_rtx_SET (reg, addr);
+       else
+         gcc_unreachable ();
 
        if (data->ptr)
          {


Grüße,
 Thomas

Attachment: signature.asc
Description: PGP signature

Reply via email to