"Kewen.Lin" <li...@linux.ibm.com> writes:
> Hi,
>
> As PR94019 shows, without misaligned vector access support but with
> realign load, the vectorized loop will end up with realign scheme.
> It generates mask (control vector) with return type vector signed
> char which breaks the not check.
>
> The fix is to differentiate powerpc vect_hw_misalign and powerpc
> !vect_hw_misalign, permit one vector char occurance for powerpc
> !vect_hw_misalign and keep other targets same as before.
>
> Verified it on ppc64-redhat-linux (Power7 BE).
>
> Is it ok for trunk, and backport to GCC 9 after some burn-in time?
>
>
> BR,
> Kewen
> --------
>
> gcc/testsuite/ChangeLog
>
> 2020-03-04  Kewen Lin  <li...@gcc.gnu.org>
>
>       PR testsuite/94019
>       * gcc.dg/vect/vect-over-widen-17.c: Expect one vector char if it's on
>       POWER and without misaligned vector access support.
>
> --------
>
> --- a/gcc/testsuite/gcc.dg/vect/vect-over-widen-17.c
> +++ b/gcc/testsuite/gcc.dg/vect/vect-over-widen-17.c
> @@ -41,6 +41,10 @@ main (void)
>  }
>
>  /* { dg-final { scan-tree-dump-not {vect_recog_over_widening_pattern: 
> detected} "vect" } } */
> -/* { dg-final { scan-tree-dump-not {vector[^\n]*char} "vect" } } */
> +/* { dg-final { scan-tree-dump-not {vector[^\n]*char} "vect" { target { { ! 
> powerpc*-*-* } || { powerpc*-*-* && vect_hw_misalign } } } } }
> +/* On Power, if there is no vect_hw_misalign support, unaligned vector access
> +   adopts realign_load scheme.  It requires rs6000_builtin_mask_for_load to
> +   generate mask whose return type is vector char.  */
> +/* { dg-final { scan-tree-dump-times {vector[^\n]*char} 1 "vect" { target { 
> powerpc*-*-* && { ! vect_hw_misalign } } } } } */

Thanks for looking at this.  The patch is OK as-is.  However, since
vect-over-widen-17.c is a negative test for generic code, there probably
isn't much need for the new scan-tree-dump-times line, and it could start
failing if we make different optimisation decisions in future.  So the
patch is also OK with just the change to the scan-tree-dump-not line,
if you prefer that.  (Please keep the comment either way though --
it's really helpful.)

Richard

>  /* { dg-final { scan-tree-dump-not {vector[^ ]* int} "vect" } } */
>  /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" } } */

Reply via email to