public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/17106] New: Opportunity to eliminate loads from TOC.
@ 2004-08-19 14:59 gcc-bugzilla at gcc dot gnu dot org
  2004-08-19 15:21 ` [Bug tree-optimization/17106] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-08-19 14:59 UTC (permalink / raw)
  To: gcc-bugs

Description:
A non-optimal code sequence is illustraded.    Duplicate using gcc 3.5 and
command line:

gcc -O3 -m64 -c test.c


Testcase:
static int s1, s2, s3;
void no_common_toc1 ()
{

  s1 = 1;
  s2 = 2;
  s3 = 3;
}

Assembly:
The code generated by gcc 3.5 contains loads the address from the TOC for
each
target location:

.no_common_toc1:
      ld 11,.LC0@toc(2)
      li 0,1
      li 9,2
      ld 8,.LC2@toc(2)
      ld 10,.LC1@toc(2)
      stw 0,0(11)
      li 0,3
      stw 9,0(10)
      stw 0,0(8)
      blr

A single load of the base of the TOC is all that is needed:

.no_common_toc1:
      ld 11,.LC0@toc(2)
      li 0,1
      li 9,2
      stw 0,0(11)
      li 0,3
      stw 9,4(11)
      stw 0,8(11)
      blr




-- 
           Summary: Opportunity to eliminate loads from TOC.
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P1
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steinmtz at us dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm
                    dot com
 GCC build triplet: powerpc64-linux
  GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux


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


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

* [Bug tree-optimization/17106] Opportunity to eliminate loads from TOC.
  2004-08-19 14:59 [Bug other/17106] New: Opportunity to eliminate loads from TOC gcc-bugzilla at gcc dot gnu dot org
@ 2004-08-19 15:21 ` pinskia at gcc dot gnu dot org
  2004-11-06 20:37 ` pinskia at gcc dot gnu dot org
  2005-09-10 18:02 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-19 15:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-19 15:21 -------
Confirmed, what needs to happen here is that GCC needs to put these variables in a struct like so:
static struct {int s1, s2, s3; }t;
void no_common_toc1 ()
{
  t.s1 = 1;
  t.s2 = 2;
  t.s3 = 3;
}

Which will produce the optimial code.  This also helps powerpc-apple-darwin.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|other                       |tree-optimization
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-19 15:21:33
               date|                            |


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


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

* [Bug tree-optimization/17106] Opportunity to eliminate loads from TOC.
  2004-08-19 14:59 [Bug other/17106] New: Opportunity to eliminate loads from TOC gcc-bugzilla at gcc dot gnu dot org
  2004-08-19 15:21 ` [Bug tree-optimization/17106] " pinskia at gcc dot gnu dot org
@ 2004-11-06 20:37 ` pinskia at gcc dot gnu dot org
  2005-09-10 18:02 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-06 20:37 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
   Last reconfirmed|2004-08-19 15:21:33         |2004-11-06 20:37:23
               date|                            |


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


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

* [Bug tree-optimization/17106] Opportunity to eliminate loads from TOC.
  2004-08-19 14:59 [Bug other/17106] New: Opportunity to eliminate loads from TOC gcc-bugzilla at gcc dot gnu dot org
  2004-08-19 15:21 ` [Bug tree-optimization/17106] " pinskia at gcc dot gnu dot org
  2004-11-06 20:37 ` pinskia at gcc dot gnu dot org
@ 2005-09-10 18:02 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-10 18:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-10 18:02 -------
This should be helped or fixed by:
http://gcc.gnu.org/wiki/Section%20Anchor%20Optimisations

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2005-05-08 18:55:21         |2005-09-10 18:02:38
               date|                            |


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


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

end of thread, other threads:[~2005-09-10 18:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-19 14:59 [Bug other/17106] New: Opportunity to eliminate loads from TOC gcc-bugzilla at gcc dot gnu dot org
2004-08-19 15:21 ` [Bug tree-optimization/17106] " pinskia at gcc dot gnu dot org
2004-11-06 20:37 ` pinskia at gcc dot gnu dot org
2005-09-10 18:02 ` pinskia at gcc dot gnu dot 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).