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/110093] [12/13/14 Regression][avr] Move frenzy leading to code bloat
Date: Tue, 22 Aug 2023 14:25:16 +0000	[thread overview]
Message-ID: <bug-110093-4-m1MU9TRU6v@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110093-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Meanwhile (2023-08-22) the generated code from above got worse once again and
even pops a frame:

long add (long aa, long bb, long cc)
{
    if (cc < 0)
        return aa - cc;
    return aa + bb;
}

> avr-gcc -Os -S -dp

add:
        push r4          ;  83  [c=4 l=1]  pushqi1/0
        push r5          ;  84  [c=4 l=1]  pushqi1/0
        push r6          ;  85  [c=4 l=1]  pushqi1/0
        push r7          ;  86  [c=4 l=1]  pushqi1/0
        push r8          ;  87  [c=4 l=1]  pushqi1/0
        push r9          ;  88  [c=4 l=1]  pushqi1/0
        push r10                 ;  89  [c=4 l=1]  pushqi1/0
        push r11                 ;  90  [c=4 l=1]  pushqi1/0
        push r14                 ;  91  [c=4 l=1]  pushqi1/0
        push r15                 ;  92  [c=4 l=1]  pushqi1/0
        push r16                 ;  93  [c=4 l=1]  pushqi1/0
        push r17                 ;  94  [c=4 l=1]  pushqi1/0
        push r28                 ;  95  [c=4 l=1]  pushqi1/0
        push r29                 ;  96  [c=4 l=1]  pushqi1/0
         ; SP -= 4       ;  100 [c=4 l=2]  *addhi3_sp
        rcall . 
        rcall . 
        in r28,__SP_L__  ;  126 [c=4 l=2]  *movhi/7
        in r29,__SP_H__
/* prologue: function */
/* frame size = 4 */
/* stack size = 18 */
.L__stack_usage = 18
        mov r8,r22       ;  69  [c=4 l=1]  movqi_insn/0
        mov r9,r23       ;  70  [c=4 l=1]  movqi_insn/0
        mov r10,r24      ;  71  [c=4 l=1]  movqi_insn/0
        mov r11,r25      ;  72  [c=4 l=1]  movqi_insn/0
        std Y+1,r18      ;  73  [c=4 l=1]  movqi_insn/2
        std Y+2,r19      ;  74  [c=4 l=1]  movqi_insn/2
        std Y+3,r20      ;  75  [c=4 l=1]  movqi_insn/2
        std Y+4,r21      ;  76  [c=4 l=1]  movqi_insn/2
        mov r4,r14       ;  77  [c=4 l=1]  movqi_insn/0
        mov r5,r15       ;  78  [c=4 l=1]  movqi_insn/0
        mov r6,r16       ;  79  [c=4 l=1]  movqi_insn/0
        mov r7,r17       ;  80  [c=4 l=1]  movqi_insn/0
        sbrs r7,7        ;  123 [c=4 l=2]  *sbrx_branchhi
        rjmp .L2        
        mov r25,r11      ;  67  [c=4 l=4]  *movsi/0
        mov r24,r10
        mov r23,r9
        mov r22,r8
        sub r22,r4       ;  68  [c=16 l=4]  *subsi3/0
        sbc r23,r5
        sbc r24,r6
        sbc r25,r7
.L1:
/* epilogue start */
         ; SP += 4       ;  106 [c=4 l=4]  *addhi3_sp
        pop __tmp_reg__
        pop __tmp_reg__
        pop __tmp_reg__
        pop __tmp_reg__
        pop r29          ;  107 [c=4 l=1]  popqi
        pop r28          ;  108 [c=4 l=1]  popqi
        pop r17          ;  109 [c=4 l=1]  popqi
        pop r16          ;  110 [c=4 l=1]  popqi
        pop r15          ;  111 [c=4 l=1]  popqi
        pop r14          ;  112 [c=4 l=1]  popqi
        pop r11          ;  113 [c=4 l=1]  popqi
        pop r10          ;  114 [c=4 l=1]  popqi
        pop r9           ;  115 [c=4 l=1]  popqi
        pop r8           ;  116 [c=4 l=1]  popqi
        pop r7           ;  117 [c=4 l=1]  popqi
        pop r6           ;  118 [c=4 l=1]  popqi
        pop r5           ;  119 [c=4 l=1]  popqi
        pop r4           ;  120 [c=4 l=1]  popqi
        ret              ;  121 [c=0 l=1]  return_from_epilogue
.L2:
        ldd r22,Y+1      ;  65  [c=16 l=4]  *movsi/2
        ldd r23,Y+2
        ldd r24,Y+3
        ldd r25,Y+4
        add r22,r8       ;  66  [c=16 l=4]  *addsi3/0
        adc r23,r9
        adc r24,r10
        adc r25,r11
        rjmp .L1                 ;  124 [c=4 l=1]  jump

        .ident  "GCC: (GNU) 14.0.0 20230822 (experimental)"

  parent reply	other threads:[~2023-08-22 14:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02 13:22 [Bug rtl-optimization/110093] New: " gjl at gcc dot gnu.org
2023-06-05  6:38 ` [Bug rtl-optimization/110093] " rguenth at gcc dot gnu.org
2023-06-13 10:18 ` gjl at gcc dot gnu.org
2023-08-22 14:25 ` gjl at gcc dot gnu.org [this message]
2023-08-22 14:25 ` gjl at gcc dot gnu.org
2023-08-29 17:15 ` vmakarov at gcc dot gnu.org
2023-08-30  8:16 ` gjl at gcc dot gnu.org
2023-08-30 14:04 ` vmakarov at gcc dot gnu.org
2024-03-08 15:35 ` law at gcc dot gnu.org
2024-06-20  9:12 ` [Bug rtl-optimization/110093] [12/13/14/15 " rguenth 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-110093-4-m1MU9TRU6v@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).