Hi Richard,

On Wed, Jul 12, 2017 at 05:33:42PM +0100, Richard Sandiford wrote:
> The little-endian VSX code uses rotates to swap the two 64-bit halves of
> 128-bit scalar modes.  This is fine for TImode and V1TImode, but it
> isn't really valid to use RTL rotates on floating-point modes like
> KFmode and TFmode, and doing that triggered an assert added by the
> SVE series.  This patch uses bit-casts to V1TImode instead.
> 
> Tested on powerpc64le-linux-gnu.  OK to install?


> +void
> +rs6000_emit_le_vsx_permute (rtx dest, rtx source, machine_mode mode)
>  {
>    /* Use ROTATE instead of VEC_SELECT on IEEE 128-bit floating point, and
>       128-bit integers if they are allowed in VSX registers.  */
> -  if (FLOAT128_VECTOR_P (mode) || mode == TImode || mode == V1TImode)
> -    return gen_rtx_ROTATE (mode, source, GEN_INT (64));
> +  if (FLOAT128_VECTOR_P (mode))
> +    {
> +      dest = gen_lowpart (V1TImode, dest);
> +      source = gen_lowpart (V1TImode, source);
> +      mode = V1TImode;
> +    }

Add an empty line here?  And maybe a comment.

> +  if (mode == TImode || mode == V1TImode)
> +    emit_insn (gen_rtx_SET (dest, gen_rtx_ROTATE (mode, source,
> +                                               GEN_INT (64))));
>    else
>      {
>        rtx par = gen_rtx_PARALLEL (VOIDmode, rs6000_const_vec (mode));
> -      return gen_rtx_VEC_SELECT (mode, source, par);
> +      emit_insn (gen_rtx_SET (dest, gen_rtx_VEC_SELECT (mode, source, par)));
>      }
>  }

> --- gcc/config/rs6000/vsx.md  2017-06-30 12:50:38.889632907 +0100
> +++ gcc/config/rs6000/vsx.md  2017-07-12 16:30:38.734631598 +0100
> @@ -37,6 +37,10 @@ (define_mode_iterator VSX_LE_128 [(KF
>                                 (TI   "TARGET_VSX_TIMODE")
>                                 V1TI])
>  
> +;; Same, but with just the integer modes.
> +(define_mode_iterator VSX_LE_128I [(TI       "TARGET_VSX_TIMODE")
> +                                V1TI])

I don't like that name much.  The difference between VSX_LE_128 and
VSX_LE_128I is easy to overlook (and what _is_ the difference?  "I"
means "integer" I guess?).  The "LE" in the name has no real meaning
(it is used for LE, sure, but that doesn't matter for the iterator).
Maybe just VSX_TI?  Or is that too short.

Other than that, looks fine.  Thank you for the patch!

Does this need backports?


Segher

Reply via email to