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: Sun, 21 May 2023 15:25:57 +0000	[thread overview]
Message-ID: <bug-90706-4-IzPtqVjaaw@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 #23 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Created attachment 55130
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55130&action=edit
Test case for -Os -mmcu=attiny40

As it appears, this bug is not fixed completely.  For the -mmcu=avrtiny
architecture, there is still bloat for even the smallest test cases like:

$ avr-gcc bloat.c -mmcu=attiny40 -Os -S

char func3 (char c)
{
    return 1 + c;
}

"GCC: (GNU) 14.0.0 20230520 (experimental)" compiles this to:

func3:
        push r28                 ;  22  [c=4 l=1]  pushqi1/0
        push r29                 ;  23  [c=4 l=1]  pushqi1/0
        push __tmp_reg__         ;  27  [c=4 l=1]  *addhi3_sp
        in r28,__SP_L__  ;  38  [c=4 l=2]  *movhi/7
        in r29,__SP_H__
/* prologue: function */
/* frame size = 1 */
/* stack size = 3 */
        mov r20,r24      ;  18  [c=4 l=1]  movqi_insn/0
        subi r20,lo8(-(1))       ;  19  [c=4 l=1]  *addqi3/1
        mov r24,r20      ;  21  [c=4 l=1]  movqi_insn/0
/* epilogue start */
        pop __tmp_reg__  ;  33  [c=4 l=1]  *addhi3_sp
        pop r29          ;  34  [c=4 l=1]  popqi
        pop r28          ;  35  [c=4 l=1]  popqi
        ret              ;  36  [c=0 l=1]  return_from_epilogue

For reference, avr-gcc v8 generates for this function:

func3:
/* prologue: function */
/* frame size = 0 */
/* stack size = 0 */
.L__stack_usage = 0
        subi r24,lo8(-(1))       ;  6   [c=4 l=1]  addqi3/1
/* epilogue start */
        ret              ;  17  [c=0 l=1]  return

  parent reply	other threads:[~2023-05-21 15:25 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
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 [this message]
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-IzPtqVjaaw@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).