On Mon, 28 Dec 2020, Tamar Christina wrote:

> Hi All,
> 
> This fixes an issue where is_linear_load_p could return the incorrect
> permutation kind because it is singe pass.
> 
> This arranges the candidates in such a way that there won't be any ambiguity 
> so
> that the function can still be linear but give correct values.
> 
> Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu
> and no issues.
> 
> Ok for master?

OK.  I see no testcases in any of the patch in this series though.

Thanks,
Richard.

> Thanks,
> Tamar
> 
> gcc/ChangeLog:
> 
>       * tree-vect-slp-patterns.c (is_linear_load_p): Fix ambiguity.
> 
> --- inline copy of patch -- 
> diff --git a/gcc/tree-vect-slp-patterns.c b/gcc/tree-vect-slp-patterns.c
> index 
> fede88923af8521ee4954c8ae27b0e589f975610..7fd79d91c6ba4ccdbf361307a6105fb7e46aa961
>  100644
> --- a/gcc/tree-vect-slp-patterns.c
> +++ b/gcc/tree-vect-slp-patterns.c
> @@ -140,32 +140,32 @@ is_linear_load_p (load_permutation_t loads)
>  
>    unsigned load, i;
>    complex_perm_kinds_t candidates[4]
> -    = { PERM_EVENODD
> -      , PERM_ODDEVEN
> -      , PERM_ODDODD
> +    = { PERM_ODDODD
>        , PERM_EVENEVEN
> +      , PERM_EVENODD
> +      , PERM_ODDEVEN
>        };
>  
>    int valid_patterns = 4;
> -  FOR_EACH_VEC_ELT_FROM (loads, i, load, 1)
> +  FOR_EACH_VEC_ELT (loads, i, load)
>      {
> -      if (candidates[0] != PERM_UNKNOWN && load != i)
> +      if (candidates[0] != PERM_UNKNOWN && load != 1)
>       {
>         candidates[0] = PERM_UNKNOWN;
>         valid_patterns--;
>       }
> -      if (candidates[1] != PERM_UNKNOWN
> -       && load != (i % 2 == 0 ? i + 1 : i - 1))
> +      if (candidates[1] != PERM_UNKNOWN && load != 0)
>       {
>         candidates[1] = PERM_UNKNOWN;
>         valid_patterns--;
>       }
> -      if (candidates[2] != PERM_UNKNOWN && load != 1)
> +      if (candidates[2] != PERM_UNKNOWN && load != i)
>       {
>         candidates[2] = PERM_UNKNOWN;
>         valid_patterns--;
>       }
> -      if (candidates[3] != PERM_UNKNOWN && load != 0)
> +      if (candidates[3] != PERM_UNKNOWN
> +       && load != (i % 2 == 0 ? i + 1 : i - 1))
>       {
>         candidates[3] = PERM_UNKNOWN;
>         valid_patterns--;
> 
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)

Reply via email to