public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/90706] [10/11/12/13 Regression] Useless code generated for stack / register operations on AVR
Date: Tue, 01 Nov 2022 15:55:30 +0000	[thread overview]
Message-ID: <bug-90706-4-1kSpOwdDjh@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-90706-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #13 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Created attachment 53812
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53812&action=edit
Test case with 32-bit integer.

This problem is still present in current master (future v13) and also occurs
with 32-bit integers.

> avr-gcc -S -Os -mul.c -fdump-rtl-ira

With v8, mul.s has 15 instructions.

With newer versions, mul.s has 26 additional instructions: 
* 12 silly, useless stores into / loads from frame.
* 12 instructions to setup the frame.
* More instructions due to sub-optimal register alloc.
* Uses 6 bytes stack frame where v8 needs no frame at all.

In the IRA dump, there is:

Pass 0 for finding pseudo/allocno costs
    a0 (r53,l0) best NO_REGS, allocno NO_REGS
    a2 (r49,l0) best GENERAL_REGS, allocno GENERAL_REGS
    a1 (r48,l0) best NO_REGS, allocno NO_REGS
...
Pass 1 for finding pseudo/allocno costs
    r53: preferred NO_REGS, alternative NO_REGS, allocno NO_REGS
    r49: preferred GENERAL_REGS, alternative NO_REGS, allocno GENERAL_REGS
    r48: preferred NO_REGS, alternative NO_REGS, allocno NO_REGS
...
      Spill a0(r53,l0)
      Spill a1(r48,l0)
      Allocno a2r49 of GENERAL_REGS(30) ...

So there are 2 register spills for no reason that lead to that code bloat.

  parent reply	other threads:[~2022-11-01 15:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-90706-4@http.gcc.gnu.org/bugzilla/>
2020-03-12 11:59 ` [Bug rtl-optimization/90706] [9/10 " jakub at gcc dot gnu.org
2020-03-13 23:25 ` bseifert at gmx dot at
2020-04-29 16:50 ` gjl at gcc dot gnu.org
2021-06-01  8:14 ` [Bug rtl-optimization/90706] [9/10/11/12 " rguenth at gcc dot gnu.org
2022-05-27  9:40 ` [Bug rtl-optimization/90706] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:37 ` jakub at gcc dot gnu.org
2022-11-01 15:55 ` gjl at gcc dot gnu.org [this message]
2022-12-13 14:10 ` vmakarov at gcc dot gnu.org
2022-12-15 19:20 ` cvs-commit at gcc dot gnu.org
2022-12-16 13:59 ` gjl at gcc dot gnu.org
2022-12-16 18:33 ` vmakarov at gcc dot gnu.org
2023-03-02 22:22 ` cvs-commit at gcc dot gnu.org
2023-03-04 13:45 ` gjl at gcc dot gnu.org
2023-03-31 12:42 ` cvs-commit at gcc dot gnu.org
2023-03-31 12:45 ` vmakarov at gcc dot gnu.org
2023-03-31 14:38 ` gjl at gcc dot gnu.org
2023-05-21 15:25 ` gjl at gcc dot gnu.org
2024-03-05 19:28 ` gjl at gcc dot gnu.org
2024-05-18  8:15 ` gjl at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-90706-4-1kSpOwdDjh@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).