public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101207] New: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements
@ 2021-06-25  9:44 pinskia at gcc dot gnu.org
  2021-06-25  9:45 ` [Bug tree-optimization/101207] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-25  9:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101207
           Summary: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails
                    after SLP improvements
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64-linux-gnu

So after the recent SLP improvements gcc.dg/vect/vect-strided-mult.c started to
fail on aarch64-linux-gnu .

There was one place where SLP happens where it did not happen before with:
....
|| ires[i].a != iarr[i].b - iarr[i].a
....
|| ires[i].b != iarr[i].b + iarr[i].a

Which produces in optimized:
  vect__22.39_7 = MEM <vector(2) unsigned int> [(unsigned int *)_101];
  _46 = BIT_FIELD_REF <vect__22.39_7, 32, 32>;
  _8 = BIT_FIELD_REF <vect__22.39_7, 32, 0>;
  _24 = _8 - _46;
...
  _47 = .REDUC_PLUS (vect__22.39_7);

In the assembly code:
-       ldr     d0, [x1]
-       umov    w8, v0.s[1]
-       fmov    w5, s0
-       sub     w5, w5, w8
....
-        addp    v0.2s, v0.2s, v0.2s

Where before we did:
+       ldp     w6, w3, [x1]
+       sub     w8, w3, w6
....
+       add     wN, w3, w6

The add should be ok but the subtraction I think is failing.

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

* [Bug tree-optimization/101207] [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements
  2021-06-25  9:44 [Bug tree-optimization/101207] New: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements pinskia at gcc dot gnu.org
@ 2021-06-25  9:45 ` pinskia at gcc dot gnu.org
  2021-06-25  9:53 ` [Bug tree-optimization/101207] [12 Regress] gcc.dg/vect/vect-strided-*-mult.c " pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-25  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

* [Bug tree-optimization/101207] [12 Regress] gcc.dg/vect/vect-strided-*-mult.c fails after SLP improvements
  2021-06-25  9:44 [Bug tree-optimization/101207] New: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements pinskia at gcc dot gnu.org
  2021-06-25  9:45 ` [Bug tree-optimization/101207] " pinskia at gcc dot gnu.org
@ 2021-06-25  9:53 ` pinskia at gcc dot gnu.org
  2021-06-25 10:07 ` [Bug tree-optimization/101207] [12 Regression] " pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-25  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12 Regress]                |[12 Regress]
                   |gcc.dg/vect/vect-strided-mu |gcc.dg/vect/vect-strided-*-
                   |lt.c fails after SLP        |mult.c fails after SLP
                   |improvements                |improvements

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note it looks like was more than just that testcase too:
FAIL: gcc.dg/vect/vect-strided-a-mult.c -flto -ffat-lto-objects execution test
FAIL: gcc.dg/vect/vect-strided-a-mult.c execution test
FAIL: gcc.dg/vect/vect-strided-a-u32-mult.c -flto -ffat-lto-objects execution
test
FAIL: gcc.dg/vect/vect-strided-a-u32-mult.c execution test
FAIL: gcc.dg/vect/vect-strided-mult.c -flto -ffat-lto-objects execution test
FAIL: gcc.dg/vect/vect-strided-mult.c execution test
FAIL: gcc.dg/vect/vect-strided-u32-mult.c -flto -ffat-lto-objects execution
test
FAIL: gcc.dg/vect/vect-strided-u32-mult.c execution test

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

* [Bug tree-optimization/101207] [12 Regression] gcc.dg/vect/vect-strided-*-mult.c fails after SLP improvements
  2021-06-25  9:44 [Bug tree-optimization/101207] New: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements pinskia at gcc dot gnu.org
  2021-06-25  9:45 ` [Bug tree-optimization/101207] " pinskia at gcc dot gnu.org
  2021-06-25  9:53 ` [Bug tree-optimization/101207] [12 Regress] gcc.dg/vect/vect-strided-*-mult.c " pinskia at gcc dot gnu.org
@ 2021-06-25 10:07 ` pinskia at gcc dot gnu.org
  2021-06-25 10:11 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-25 10:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Most likely introduced by r12-1551 .

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

* [Bug tree-optimization/101207] [12 Regression] gcc.dg/vect/vect-strided-*-mult.c fails after SLP improvements
  2021-06-25  9:44 [Bug tree-optimization/101207] New: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-06-25 10:07 ` [Bug tree-optimization/101207] [12 Regression] " pinskia at gcc dot gnu.org
@ 2021-06-25 10:11 ` pinskia at gcc dot gnu.org
  2021-06-28  6:54 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-25 10:11 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|aarch64-linux-gnu           |aarch64-linux-gnu,
                   |                            |arm-none-eabi

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like it is failing also on arm-none-eabi too:
https://gcc.gnu.org/pipermail/gcc-testresults/2021-June/702031.html

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

* [Bug tree-optimization/101207] [12 Regression] gcc.dg/vect/vect-strided-*-mult.c fails after SLP improvements
  2021-06-25  9:44 [Bug tree-optimization/101207] New: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements pinskia at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-06-25 10:11 ` pinskia at gcc dot gnu.org
@ 2021-06-28  6:54 ` rguenth at gcc dot gnu.org
  2021-06-28  7:26 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-28  6:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2021-06-28
     Ever confirmed|0                           |1

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm, subtraction should be rejected.  I'll have a look.

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

* [Bug tree-optimization/101207] [12 Regression] gcc.dg/vect/vect-strided-*-mult.c fails after SLP improvements
  2021-06-25  9:44 [Bug tree-optimization/101207] New: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements pinskia at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-06-28  6:54 ` rguenth at gcc dot gnu.org
@ 2021-06-28  7:26 ` rguenth at gcc dot gnu.org
  2021-06-28  7:45 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-28  7:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ah, so what happens is that we elide the load permutation that feeds the
plus reduction originally but then we vectorize the live operands of the
minus reduction as BIT_FIELD_REFs ending up extracting the wrong lanes.

Testcase for x86_64:

/* { dg-additional-options "-ftree-slp-vectorize -ffast-math" } */

double a[2];
double x, y;

void __attribute__((noipa)) foo ()
{
  x = a[1] - a[0];
  y = a[0] + a[1];
}

int main()
{
  a[0] = 0.;
  a[1] = 1.;
  foo ();
  if (x != 1. || y != 1.)
    __builtin_abort ();
  return 0;
}

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

* [Bug tree-optimization/101207] [12 Regression] gcc.dg/vect/vect-strided-*-mult.c fails after SLP improvements
  2021-06-25  9:44 [Bug tree-optimization/101207] New: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements pinskia at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-06-28  7:26 ` rguenth at gcc dot gnu.org
@ 2021-06-28  7:45 ` rguenth at gcc dot gnu.org
  2021-06-28  7:55 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-28  7:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 51067
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51067&action=edit
patch I am testing

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

* [Bug tree-optimization/101207] [12 Regression] gcc.dg/vect/vect-strided-*-mult.c fails after SLP improvements
  2021-06-25  9:44 [Bug tree-optimization/101207] New: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements pinskia at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-06-28  7:45 ` rguenth at gcc dot gnu.org
@ 2021-06-28  7:55 ` pinskia at gcc dot gnu.org
  2021-06-28  8:35 ` cvs-commit at gcc dot gnu.org
  2021-06-28  8:35 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-28  7:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #6)
> Created attachment 51067 [details]
> patch I am testing

All of the tests now pass on aarch64-linux-gnu with this above patch.

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

* [Bug tree-optimization/101207] [12 Regression] gcc.dg/vect/vect-strided-*-mult.c fails after SLP improvements
  2021-06-25  9:44 [Bug tree-optimization/101207] New: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements pinskia at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-06-28  7:55 ` pinskia at gcc dot gnu.org
@ 2021-06-28  8:35 ` cvs-commit at gcc dot gnu.org
  2021-06-28  8:35 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-28  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:2ad71efb5de9e929ffd2b8ce0a37c3c34021c0f1

commit r12-1837-g2ad71efb5de9e929ffd2b8ce0a37c3c34021c0f1
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Jun 28 09:42:58 2021 +0200

    tree-optimization/101207 - fix BB reduc permute elide with life stmts

    This fixes breakage of live lane extracts from permuted loads we elide
    from BB reduction vectorization by handling the un-permuting the same
    as in the regular eliding code - apply the reverse permute to
    both the scalar stmts and the load permutation.

    2021-06-28  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/101207
            * tree-vect-slp.c (vect_optimize_slp): Do BB reduction
            permute eliding for load permutations properly.

            * gcc.dg/vect/bb-slp-pr101207.c: New testcase.

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

* [Bug tree-optimization/101207] [12 Regression] gcc.dg/vect/vect-strided-*-mult.c fails after SLP improvements
  2021-06-25  9:44 [Bug tree-optimization/101207] New: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements pinskia at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2021-06-28  8:35 ` cvs-commit at gcc dot gnu.org
@ 2021-06-28  8:35 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-28  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Should be fixed.

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

end of thread, other threads:[~2021-06-28  8:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25  9:44 [Bug tree-optimization/101207] New: [12 Regress] gcc.dg/vect/vect-strided-mult.c fails after SLP improvements pinskia at gcc dot gnu.org
2021-06-25  9:45 ` [Bug tree-optimization/101207] " pinskia at gcc dot gnu.org
2021-06-25  9:53 ` [Bug tree-optimization/101207] [12 Regress] gcc.dg/vect/vect-strided-*-mult.c " pinskia at gcc dot gnu.org
2021-06-25 10:07 ` [Bug tree-optimization/101207] [12 Regression] " pinskia at gcc dot gnu.org
2021-06-25 10:11 ` pinskia at gcc dot gnu.org
2021-06-28  6:54 ` rguenth at gcc dot gnu.org
2021-06-28  7:26 ` rguenth at gcc dot gnu.org
2021-06-28  7:45 ` rguenth at gcc dot gnu.org
2021-06-28  7:55 ` pinskia at gcc dot gnu.org
2021-06-28  8:35 ` cvs-commit at gcc dot gnu.org
2021-06-28  8:35 ` 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).