public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian
@ 2015-04-16 19:49 wschmidt at gcc dot gnu.org
  2015-04-16 19:50 ` [Bug target/65787] " wschmidt at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2015-04-16 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65787
           Summary: [5.1 regression] Miscompile due to bad vector swap
                    optimization for little endian
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: wschmidt at gcc dot gnu.org
          Reporter: wschmidt at gcc dot gnu.org
                CC: bergner at gcc dot gnu.org, dje.gcc at gmail dot com,
                    jakub at gcc dot gnu.org, rguenth at gcc dot gnu.org
              Host: powerpc64le-linux-gnu
            Target: powerpc64le-linux-gnu
             Build: powerpc64le-linux-gnu

Created attachment 35337
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35337&action=edit
Preprocessed source

GCC 5.1 miscompiles the attached file.  The POWER-specific vector swap
optimization doesn't recognize a vector extract pattern because it's hidden
inside a parallel with a clobber.  As a result it doesn't adjust the lane to be
extracted.  I'm working on a patch to detect this case and fix it up.

This is probably miscompiled by the latest 4.8 and 4.9 base code as well, since
the swap optimization was backported recently.  I have not yet verified this,
though.  It could be that this pattern is not created for those releases.


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

* [Bug target/65787] [5.1 regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
@ 2015-04-16 19:50 ` wschmidt at gcc dot gnu.org
  2015-04-16 20:06 ` wschmidt at gcc dot gnu.org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2015-04-16 19:50 UTC (permalink / raw)
  To: gcc-bugs

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

Bill Schmidt <wschmidt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-04-16
     Ever confirmed|0                           |1


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

* [Bug target/65787] [5.1 regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
  2015-04-16 19:50 ` [Bug target/65787] " wschmidt at gcc dot gnu.org
@ 2015-04-16 20:06 ` wschmidt at gcc dot gnu.org
  2015-04-16 20:08 ` [Bug target/65787] [5 Regression] " jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2015-04-16 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Created attachment 35338
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35338&action=edit
Proposed patch

Attached patch appears to solve the problem, but I still need to do regression
testing.


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

* [Bug target/65787] [5 Regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
  2015-04-16 19:50 ` [Bug target/65787] " wschmidt at gcc dot gnu.org
  2015-04-16 20:06 ` wschmidt at gcc dot gnu.org
@ 2015-04-16 20:08 ` jakub at gcc dot gnu.org
  2015-04-16 21:51 ` jakub at gcc dot gnu.org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-16 20:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |5.0
            Summary|[5.1 regression] Miscompile |[5 Regression] Miscompile
                   |due to bad vector swap      |due to bad vector swap
                   |optimization for little     |optimization for little
                   |endian                      |endian


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

* [Bug target/65787] [5 Regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-04-16 20:08 ` [Bug target/65787] [5 Regression] " jakub at gcc dot gnu.org
@ 2015-04-16 21:51 ` jakub at gcc dot gnu.org
  2015-04-16 21:58 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-16 21:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The formatting looks weird, look how the case UNSPEC: is formatted -
{ goes below case PARALLEL:, two columns to the right, then another two columns
to the right the body of the scope, then } below the {.


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

* [Bug target/65787] [5 Regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-04-16 21:51 ` jakub at gcc dot gnu.org
@ 2015-04-16 21:58 ` jakub at gcc dot gnu.org
  2015-04-17  4:46 ` wschmidt at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-16 21:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Though, len is used just in one place, so perhaps even better just remove the
{}s and use 
      if (XVECLEN (op, 0) != 2)
        return 0;
and drop len variable alltogether, it will be more readable that way.


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

* [Bug target/65787] [5 Regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2015-04-16 21:58 ` jakub at gcc dot gnu.org
@ 2015-04-17  4:46 ` wschmidt at gcc dot gnu.org
  2015-04-17 13:28 ` wschmidt at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2015-04-17  4:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Sorry, yeah, too much work on projects with different style guidelines.  I
agree with removing the braces as in comment 3.  Thanks!


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

* [Bug target/65787] [5 Regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-04-17  4:46 ` wschmidt at gcc dot gnu.org
@ 2015-04-17 13:28 ` wschmidt at gcc dot gnu.org
  2015-04-17 14:51 ` wschmidt at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2015-04-17 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Updated patch at https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00883.html.


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

* [Bug target/65787] [5 Regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2015-04-17 13:28 ` wschmidt at gcc dot gnu.org
@ 2015-04-17 14:51 ` wschmidt at gcc dot gnu.org
  2015-04-17 15:09 ` wschmidt at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2015-04-17 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Author: wschmidt
Date: Fri Apr 17 14:50:50 2015
New Revision: 222182

URL: https://gcc.gnu.org/viewcvs?rev=222182&root=gcc&view=rev
Log:
[gcc]

2015-04-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    PR target/65787
    * config/rs6000/rs6000.c (rtx_is_swappable_p): Handle case where
    vec_extract operation is wrapped in a PARALLEL with a CLOBBER.
    (adjust_extract): Likewise.

[gcc/testsuite]

2015-04-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    PR target/65787
    * gcc.target/powerpc/pr65787.c: New.


Added:
    branches/gcc-5-branch/gcc/testsuite/gcc.target/powerpc/pr65787.c
Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/config/rs6000/rs6000.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog


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

* [Bug target/65787] [5 Regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2015-04-17 14:51 ` wschmidt at gcc dot gnu.org
@ 2015-04-17 15:09 ` wschmidt at gcc dot gnu.org
  2015-04-17 20:36 ` wschmidt at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2015-04-17 15:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Jakub pointed out that this is actually a general problem with how I'm handling
PARALLELs elsewhere, which I had missed.  Testing a slightly different patch
now.


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

* [Bug target/65787] [5 Regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2015-04-17 15:09 ` wschmidt at gcc dot gnu.org
@ 2015-04-17 20:36 ` wschmidt at gcc dot gnu.org
  2015-04-17 22:05 ` wschmidt at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2015-04-17 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Author: wschmidt
Date: Fri Apr 17 20:35:59 2015
New Revision: 222198

URL: https://gcc.gnu.org/viewcvs?rev=222198&root=gcc&view=rev
Log:
2015-04-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    PR target/65787
    * config/rs6000/rs6000.c (rtx_is_swappable_p): Remove previous
    fix; ensure that a subsequent SH_NONE operand does not overwrite
    an existing *special value.


Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/config/rs6000/rs6000.c


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

* [Bug target/65787] [5 Regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2015-04-17 20:36 ` wschmidt at gcc dot gnu.org
@ 2015-04-17 22:05 ` wschmidt at gcc dot gnu.org
  2015-04-19 16:51 ` wschmidt at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2015-04-17 22:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Author: wschmidt
Date: Fri Apr 17 22:05:12 2015
New Revision: 222205

URL: https://gcc.gnu.org/viewcvs?rev=222205&root=gcc&view=rev
Log:
[gcc]

2015-04-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    PR target/65787
    * config/rs6000/rs6000.c (rtx_is_swappable_p): Ensure that a
    subsequent SH_NONE operand does not overwrite an existing *special
    value.
    (adjust_extract): Handle case where a vec_extract operation is
    wrapped in a PARALLEL.

[gcc/testsuite]

2015-04-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    PR target/65787
    * gcc.target/powerpc/pr65787.c: New.


Added:
    trunk/gcc/testsuite/gcc.target/powerpc/pr65787.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/65787] [5 Regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2015-04-17 22:05 ` wschmidt at gcc dot gnu.org
@ 2015-04-19 16:51 ` wschmidt at gcc dot gnu.org
  2015-04-19 16:53 ` wschmidt at gcc dot gnu.org
  2015-04-19 16:55 ` wschmidt at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2015-04-19 16:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Author: wschmidt
Date: Sun Apr 19 16:51:12 2015
New Revision: 222221

URL: https://gcc.gnu.org/viewcvs?rev=222221&root=gcc&view=rev
Log:
[gcc]

2015-04-18  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
        Jakub Jelinek  <jakub@redhat.com>

    Backport from mainline r222205
    2015-04-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
                Jakub Jelinek  <jakub@redhat.com>

    PR target/65787
    * config/rs6000/rs6000.c (rtx_is_swappable_p): Ensure that a
    subsequent SH_NONE operand does not overwrite an existing *special
    value.
    (adjust_extract): Handle case where a vec_extract operation is
    wrapped in a PARALLEL.

[gcc/testsuite]

2015-04-18  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    Backport from mainline r222205
    2015-04-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    PR target/65787
    * gcc.target/powerpc/pr65787.c: New.


Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.target/powerpc/pr65787.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/config/rs6000/rs6000.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


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

* [Bug target/65787] [5 Regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2015-04-19 16:51 ` wschmidt at gcc dot gnu.org
@ 2015-04-19 16:53 ` wschmidt at gcc dot gnu.org
  2015-04-19 16:55 ` wschmidt at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2015-04-19 16:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Author: wschmidt
Date: Sun Apr 19 16:53:22 2015
New Revision: 222222

URL: https://gcc.gnu.org/viewcvs?rev=222222&root=gcc&view=rev
Log:
[gcc]

2015-04-18  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
        Jakub Jelinek  <jakub@redhat.com>

    Backport from mainline r222205
    2015-04-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
                Jakub Jelinek  <jakub@redhat.com>

    PR target/65787
    * config/rs6000/rs6000.c (rtx_is_swappable_p): Ensure that a
    subsequent SH_NONE operand does not overwrite an existing *special
    value.
    (adjust_extract): Handle case where a vec_extract operation is
    wrapped in a PARALLEL.

[gcc/testsuite]

2015-04-18  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    Backport from mainline r222205
    2015-04-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

    PR target/65787
    * gcc.target/powerpc/pr65787.c: New.


Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.target/powerpc/pr65787.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/config/rs6000/rs6000.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


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

* [Bug target/65787] [5 Regression] Miscompile due to bad vector swap optimization for little endian
  2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2015-04-19 16:53 ` wschmidt at gcc dot gnu.org
@ 2015-04-19 16:55 ` wschmidt at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: wschmidt at gcc dot gnu.org @ 2015-04-19 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

Bill Schmidt <wschmidt at gcc dot gnu.org> changed:

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

--- Comment #12 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Work is complete.


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

end of thread, other threads:[~2015-04-19 16:55 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-16 19:49 [Bug target/65787] New: [5.1 regression] Miscompile due to bad vector swap optimization for little endian wschmidt at gcc dot gnu.org
2015-04-16 19:50 ` [Bug target/65787] " wschmidt at gcc dot gnu.org
2015-04-16 20:06 ` wschmidt at gcc dot gnu.org
2015-04-16 20:08 ` [Bug target/65787] [5 Regression] " jakub at gcc dot gnu.org
2015-04-16 21:51 ` jakub at gcc dot gnu.org
2015-04-16 21:58 ` jakub at gcc dot gnu.org
2015-04-17  4:46 ` wschmidt at gcc dot gnu.org
2015-04-17 13:28 ` wschmidt at gcc dot gnu.org
2015-04-17 14:51 ` wschmidt at gcc dot gnu.org
2015-04-17 15:09 ` wschmidt at gcc dot gnu.org
2015-04-17 20:36 ` wschmidt at gcc dot gnu.org
2015-04-17 22:05 ` wschmidt at gcc dot gnu.org
2015-04-19 16:51 ` wschmidt at gcc dot gnu.org
2015-04-19 16:53 ` wschmidt at gcc dot gnu.org
2015-04-19 16:55 ` wschmidt 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).