Hi Mike,

On Sun, Nov 13, 2016 at 01:03:29AM -0500, Michael Meissner wrote:
>       * gcc.target/powerpc/vec-set-short.c: Likesie.

Typo here.

> --- gcc/config/rs6000/rs6000.c        
> (svn+ssh://meiss...@gcc.gnu.org/svn/gcc/trunk/gcc/config/rs6000)        
> (revision 242318)
> +++ gcc/config/rs6000/rs6000.c        (.../gcc/config/rs6000) (working copy)
> @@ -7095,12 +7095,32 @@ rs6000_expand_vector_set (rtx target, rt
>    int width = GET_MODE_SIZE (inner_mode);
>    int i;
>  
> -  if (VECTOR_MEM_VSX_P (mode) && (mode == V2DFmode || mode == V2DImode))
> +  if (VECTOR_MEM_VSX_P (mode))
>      {
> -      rtx (*set_func) (rtx, rtx, rtx, rtx)
> -     = ((mode == V2DFmode) ? gen_vsx_set_v2df : gen_vsx_set_v2di);
> -      emit_insn (set_func (target, target, val, GEN_INT (elt)));
> -      return;
> +      rtx (*set_func) (rtx, rtx, rtx, rtx) = (rtx (*) (rtx, rtx, rtx, rtx))0;

Space after a cast.  But, do you need a function pointer at all?  I.e.
instead of

> +      if (mode == V2DFmode)
> +     set_func = gen_vsx_set_v2df;
> +
> +      else if (mode == V2DImode)
> +     set_func = gen_vsx_set_v2di;

do

      rtx_insn *insn = NULL;

      if (mode == V2DFmode)
        insn = gen_vsx_set_v2df (target, target, val, GEN_INT (elt));

      else if (mode == V2DImode)
        insn = gen_vsx_set_v2di (target, target, val, GEN_INT (elt));

[ snip ]

> +      if (set_func)
> +     {
> +       emit_insn (set_func (target, target, val, GEN_INT (elt)));
> +       return;

      if (insn)
        {
          emit_insn (insn);
          return;
        }

(and maybe do that GEN_INT to a var as well).  Much more readable.


Segher

Reply via email to