public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/114284] New: [14 Regression] arm: Load of volatile short gets miscompiled (loaded twice)
@ 2024-03-08 13:12 acoplan at gcc dot gnu.org
  2024-03-08 13:25 ` [Bug target/114284] " rguenth at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: acoplan at gcc dot gnu.org @ 2024-03-08 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114284
           Summary: [14 Regression] arm: Load of volatile short gets
                    miscompiled (loaded twice)
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

The following is a wrong code regression in GCC 14:

volatile short x;
short foo() {
  return x;
}

with -march=armv8-m.base -O2 on the trunk we get:

foo:
        movw    r3, #:lower16:.LANCHOR0
        movt    r3, #:upper16:.LANCHOR0
        ldrh    r2, [r3]
        movs    r0, #0
        ldrsh   r0, [r3, r0]
        bx      lr

i.e. x is loaded twice, but with GCC 13 we get:

foo:
        movw    r3, #:lower16:.LANCHOR0
        movt    r3, #:upper16:.LANCHOR0
        ldrh    r0, [r3]
        sxth    r0, r0
        bx      lr

I suppose ideally we would have just one ldrsh, but the GCC 13 code is OK.

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

end of thread, other threads:[~2024-03-10  1:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-08 13:12 [Bug target/114284] New: [14 Regression] arm: Load of volatile short gets miscompiled (loaded twice) acoplan at gcc dot gnu.org
2024-03-08 13:25 ` [Bug target/114284] " rguenth at gcc dot gnu.org
2024-03-08 14:31 ` [Bug target/114284] [14 Regression] arm: Load of volatile short gets miscompiled (loaded twice) since r14-8319 jakub at gcc dot gnu.org
2024-03-08 15:02 ` acoplan at gcc dot gnu.org
2024-03-08 15:03 ` jakub at gcc dot gnu.org
2024-03-08 15:05 ` jakub at gcc dot gnu.org
2024-03-08 15:30 ` jakub at gcc dot gnu.org
2024-03-09 12:05 ` cvs-commit at gcc dot gnu.org
2024-03-09 15:03 ` law at gcc dot gnu.org
2024-03-09 15:03 ` law at gcc dot gnu.org
2024-03-10  1:12 ` roger at nextmovesoftware dot com

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