public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/115650] New: [15 Regression] ARC backend bug exposed by late-combine pass
@ 2024-06-25 18:02 law at gcc dot gnu.org
  2024-06-25 18:03 ` [Bug target/115650] " law at gcc dot gnu.org
  2024-06-25 21:56 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: law at gcc dot gnu.org @ 2024-06-25 18:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115650
           Summary: [15 Regression] ARC backend bug exposed by
                    late-combine pass
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: law at gcc dot gnu.org
  Target Milestone: ---

This code generates code that can't be groked by as/ld with -O2:

/* { dg-do run } */

int a, b[2];

int
main ()
{
lbl:
  for (; a; a--)
    if (b[10000])
      goto lbl;

  return 0;
}

The problem is this instruction:

        ld.as   r2,[gp,@b@sda+40000]    ;23     # 12    [c=8 l=8] 
*movsi_insn/23

That will trigger errors like this from the linker:

pr60115.c:(.text.startup+0x6): relocation truncated to fit: R_ARC_SDA16_LD2
against symbol `b' defined in .sbss section in /tmp/ccgCSiHr.o

With the right magic options this can also be triggered without the late
combine pass.  The trick is to disable PRE and LICM so that these instructions
end up in the same block and are then subject to combine:

(insn 11 8 12 3 (set (reg/f:SI 157)
        (const:SI (plus:SI (symbol_ref:SI ("b") [flags 0x6]  <var_decl
0x7f0b5ab20240 b>)
                (const_int 40960 [0xa000])))) "j.c":10:10 3 {*movsi_insn}
     (nil))
(insn 12 11 13 3 (set (reg:SI 158 [ b[10000] ])
        (mem:SI (plus:SI (reg/f:SI 157)
                (const_int -960 [0xfffffffffffffc40])) [1 b[10000]+0 S4 A32]))
"j.c":10:8 3 {*movsi_insn}
     (expr_list:REG_DEAD (reg/f:SI 157)
        (nil)))

That will result in:
(insn 12 11 13 3 (set (reg:SI 158 [ b[10000] ])
        (mem:SI (const:SI (plus:SI (symbol_ref:SI ("b") [flags 0x6]  <var_decl
0x7f0b5ab20240 b>)
                    (const_int 40000 [0x9c40]))) [1 b[10000]+0 S4 A32]))
"j.c":10:8 3 {*movsi_insn}
     (nil))

Which triggers the subsequent linker error.

This is almost certainly a bug in the ARC backend.  I'm not currently chasing
it down.

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

* [Bug target/115650] [15 Regression] ARC backend bug exposed by late-combine pass
  2024-06-25 18:02 [Bug target/115650] New: [15 Regression] ARC backend bug exposed by late-combine pass law at gcc dot gnu.org
@ 2024-06-25 18:03 ` law at gcc dot gnu.org
  2024-06-25 21:56 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: law at gcc dot gnu.org @ 2024-06-25 18:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4

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

* [Bug target/115650] [15 Regression] ARC backend bug exposed by late-combine pass
  2024-06-25 18:02 [Bug target/115650] New: [15 Regression] ARC backend bug exposed by late-combine pass law at gcc dot gnu.org
  2024-06-25 18:03 ` [Bug target/115650] " law at gcc dot gnu.org
@ 2024-06-25 21:56 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-25 21:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |link-failure
             Target|                            |arc
                 CC|                            |pinskia at gcc dot gnu.org
   Target Milestone|---                         |15.0

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

end of thread, other threads:[~2024-06-25 21:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-25 18:02 [Bug target/115650] New: [15 Regression] ARC backend bug exposed by late-combine pass law at gcc dot gnu.org
2024-06-25 18:03 ` [Bug target/115650] " law at gcc dot gnu.org
2024-06-25 21:56 ` pinskia 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).