public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/52543] New: lower-subreg.c: code bloat of 300%-400% for bulti-word memory splits
@ 2012-03-09 15:39 gjl at gcc dot gnu.org
  2012-03-09 15:39 ` [Bug rtl-optimization/52543] " gjl at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: gjl at gcc dot gnu.org @ 2012-03-09 15:39 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52543
           Summary: lower-subreg.c: code bloat of 300%-400% for bulti-word
                    memory splits
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gjl@gcc.gnu.org
            Target: avr


lower-subreg.c causes extreme code bloat for some memory accesses because it
does not take into account the additional costs caused by the split.

Example code for AVR address spaces:

long readx (const __memx long *p)
{
    return *p;
}

long read1 (const __flash1 long *p)
{
    return *p;
}

long read0 (const __flash long *p)
{
    return *p;
}

Reason is that read from these address spaces need one preparation sequence
(set up segment register) per read. Thus:

For one 4-byte read there will be one preparation sequence.
For 4 one-byte reads there will be 4 preparation sequences.

For the __flash address space no preparation is needed, but a 32-bit read can
use post-increment addressing whereas a split to 4 byte moves won't use
post-increment because GCC is completely afraid of pre-/post-modify addressing.

The only place to hook in could be mode_dependent_address, however, that hook
just passes the address down to the backend but omits the address space in use.
As all 16-bit address spaces (including generic) use HImode as pointer mode,
the target cannot take a decision based on the address alone.

Configured with: ../../gcc.gnu.org/trunk/configure --target=avr
--prefix=/local/gnu/install/gcc-4.7 --disable-nls --with-dwarf2
--enable-checking=yes,rtl --enable-languages=c,c++

gcc version 4.8.0 20120307 (experimental) (GCC)


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

end of thread, other threads:[~2012-09-28  8:21 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-09 15:39 [Bug rtl-optimization/52543] New: lower-subreg.c: code bloat of 300%-400% for bulti-word memory splits gjl at gcc dot gnu.org
2012-03-09 15:39 ` [Bug rtl-optimization/52543] " gjl at gcc dot gnu.org
2012-03-09 15:41 ` gjl at gcc dot gnu.org
2012-03-09 15:45 ` gjl at gcc dot gnu.org
2012-03-09 15:47 ` gjl at gcc dot gnu.org
2012-03-21 13:26 ` [Bug rtl-optimization/52543] lower-subreg.c: code bloat of 300%-400% for multi-word " gjl at gcc dot gnu.org
2012-03-22 15:13 ` gjl at gcc dot gnu.org
2012-03-22 16:08 ` gjl at gcc dot gnu.org
2012-05-03 17:05 ` rsandifo at gcc dot gnu.org
2012-05-03 17:51 ` rsandifo at gcc dot gnu.org
2012-06-27  9:24 ` pinskia at gcc dot gnu.org
2012-08-02 18:30 ` gjl at gcc dot gnu.org
2012-08-02 18:37 ` gjl at gcc dot gnu.org
2012-08-02 18:39 ` gjl at gcc dot gnu.org
2012-09-06 14:38 ` olegendo at gcc dot gnu.org
2012-09-06 22:14 ` olegendo at gcc dot gnu.org
2012-09-15  6:07 ` pinskia at gcc dot gnu.org
2012-09-28  8:21 ` 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).