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

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).