public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/114243] New: -fsplit-wide-types bloats code by more than 50%
@ 2024-03-05 15:56 gjl at gcc dot gnu.org
  2024-03-05 20:31 ` [Bug rtl-optimization/114243] [avr] " gjl at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-03-05 15:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114243
           Summary: -fsplit-wide-types bloats code by more than 50%
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

Created attachment 57616
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57616&action=edit
pi-sigma.c: C99 test case

Compile the attached test case with:

$ avr-gcc pi-sigma.c -c -Os -mmcu=atmega8 -fstack-usage && avr-size pi-sigma.o

Then the code sizes are for respective versions of the compiler:

avr-gcc-v8:   624
avr-gcc-v14: 1008

which is an increase of code size of more than 60% !

The stack usage also increases by a lot. According to pi-sigma.su:

avr-gcc-v8:
-----------
pi-sigma.c:80:7:sigma   30      static
pi-sigma.c:86:7:pi_n    14      static

avr-gcc-v14:
------------
pi-sigma.c:80:7:sigma   86      static
pi-sigma.c:86:7:pi_n    36      static

That is for the 1st function the stack use almost triples!

With -fno-split-wide-types the performace of v14 code is similar to v8.

Target: avr
Configured with: ../../source/gcc-master/configure --target=avr --disable-nls
--with-dwarf2 --with-gnu-as --with-gnu-ld --disable-shared
--enable-languages=c,c++ 
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240303 (experimental) (GCC)

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

* [Bug rtl-optimization/114243] [avr] -fsplit-wide-types bloats code by more than 50%
  2024-03-05 15:56 [Bug rtl-optimization/114243] New: -fsplit-wide-types bloats code by more than 50% gjl at gcc dot gnu.org
@ 2024-03-05 20:31 ` gjl at gcc dot gnu.org
  2024-03-05 20:40 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-03-05 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
May be related to PR110093.  As Vladimir noted in

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

the problem is that data flow analysis cannot cope with the subregs generated
from lower-subregs, and register alloc chokes at it.

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

* [Bug rtl-optimization/114243] [avr] -fsplit-wide-types bloats code by more than 50%
  2024-03-05 15:56 [Bug rtl-optimization/114243] New: -fsplit-wide-types bloats code by more than 50% gjl at gcc dot gnu.org
  2024-03-05 20:31 ` [Bug rtl-optimization/114243] [avr] " gjl at gcc dot gnu.org
@ 2024-03-05 20:40 ` pinskia at gcc dot gnu.org
  2024-06-21 13:17 ` [Bug rtl-optimization/114243] [13/14/15 Regression][avr] " gjl at gcc dot gnu.org
  2024-06-21 19:55 ` gjl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-05 20:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Subreg improvements to ra is planned for gcc 15 as the riscv folks are running
into it for vector modes in some cases. Maybe that will improves the situation
here.

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

* [Bug rtl-optimization/114243] [13/14/15 Regression][avr] -fsplit-wide-types bloats code by more than 50%
  2024-03-05 15:56 [Bug rtl-optimization/114243] New: -fsplit-wide-types bloats code by more than 50% gjl at gcc dot gnu.org
  2024-03-05 20:31 ` [Bug rtl-optimization/114243] [avr] " gjl at gcc dot gnu.org
  2024-03-05 20:40 ` pinskia at gcc dot gnu.org
@ 2024-06-21 13:17 ` gjl at gcc dot gnu.org
  2024-06-21 19:55 ` gjl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-06-21 13:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-06-21

--- Comment #3 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Still present in master.

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

* [Bug rtl-optimization/114243] [13/14/15 Regression][avr] -fsplit-wide-types bloats code by more than 50%
  2024-03-05 15:56 [Bug rtl-optimization/114243] New: -fsplit-wide-types bloats code by more than 50% gjl at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-06-21 13:17 ` [Bug rtl-optimization/114243] [13/14/15 Regression][avr] " gjl at gcc dot gnu.org
@ 2024-06-21 19:55 ` gjl at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-06-21 19:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Created attachment 58483
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58483&action=edit
sfmode.c: C test case

This is a test case with simpler functions like

float add2 (float a, float b)
{
    return a + b;
}

v8 compiles this with -Os -dp to:

add2:
        rcall __addsf3   ;  9   [c=24 l=1]  call_value_insn/1
        ret              ;  21  [c=0 l=1]  return

but the current compiler does:

add2:
        push r4          ;  76  [c=4 l=1]  pushqi1/0
        push r5          ;  77  [c=4 l=1]  pushqi1/0
        push r6          ;  78  [c=4 l=1]  pushqi1/0
        push r7          ;  79  [c=4 l=1]  pushqi1/0
        push r8          ;  80  [c=4 l=1]  pushqi1/0
        push r9          ;  81  [c=4 l=1]  pushqi1/0
        push r10                 ;  82  [c=4 l=1]  pushqi1/0
        push r11                 ;  83  [c=4 l=1]  pushqi1/0
        push r12                 ;  84  [c=4 l=1]  pushqi1/0
        push r13                 ;  85  [c=4 l=1]  pushqi1/0
        push r14                 ;  86  [c=4 l=1]  pushqi1/0
        push r15                 ;  87  [c=4 l=1]  pushqi1/0
/* prologue: function */
/* frame size = 0 */
/* stack size = 12 */
.L__stack_usage = 12
        mov r4,r18       ;  61  [c=4 l=1]  movqi_insn/0
        mov r5,r19       ;  62  [c=4 l=1]  movqi_insn/0
        mov r6,r20       ;  63  [c=4 l=1]  movqi_insn/0
        mov r7,r21       ;  64  [c=4 l=1]  movqi_insn/0
        mov r21,r7       ;  65  [c=4 l=4]  *movsf/0
        mov r20,r6
        mov r19,r5
        mov r18,r4
        mov r8,r22       ;  66  [c=4 l=1]  movqi_insn/0
        mov r9,r23       ;  67  [c=4 l=1]  movqi_insn/0
        mov r10,r24      ;  68  [c=4 l=1]  movqi_insn/0
        mov r11,r25      ;  69  [c=4 l=1]  movqi_insn/0
        mov r25,r11      ;  70  [c=4 l=4]  *movsf/0
        mov r24,r10
        mov r23,r9
        mov r22,r8
        rcall __addsf3   ;  9   [c=24 l=1]  call_value_insn/1
        mov r12,r22      ;  71  [c=4 l=1]  movqi_insn/0
        mov r13,r23      ;  72  [c=4 l=1]  movqi_insn/0
        mov r14,r24      ;  73  [c=4 l=1]  movqi_insn/0
        mov r15,r25      ;  74  [c=4 l=1]  movqi_insn/0
        mov r25,r15      ;  75  [c=4 l=4]  *movsf/0
        mov r24,r14
        mov r23,r13
        mov r22,r12
/* epilogue start */
        pop r15          ;  90  [c=4 l=1]  popqi
        pop r14          ;  91  [c=4 l=1]  popqi
        pop r13          ;  92  [c=4 l=1]  popqi
        pop r12          ;  93  [c=4 l=1]  popqi
        pop r11          ;  94  [c=4 l=1]  popqi
        pop r10          ;  95  [c=4 l=1]  popqi
        pop r9           ;  96  [c=4 l=1]  popqi
        pop r8           ;  97  [c=4 l=1]  popqi
        pop r7           ;  98  [c=4 l=1]  popqi
        pop r6           ;  99  [c=4 l=1]  popqi
        pop r5           ;  100 [c=4 l=1]  popqi
        pop r4           ;  101 [c=4 l=1]  popqi
        ret              ;  102 [c=0 l=1]  return_from_epilogue

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-05 15:56 [Bug rtl-optimization/114243] New: -fsplit-wide-types bloats code by more than 50% gjl at gcc dot gnu.org
2024-03-05 20:31 ` [Bug rtl-optimization/114243] [avr] " gjl at gcc dot gnu.org
2024-03-05 20:40 ` pinskia at gcc dot gnu.org
2024-06-21 13:17 ` [Bug rtl-optimization/114243] [13/14/15 Regression][avr] " gjl at gcc dot gnu.org
2024-06-21 19:55 ` 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).