public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension
@ 2021-04-14  0:09 luc.vanoostenryck at gmail dot com
  2021-04-14  6:55 ` [Bug target/100075] " rguenth at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: luc.vanoostenryck at gmail dot com @ 2021-04-14  0:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100075
           Summary: [9/10/11 Regression] unneeded sign extension
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luc.vanoostenryck at gmail dot com
  Target Milestone: ---
            Target: aarch64

Created attachment 50588
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50588&action=edit
test case

Until gcc8, the following code:
    struct s {
        short x, y;
    };
    struct s rot(struct s p)
    {
        return (struct s) { -p.y, p.x };
    }

was translated:
    rot90:
        neg     w1, w0, asr 16
        and     w1, w1, 65535
        orr     w0, w1, w0, lsl 16
        ret

but since gcc9 it translates less nicely, with an unneeded sign extension:
    rot90:
        mov     w1, w0
        sbfx    x0, x1, 16, 16
        neg     w0, w0
        bfi     w0, w1, 16, 16
        ret


See with another variant in attachment or https://gcc.godbolt.org/z/1oW1cEMGc

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

* [Bug target/100075] [9/10/11 Regression] unneeded sign extension
  2021-04-14  0:09 [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension luc.vanoostenryck at gmail dot com
@ 2021-04-14  6:55 ` rguenth at gcc dot gnu.org
  2021-04-14 14:54 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-14  6:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.4

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

* [Bug target/100075] [9/10/11 Regression] unneeded sign extension
  2021-04-14  0:09 [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension luc.vanoostenryck at gmail dot com
  2021-04-14  6:55 ` [Bug target/100075] " rguenth at gcc dot gnu.org
@ 2021-04-14 14:54 ` jakub at gcc dot gnu.org
  2021-04-16 11:45 ` cvs-commit at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-14 14:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-04-14
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
rot90 regressed with r9-3594-g8d2d39587d941a40f25ea0144cceb677df115040
rot270 with r9-6926-g6a0d3939018de736da03cb54a86fa2395b5bc464

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

* [Bug target/100075] [9/10/11 Regression] unneeded sign extension
  2021-04-14  0:09 [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension luc.vanoostenryck at gmail dot com
  2021-04-14  6:55 ` [Bug target/100075] " rguenth at gcc dot gnu.org
  2021-04-14 14:54 ` jakub at gcc dot gnu.org
@ 2021-04-16 11:45 ` cvs-commit at gcc dot gnu.org
  2021-04-16 11:45 ` [Bug target/100075] [9/10 " jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-16 11:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:47f42744f6e10ad41db926d739306e6f237fd3ac

commit r11-8215-g47f42744f6e10ad41db926d739306e6f237fd3ac
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Apr 16 13:44:23 2021 +0200

    aarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075]

    The testcase used to be compiled at -O2 by GCC8 and earlier to:
    f1:
            neg     w1, w0, asr 16
            and     w1, w1, 65535
            orr     w0, w1, w0, lsl 16
            ret
    f2:
            neg     w1, w0
            extr    w0, w1, w0, 16
            ret
    but since GCC9 (r9-3594 for f1 and r9-6926 for f2) we compile it into:
    f1:
            mov     w1, w0
            sbfx    x0, x1, 16, 16
            neg     w0, w0
            bfi     w0, w1, 16, 16
            ret
    f2:
            neg     w1, w0
            sbfx    x0, x0, 16, 16
            bfi     w0, w1, 16, 16
            ret
    instead, i.e. one insn longer each.  With this patch we get:
    f1:
            mov     w1, w0
            neg     w0, w1, asr 16
            bfi     w0, w1, 16, 16
            ret
    f2:
            neg     w1, w0
            extr    w0, w1, w0, 16
            ret
    i.e. identical f2 and same number of insns as in GCC8 in f1.
    The combiner unfortunately doesn't try splitters when doing 2 -> 1
    combination, so it can't be implemented as combine splitters, but
    it could be implemented as define_insn_and_split if desirable.

    2021-04-16  Jakub Jelinek  <jakub@redhat.com>

            PR target/100075
            * config/aarch64/aarch64.md (*neg_asr_si2_extr, *extrsi5_insn_di):
New
            define_insn patterns.

            * gcc.target/aarch64/pr100075.c: New test.

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

* [Bug target/100075] [9/10 Regression] unneeded sign extension
  2021-04-14  0:09 [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension luc.vanoostenryck at gmail dot com
                   ` (2 preceding siblings ...)
  2021-04-16 11:45 ` cvs-commit at gcc dot gnu.org
@ 2021-04-16 11:45 ` jakub at gcc dot gnu.org
  2021-04-16 15:16 ` luc.vanoostenryck at gmail dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-16 11:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
            Summary|[9/10/11 Regression]        |[9/10 Regression] unneeded
                   |unneeded sign extension     |sign extension

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk.  Probably shouldn't be backported.

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

* [Bug target/100075] [9/10 Regression] unneeded sign extension
  2021-04-14  0:09 [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension luc.vanoostenryck at gmail dot com
                   ` (3 preceding siblings ...)
  2021-04-16 11:45 ` [Bug target/100075] [9/10 " jakub at gcc dot gnu.org
@ 2021-04-16 15:16 ` luc.vanoostenryck at gmail dot com
  2021-04-19 13:27 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: luc.vanoostenryck at gmail dot com @ 2021-04-16 15:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Luc Van Oostenryck <luc.vanoostenryck at gmail dot com> ---
(In reply to Jakub Jelinek from comment #3)
> Fixed on the trunk.  Probably shouldn't be backported.

Work great here. Thanks.

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

* [Bug target/100075] [9/10 Regression] unneeded sign extension
  2021-04-14  0:09 [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension luc.vanoostenryck at gmail dot com
                   ` (4 preceding siblings ...)
  2021-04-16 15:16 ` luc.vanoostenryck at gmail dot com
@ 2021-04-19 13:27 ` cvs-commit at gcc dot gnu.org
  2021-04-30  8:10 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-19 13:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Christophe Lyon <clyon@gcc.gnu.org>:

https://gcc.gnu.org/g:714bdc31b69688ae2eaeb9807a48e0f101fecf4e

commit r11-8244-g714bdc31b69688ae2eaeb9807a48e0f101fecf4e
Author: Christophe Lyon <christophe.lyon@linaro.org>
Date:   Mon Apr 19 13:24:31 2021 +0000

    aarch64: Fix up 2 other combine opt regressions vs. GCC8 [PR100075]

    The testcase is endianness dependent and works only on little-endian.

    2021-04-19  Christophe Lyon  <christophe.lyon@linaro.org>

            PR target/100075
            gcc/testsuite/
            * gcc.target/aarch64/pr100075.c: Add aarch64_little_endian
            effective target.

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

* [Bug target/100075] [9/10 Regression] unneeded sign extension
  2021-04-14  0:09 [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension luc.vanoostenryck at gmail dot com
                   ` (5 preceding siblings ...)
  2021-04-19 13:27 ` cvs-commit at gcc dot gnu.org
@ 2021-04-30  8:10 ` rguenth at gcc dot gnu.org
  2021-06-01  8:20 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-30  8:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug target/100075] [9/10 Regression] unneeded sign extension
  2021-04-14  0:09 [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension luc.vanoostenryck at gmail dot com
                   ` (6 preceding siblings ...)
  2021-04-30  8:10 ` rguenth at gcc dot gnu.org
@ 2021-06-01  8:20 ` rguenth at gcc dot gnu.org
  2022-05-27  9:45 ` [Bug target/100075] [10 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug target/100075] [10 Regression] unneeded sign extension
  2021-04-14  0:09 [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension luc.vanoostenryck at gmail dot com
                   ` (7 preceding siblings ...)
  2021-06-01  8:20 ` rguenth at gcc dot gnu.org
@ 2022-05-27  9:45 ` rguenth at gcc dot gnu.org
  2022-06-28 10:44 ` jakub at gcc dot gnu.org
  2023-07-07  9:35 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug target/100075] [10 Regression] unneeded sign extension
  2021-04-14  0:09 [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension luc.vanoostenryck at gmail dot com
                   ` (8 preceding siblings ...)
  2022-05-27  9:45 ` [Bug target/100075] [10 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:44 ` jakub at gcc dot gnu.org
  2023-07-07  9:35 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug target/100075] [10 Regression] unneeded sign extension
  2021-04-14  0:09 [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension luc.vanoostenryck at gmail dot com
                   ` (9 preceding siblings ...)
  2022-06-28 10:44 ` jakub at gcc dot gnu.org
@ 2023-07-07  9:35 ` rguenth at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07  9:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
      Known to fail|                            |10.5.0
   Target Milestone|10.5                        |11.0

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC 11.

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

end of thread, other threads:[~2023-07-07  9:35 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14  0:09 [Bug target/100075] New: [9/10/11 Regression] unneeded sign extension luc.vanoostenryck at gmail dot com
2021-04-14  6:55 ` [Bug target/100075] " rguenth at gcc dot gnu.org
2021-04-14 14:54 ` jakub at gcc dot gnu.org
2021-04-16 11:45 ` cvs-commit at gcc dot gnu.org
2021-04-16 11:45 ` [Bug target/100075] [9/10 " jakub at gcc dot gnu.org
2021-04-16 15:16 ` luc.vanoostenryck at gmail dot com
2021-04-19 13:27 ` cvs-commit at gcc dot gnu.org
2021-04-30  8:10 ` rguenth at gcc dot gnu.org
2021-06-01  8:20 ` rguenth at gcc dot gnu.org
2022-05-27  9:45 ` [Bug target/100075] [10 " rguenth at gcc dot gnu.org
2022-06-28 10:44 ` jakub at gcc dot gnu.org
2023-07-07  9: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).