On 1/11/24 14:58, Richard Biener wrote:
> The following adds guards avoiding code generation to
> expand_perm_as_a_vlbr_vstbr_candidate when d.testing_p.
> 
> Built and tested on the testcase in the PR.
> 
> OK to push as obvious?  Otherwise please pick up, test and push.

Ok to commit now. Thanks for the fix!

I've just started a regression test and will take care of any fallout.

Bye,

Andreas

> 
> Thanks,
> Richard.
> 
>       PR target/112280
>       * config/s390/s390.cc (expand_perm_as_a_vlbr_vstbr_candidate):
>       Do not generate code when d.testing_p.
> ---
>  gcc/config/s390/s390.cc | 36 ++++++++++++++++++++++++------------
>  1 file changed, 24 insertions(+), 12 deletions(-)
> 
> diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
> index 748ad9cd932..f182c26e78b 100644
> --- a/gcc/config/s390/s390.cc
> +++ b/gcc/config/s390/s390.cc
> @@ -17867,33 +17867,45 @@ expand_perm_as_a_vlbr_vstbr_candidate (const struct 
> expand_vec_perm_d &d)
>  
>    if (memcmp (d.perm, perm[0], MAX_VECT_LEN) == 0)
>      {
> -      rtx target = gen_rtx_SUBREG (V8HImode, d.target, 0);
> -      rtx op0 = gen_rtx_SUBREG (V8HImode, d.op0, 0);
> -      emit_insn (gen_bswapv8hi (target, op0));
> +      if (!d.testing_p)
> +     {
> +       rtx target = gen_rtx_SUBREG (V8HImode, d.target, 0);
> +       rtx op0 = gen_rtx_SUBREG (V8HImode, d.op0, 0);
> +       emit_insn (gen_bswapv8hi (target, op0));
> +     }
>        return true;
>      }
>  
>    if (memcmp (d.perm, perm[1], MAX_VECT_LEN) == 0)
>      {
> -      rtx target = gen_rtx_SUBREG (V4SImode, d.target, 0);
> -      rtx op0 = gen_rtx_SUBREG (V4SImode, d.op0, 0);
> -      emit_insn (gen_bswapv4si (target, op0));
> +      if (!d.testing_p)
> +     {
> +       rtx target = gen_rtx_SUBREG (V4SImode, d.target, 0);
> +       rtx op0 = gen_rtx_SUBREG (V4SImode, d.op0, 0);
> +       emit_insn (gen_bswapv4si (target, op0));
> +     }
>        return true;
>      }
>  
>    if (memcmp (d.perm, perm[2], MAX_VECT_LEN) == 0)
>      {
> -      rtx target = gen_rtx_SUBREG (V2DImode, d.target, 0);
> -      rtx op0 = gen_rtx_SUBREG (V2DImode, d.op0, 0);
> -      emit_insn (gen_bswapv2di (target, op0));
> +      if (!d.testing_p)
> +     {
> +       rtx target = gen_rtx_SUBREG (V2DImode, d.target, 0);
> +       rtx op0 = gen_rtx_SUBREG (V2DImode, d.op0, 0);
> +       emit_insn (gen_bswapv2di (target, op0));
> +     }
>        return true;
>      }
>  
>    if (memcmp (d.perm, perm[3], MAX_VECT_LEN) == 0)
>      {
> -      rtx target = gen_rtx_SUBREG (V1TImode, d.target, 0);
> -      rtx op0 = gen_rtx_SUBREG (V1TImode, d.op0, 0);
> -      emit_insn (gen_bswapv1ti (target, op0));
> +      if (!d.testing_p)
> +     {
> +       rtx target = gen_rtx_SUBREG (V1TImode, d.target, 0);
> +       rtx op0 = gen_rtx_SUBREG (V1TImode, d.op0, 0);
> +       emit_insn (gen_bswapv1ti (target, op0));
> +     }
>        return true;
>      }
>  

Reply via email to