public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/80198] [8/9/10/11 Regression] does not vectorize generic inplace integer operation
       [not found] <bug-80198-4@http.gcc.gnu.org/bugzilla/>
@ 2021-01-27 11:49 ` rguenth at gcc dot gnu.org
  2021-01-27 12:02 ` rsandifo at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-27 11:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80198

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rsandifo at gcc dot gnu.org
   Last reconfirmed|2017-03-27 00:00:00         |2021-1-27

--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> ---
So I think when you consider

void __attribute__((noinline)) fun(int * a, int * b, int c)
{
  int i;
  for (i=0; i < 256; i++) {
     a[i] = b[i] | c;
  }
}

we can improve the versioning condition to allow a dependence distance
of zero.  Likewise with

void __attribute__((noipa)) generic(int * a, int * b, int c)
{
  int i;
  a = __builtin_assume_aligned (a, 16);
  b = __builtin_assume_aligned (b, 16);
  for (i=0; i < 256; i++) {
      a[i] = b[i] | c;
  }
}

we fail to realize no versioning check is required - the distance is
either zero or a multiple of 16.

Richard - ISTR you added some alignment considerations to the alias
versioning code, but it doesn't seem to help?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/80198] [8/9/10/11 Regression] does not vectorize generic inplace integer operation
       [not found] <bug-80198-4@http.gcc.gnu.org/bugzilla/>
  2021-01-27 11:49 ` [Bug tree-optimization/80198] [8/9/10/11 Regression] does not vectorize generic inplace integer operation rguenth at gcc dot gnu.org
@ 2021-01-27 12:02 ` rsandifo at gcc dot gnu.org
  2021-01-27 12:43 ` rguenther at suse dot de
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: rsandifo at gcc dot gnu.org @ 2021-01-27 12:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80198

--- Comment #20 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #19)
> So I think when you consider
> 
> void __attribute__((noinline)) fun(int * a, int * b, int c)
> {
>   int i;
>   for (i=0; i < 256; i++) {
>      a[i] = b[i] | c;
>   }
> }
> 
> we can improve the versioning condition to allow a dependence distance
> of zero.
This one was fixed by r10-4803.  E.g. for aarch64 we now have:

        add     x3, x1, 4
        sub     x3, x0, x3
        cmp     x3, 8
        bls     .L5

> Likewise with
> 
> void __attribute__((noipa)) generic(int * a, int * b, int c)
> {
>   int i;
>   a = __builtin_assume_aligned (a, 16);
>   b = __builtin_assume_aligned (b, 16);
>   for (i=0; i < 256; i++) {
>       a[i] = b[i] | c;
>   }
> }
> 
> we fail to realize no versioning check is required - the distance is
> either zero or a multiple of 16.
> 
> Richard - ISTR you added some alignment considerations to the alias
> versioning code, but it doesn't seem to help?
I don't remember adding anything for that, but yeah, I agree it looks
like we need it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/80198] [8/9/10/11 Regression] does not vectorize generic inplace integer operation
       [not found] <bug-80198-4@http.gcc.gnu.org/bugzilla/>
  2021-01-27 11:49 ` [Bug tree-optimization/80198] [8/9/10/11 Regression] does not vectorize generic inplace integer operation rguenth at gcc dot gnu.org
  2021-01-27 12:02 ` rsandifo at gcc dot gnu.org
@ 2021-01-27 12:43 ` rguenther at suse dot de
  2021-04-27 11:37 ` [Bug tree-optimization/80198] [8/9/10/11/12 " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: rguenther at suse dot de @ 2021-01-27 12:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80198

--- Comment #21 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 27 Jan 2021, rsandifo at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80198
> 
> --- Comment #20 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #19)
> > So I think when you consider
> > 
> > void __attribute__((noinline)) fun(int * a, int * b, int c)
> > {
> >   int i;
> >   for (i=0; i < 256; i++) {
> >      a[i] = b[i] | c;
> >   }
> > }
> > 
> > we can improve the versioning condition to allow a dependence distance
> > of zero.
> This one was fixed by r10-4803.  E.g. for aarch64 we now have:
> 
>         add     x3, x1, 4
>         sub     x3, x0, x3
>         cmp     x3, 8
>         bls     .L5

Ah, yeah - I failed to decipher the generated check:

  _7 = b_12 + 4;
  _22 = a_10 - _7;
  _23 = (sizetype) _22;
  if (_23 > 8)

the difference is -4U and thus > 8 when a == b.

> > Likewise with
> > 
> > void __attribute__((noipa)) generic(int * a, int * b, int c)
> > {
> >   int i;
> >   a = __builtin_assume_aligned (a, 16);
> >   b = __builtin_assume_aligned (b, 16);
> >   for (i=0; i < 256; i++) {
> >       a[i] = b[i] | c;
> >   }
> > }
> > 
> > we fail to realize no versioning check is required - the distance is
> > either zero or a multiple of 16.
> > 
> > Richard - ISTR you added some alignment considerations to the alias
> > versioning code, but it doesn't seem to help?
> I don't remember adding anything for that, but yeah, I agree it looks
> like we need it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/80198] [8/9/10/11/12 Regression] does not vectorize generic inplace integer operation
       [not found] <bug-80198-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-01-27 12:43 ` rguenther at suse dot de
@ 2021-04-27 11:37 ` jakub at gcc dot gnu.org
  2021-07-28  7:04 ` [Bug tree-optimization/80198] [9/10/11/12 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 11:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80198

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.0                        |11.2

--- Comment #22 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.1 has been released, retargeting bugs to GCC 11.2.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/80198] [9/10/11/12 Regression] does not vectorize generic inplace integer operation
       [not found] <bug-80198-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-04-27 11:37 ` [Bug tree-optimization/80198] [8/9/10/11/12 " jakub at gcc dot gnu.org
@ 2021-07-28  7:04 ` rguenth at gcc dot gnu.org
  2022-04-21  7:47 ` rguenth at gcc dot gnu.org
  2023-03-24  7:35 ` [Bug tree-optimization/80198] [10/11/12/13 " rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28  7:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80198

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.2                        |11.3

--- Comment #23 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.2 is being released, retargeting bugs to GCC 11.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/80198] [9/10/11/12 Regression] does not vectorize generic inplace integer operation
       [not found] <bug-80198-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-07-28  7:04 ` [Bug tree-optimization/80198] [9/10/11/12 " rguenth at gcc dot gnu.org
@ 2022-04-21  7:47 ` rguenth at gcc dot gnu.org
  2023-03-24  7:35 ` [Bug tree-optimization/80198] [10/11/12/13 " rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-21  7:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80198

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.3                        |11.4

--- Comment #24 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.3 is being released, retargeting bugs to GCC 11.4.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug tree-optimization/80198] [10/11/12/13 Regression] does not vectorize generic inplace integer operation
       [not found] <bug-80198-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2022-04-21  7:47 ` rguenth at gcc dot gnu.org
@ 2023-03-24  7:35 ` rguenth at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-24  7:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80198

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.4                        |10.0
      Known to work|                            |10.1.0
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #25 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think the regression is fixed - we perform alias versioning unnecessarily
but we are now entering the vectorized loop for a == b (in fact RTL opts
eventually elide the versioning check, so the resulting code is optimal).

This was fixed in GCC 10.

I've split out remaining missed optimization to PR109271.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-03-24  7:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-80198-4@http.gcc.gnu.org/bugzilla/>
2021-01-27 11:49 ` [Bug tree-optimization/80198] [8/9/10/11 Regression] does not vectorize generic inplace integer operation rguenth at gcc dot gnu.org
2021-01-27 12:02 ` rsandifo at gcc dot gnu.org
2021-01-27 12:43 ` rguenther at suse dot de
2021-04-27 11:37 ` [Bug tree-optimization/80198] [8/9/10/11/12 " jakub at gcc dot gnu.org
2021-07-28  7:04 ` [Bug tree-optimization/80198] [9/10/11/12 " rguenth at gcc dot gnu.org
2022-04-21  7:47 ` rguenth at gcc dot gnu.org
2023-03-24  7:35 ` [Bug tree-optimization/80198] [10/11/12/13 " rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).