public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/110088] New: [avr] Improve operation with const on l-reg after move from d-reg
@ 2023-06-02 10:26 gjl at gcc dot gnu.org
  2023-06-02 10:27 ` [Bug target/110088] " gjl at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gjl at gcc dot gnu.org @ 2023-06-02 10:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110088
           Summary: [avr] Improve operation with const on l-reg after move
                    from d-reg
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

The register allocator might generate code that moves a value from a d-reg to
an l-reg, and then performs operation like PLUS, IOR, AND with a constant.  So
we have a sequence like:

lreg = dreg
lreg = lreg <op> const

This is expensive because lreg cannot handle const and needs a QI scratch to
load bytes of const.  Instead, if dreg dies after the first insn, better code
is:

dreg = dreg <op> const
lreg = dreg

An RTL peephole can catch this.

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

* [Bug target/110088] [avr] Improve operation with const on l-reg after move from d-reg
  2023-06-02 10:26 [Bug target/110088] New: [avr] Improve operation with const on l-reg after move from d-reg gjl at gcc dot gnu.org
@ 2023-06-02 10:27 ` gjl at gcc dot gnu.org
  2023-06-02 10:42 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: gjl at gcc dot gnu.org @ 2023-06-02 10:27 UTC (permalink / raw)
  To: gcc-bugs

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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |avr
           Keywords|                            |missed-optimization
           Priority|P3                          |P5

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

* [Bug target/110088] [avr] Improve operation with const on l-reg after move from d-reg
  2023-06-02 10:26 [Bug target/110088] New: [avr] Improve operation with const on l-reg after move from d-reg gjl at gcc dot gnu.org
  2023-06-02 10:27 ` [Bug target/110088] " gjl at gcc dot gnu.org
@ 2023-06-02 10:42 ` cvs-commit at gcc dot gnu.org
  2023-06-02 10:55 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-02 10:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Georg-Johann Lay <gjl@gcc.gnu.org>:

https://gcc.gnu.org/g:7bf89a919fdab9e18b7ad3efaa1a79f1d7520ddf

commit r14-1492-g7bf89a919fdab9e18b7ad3efaa1a79f1d7520ddf
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Fri Jun 2 12:41:07 2023 +0200

    target/110088: Improve operation of l-reg with const after move from d-reg.

    After reload, there may be sequences like
       lreg = dreg
       lreg = lreg <op> const
    with an LD_REGS dreg, non-LD_REGS lreg, and <op> in PLUS, IOR, AND.
    If dreg dies after the first insn, it is possible to use
       dreg = dreg <op> const
       lreg = dreg
    instead which is more efficient.

    gcc/
            PR target/110088
            * config/avr/avr.md: Add an RTL peephole to optimize operations on
            non-LD_REGS after a move from LD_REGS.
            (piaop): New code iterator.

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

* [Bug target/110088] [avr] Improve operation with const on l-reg after move from d-reg
  2023-06-02 10:26 [Bug target/110088] New: [avr] Improve operation with const on l-reg after move from d-reg gjl at gcc dot gnu.org
  2023-06-02 10:27 ` [Bug target/110088] " gjl at gcc dot gnu.org
  2023-06-02 10:42 ` cvs-commit at gcc dot gnu.org
@ 2023-06-02 10:55 ` cvs-commit at gcc dot gnu.org
  2023-06-02 11:02 ` cvs-commit at gcc dot gnu.org
  2023-06-02 11:03 ` gjl at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-02 10:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Georg-Johann Lay
<gjl@gcc.gnu.org>:

https://gcc.gnu.org/g:7cbaf2f96ec884d60e02d5d2a8a2f44ae0d390fd

commit r13-7408-g7cbaf2f96ec884d60e02d5d2a8a2f44ae0d390fd
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Fri Jun 2 12:41:07 2023 +0200

    target/110088: Improve operation of l-reg with const after move from d-reg.

    After reload, there may be sequences like
       lreg = dreg
       lreg = lreg <op> const
    with an LD_REGS dreg, non-LD_REGS lreg, and <op> in PLUS, IOR, AND.
    If dreg dies after the first insn, it is possible to use
       dreg = dreg <op> const
       lreg = dreg
    instead which is more efficient.

    gcc/
            PR target/110088
            * config/avr/avr.md: Add an RTL peephole to optimize operations on
            non-LD_REGS after a move from LD_REGS.
            (piaop): New code iterator.

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

* [Bug target/110088] [avr] Improve operation with const on l-reg after move from d-reg
  2023-06-02 10:26 [Bug target/110088] New: [avr] Improve operation with const on l-reg after move from d-reg gjl at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-06-02 10:55 ` cvs-commit at gcc dot gnu.org
@ 2023-06-02 11:02 ` cvs-commit at gcc dot gnu.org
  2023-06-02 11:03 ` gjl at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-02 11:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Georg-Johann Lay
<gjl@gcc.gnu.org>:

https://gcc.gnu.org/g:6f8e64989c2418bb8a4050fc1f50039a7b9a0225

commit r12-9674-g6f8e64989c2418bb8a4050fc1f50039a7b9a0225
Author: Georg-Johann Lay <avr@gjlay.de>
Date:   Fri Jun 2 12:41:07 2023 +0200

    target/110088: Improve operation of l-reg with const after move from d-reg.

    After reload, there may be sequences like
       lreg = dreg
       lreg = lreg <op> const
    with an LD_REGS dreg, non-LD_REGS lreg, and <op> in PLUS, IOR, AND.
    If dreg dies after the first insn, it is possible to use
       dreg = dreg <op> const
       lreg = dreg
    instead which is more efficient.

    gcc/
            PR target/110088
            * config/avr/avr.md: Add an RTL peephole to optimize operations on
            non-LD_REGS after a move from LD_REGS.
            (piaop): New code iterator.

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

* [Bug target/110088] [avr] Improve operation with const on l-reg after move from d-reg
  2023-06-02 10:26 [Bug target/110088] New: [avr] Improve operation with const on l-reg after move from d-reg gjl at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-06-02 11:02 ` cvs-commit at gcc dot gnu.org
@ 2023-06-02 11:03 ` gjl at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: gjl at gcc dot gnu.org @ 2023-06-02 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

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

--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Fixed in v12.4 and v13.2+.

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

end of thread, other threads:[~2023-06-02 11:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02 10:26 [Bug target/110088] New: [avr] Improve operation with const on l-reg after move from d-reg gjl at gcc dot gnu.org
2023-06-02 10:27 ` [Bug target/110088] " gjl at gcc dot gnu.org
2023-06-02 10:42 ` cvs-commit at gcc dot gnu.org
2023-06-02 10:55 ` cvs-commit at gcc dot gnu.org
2023-06-02 11:02 ` cvs-commit at gcc dot gnu.org
2023-06-02 11:03 ` gjl 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).