Hi Carl,

On Fri, Apr 13, 2018 at 09:49:25AM -0700, Carl Love wrote:
> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index a0c9b5c..855be43 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -16576,8 +16576,9 @@ rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi)
>        {
>        arg0 = gimple_call_arg (stmt, 0);
>        lhs = gimple_call_lhs (stmt);
> -      /* Only fold the vec_splat_*() if arg0 is constant.  */
> -      if (TREE_CODE (arg0) != INTEGER_CST)
> +      /* Only fold the vec_splat_*() if arg0 is a 5-bit constant.  */
> +      if (TREE_CODE (arg0) != INTEGER_CST
> +          || TREE_INT_CST_LOW (arg0) & ~0x1f)
>          return false;

Should this test for *signed* 5-bit constants only?

         if (TREE_CODE (arg0) != INTEGER_CST
             || !IN_RANGE (TREE_INT_CST_LOW (arg0), -16, 15))

or similar?

Approved for trunk (with such a change if appropriate, and testing
then of course).  Thanks!


Segher

Reply via email to