public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/35860] [4.3/4.4/4.5/4.6/4.7 Regression] [avr] code bloat caused by -fsplit-wide-types
       [not found] <bug-35860-4@http.gcc.gnu.org/bugzilla/>
@ 2011-06-27 15:26 ` rguenth at gcc dot gnu.org
  2011-09-21 14:31 ` [Bug target/35860] [4.4/4.5/4.6/4.7 " gjl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-27 15:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35860

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.3.6                       |4.4.7

--- Comment #13 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-27 12:14:49 UTC ---
4.3 branch is being closed, moving to 4.4.7 target.


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

* [Bug target/35860] [4.4/4.5/4.6/4.7 Regression] [avr] code bloat caused by -fsplit-wide-types
       [not found] <bug-35860-4@http.gcc.gnu.org/bugzilla/>
  2011-06-27 15:26 ` [Bug target/35860] [4.3/4.4/4.5/4.6/4.7 Regression] [avr] code bloat caused by -fsplit-wide-types rguenth at gcc dot gnu.org
@ 2011-09-21 14:31 ` gjl at gcc dot gnu.org
  2011-09-22 10:29 ` [Bug middle-end/35860] " gjl at gcc dot gnu.org
  2011-10-07 15:51 ` gjl at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-09-21 14:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35860

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gjl at gcc dot gnu.org
         Depends on|                            |50447

--- Comment #14 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-09-21 14:25:09 UTC ---
The bloat is partly caused by PR50447 because the a |= 1 leads to reload of the
constant 1 into an SI register.  For that constant no reloading is needed. 
However, insn *iorsi3_clobber is hidden behind iorsi3 so that a reload happens
and causes a part of the observed code bloat.  Moreover, operations like AND,
IOR, XOR are implemented in a suboptimal way.

The other part of the code bloat is simply because of -f[no-]split-wide-types;
there will always be cases where splitting wide types leads to bloated (or sort
of) code because there might be SUBREGs all over the place.  Not all insns can
be split, e.g. addition, subtraction, comparison, etc. so that there will be
mixture of split and non-split insns.


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

* [Bug middle-end/35860] [4.4/4.5/4.6/4.7 Regression] [avr] code bloat caused by -fsplit-wide-types
       [not found] <bug-35860-4@http.gcc.gnu.org/bugzilla/>
  2011-06-27 15:26 ` [Bug target/35860] [4.3/4.4/4.5/4.6/4.7 Regression] [avr] code bloat caused by -fsplit-wide-types rguenth at gcc dot gnu.org
  2011-09-21 14:31 ` [Bug target/35860] [4.4/4.5/4.6/4.7 " gjl at gcc dot gnu.org
@ 2011-09-22 10:29 ` gjl at gcc dot gnu.org
  2011-10-07 15:51 ` gjl at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-09-22 10:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35860

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ra
             Status|NEW                         |WAITING
          Component|target                      |middle-end
               Host|mingw                       |
   Target Milestone|4.4.7                       |4.7.0

--- Comment #15 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-09-22 10:24:45 UTC ---
With 4.7 trunk r179081 and the code from comment #0 avr-gcc -mmcu=avr4 -Os -S
-dp 

The output with -fno-split-wide-types is 36 bytes

udivr32_7:
/* stack size = 0 */
    ldi r30,lo8(32)     ;  10    *movqi/2    [length = 1]
    ldi r21,lo8(0)     ;  11    *movqi/1    [length = 1]
.L4:
    lsl r21     ;  15    *ashlqi3/3    [length = 1]
    sbrc r25,7     ;  58    *sbrx_and_branchsi    [length = 2]
    subi r21,lo8(-(1))     ;  19    addqi3/2    [length = 1]
.L2:
    lsl r22     ;  57    *ashlsi3_const/2    [length = 4]
    rol r23
    rol r24
    rol r25
    cp r21,r20     ;  23    *cmpqi/2    [length = 1]
    brlo .L3     ;  24    branch    [length = 1]
    sub r21,r20     ;  26    subqi3/1    [length = 1]
    ori r22,1     ;  27    iorsi3/2    [length = 1]
.L3:
    subi r30,lo8(-(-1))     ;  30    addqi3/2    [length = 1]
    brne .L4     ;  33    branch    [length = 1]
    movw r30,r18     ;  52    *movhi/1    [length = 1]
    st Z,r21     ;  35    *movqi/3    [length = 1]
/* epilogue start */
    ret     ;  55    return    [length = 1]


The output with -fsplit-wide-types is 62 bytes

udivr32_7:
    push r12     ;  61    pushqi1/1    [length = 1]
    push r13     ;  62    pushqi1/1    [length = 1]
    push r14     ;  63    pushqi1/1    [length = 1]
    push r15     ;  64    pushqi1/1    [length = 1]
/* stack size = 4 */
    movw r12,r22     ;  6    *movsi/1    [length = 2]
    movw r14,r24
    ldi r25,lo8(32)     ;  10    *movqi/2    [length = 1]
    ldi r24,lo8(0)     ;  11    *movqi/1    [length = 1]
.L4:
    lsl r24     ;  15    *ashlqi3/3    [length = 1]
    sbrc r15,7     ;  76    *sbrx_and_branchsi    [length = 2]
    subi r24,lo8(-(1))     ;  19    addqi3/2    [length = 1]
.L2:
    lsl r12     ;  75    *ashlsi3_const/2    [length = 4]
    rol r13
    rol r14
    rol r15
    cp r24,r20     ;  23    *cmpqi/2    [length = 1]
    brlo .L3     ;  24    branch    [length = 1]
    sub r24,r20     ;  26    subqi3/1    [length = 1]
    set     ;  27    iorsi3/3    [length = 2]
    bld r12,0
.L3:
    subi r25,lo8(-(-1))     ;  30    addqi3/2    [length = 1]
    brne .L4     ;  33    branch    [length = 1]
    movw r30,r18     ;  60    *movhi/1    [length = 1]
    st Z,r24     ;  35    *movqi/3    [length = 1]
    movw r22,r12     ;  73    *movhi/1    [length = 1]
    movw r24,r14     ;  74    *movhi/1    [length = 1]
/* epilogue start */
    pop r15     ;  67    popqi    [length = 1]
    pop r14     ;  68    popqi    [length = 1]
    pop r13     ;  69    popqi    [length = 1]
    pop r12     ;  70    popqi    [length = 1]
    ret     ;  71    return_from_epilogue    [length = 1]


So there is still code bloat with -fsplit-wide-types.

I don't see how the back-end can improve thas situation and IMO the bloat is
caused by the register allocation which leads to the 13 additional
instructions: all push/pop and moving registers back and forth (and one for
a|=1 in a register that cannot operate with constants in insn 27).

Therefore, I added RA to the keywords, set component to "middle-end" and
changed the status to "waiting" so that someone familiar with the register
allocator can tell if it's a RA flaw or not or give better component/keyword.


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

* [Bug middle-end/35860] [4.4/4.5/4.6/4.7 Regression] [avr] code bloat caused by -fsplit-wide-types
       [not found] <bug-35860-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-09-22 10:29 ` [Bug middle-end/35860] " gjl at gcc dot gnu.org
@ 2011-10-07 15:51 ` gjl at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-10-07 15:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35860

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

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

--- Comment #16 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-10-07 15:50:10 UTC ---
Closed this PR. If you are still uncomfortable with the code avr-gcc generates
together with -fsplit-wide-types, please file a new bug report for the register
allocator.


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

end of thread, other threads:[~2011-10-07 15:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-35860-4@http.gcc.gnu.org/bugzilla/>
2011-06-27 15:26 ` [Bug target/35860] [4.3/4.4/4.5/4.6/4.7 Regression] [avr] code bloat caused by -fsplit-wide-types rguenth at gcc dot gnu.org
2011-09-21 14:31 ` [Bug target/35860] [4.4/4.5/4.6/4.7 " gjl at gcc dot gnu.org
2011-09-22 10:29 ` [Bug middle-end/35860] " gjl at gcc dot gnu.org
2011-10-07 15:51 ` 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).