public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/32964]  New: union cause ineffient code inside loops
@ 2007-08-01 23:11 pinskia at gcc dot gnu dot org
  2007-08-01 23:16 ` [Bug tree-optimization/32964] [4.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-08-01 23:11 UTC (permalink / raw)
  To: gcc-bugs

Testcase:
union A
{
 float a;
};
float t(float a)
{
  union A a1, a2, a3;
  a1.a = a;
  for(int i =0;i<100;i++)
  {
  a2 = a1;
  a2.a += a;
  a1 = a2;
  }
  a3 = a1;
  return a3.a;
}

--------------
We currently get on powerpc-linux-gnu in the inner loop:
.L2:
        stw 0,8(1)
        lfs 0,8(1)
        fadds 0,1,0
        stfs 0,8(1)
        lwz 0,8(1)
        bdnz .L2

Notice how we are storing and loading from the same address twice in the loop.
That is bad news for the Cell.
This also happens on x86:
.L2:
        flds    -4(%ebp)  <--- load a1.a
        addl    $1, %eax
        fadd    %st(1), %st
        cmpl    $100, %eax
        fstps   -8(%ebp)   <--- store a2.a
        movl    -8(%ebp), %edx  <--- load a2.a
        movl    %edx, -4(%ebp)  <--- store a1.a
        jne     .L2


-- 
           Summary: union cause ineffient code inside loops
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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


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

end of thread, other threads:[~2010-05-22 18:19 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-01 23:11 [Bug tree-optimization/32964] New: union cause ineffient code inside loops pinskia at gcc dot gnu dot org
2007-08-01 23:16 ` [Bug tree-optimization/32964] [4.3 Regression] " pinskia at gcc dot gnu dot org
2007-08-01 23:18 ` pinskia at gcc dot gnu dot org
2007-08-10  0:58 ` mmitchel at gcc dot gnu dot org
2007-11-03 18:13 ` [Bug middle-end/32964] " pinskia at gcc dot gnu dot org
2008-01-02 14:15 ` [Bug middle-end/32964] [4.3 Regression] union cause inefficient " rguenth at gcc dot gnu dot org
2008-01-04 17:04 ` rguenth at gcc dot gnu dot org
2008-01-04 17:09 ` rguenth at gcc dot gnu dot org
2008-03-14 16:58 ` [Bug middle-end/32964] [4.3/4.4 " rguenth at gcc dot gnu dot org
2008-06-06 14:59 ` rguenth at gcc dot gnu dot org
2008-08-27 22:04 ` jsm28 at gcc dot gnu dot org
2009-01-24 10:24 ` rguenth at gcc dot gnu dot org
2009-02-01  8:07 ` bonzini at gnu dot org
2009-02-01 10:40 ` rguenth at gcc dot gnu dot org
2009-02-06 21:45 ` jamborm at gcc dot gnu dot org
2009-05-22 21:07 ` [Bug middle-end/32964] [4.3/4.4/4.5 " rguenth at gcc dot gnu dot org
2009-08-04 12:36 ` rguenth at gcc dot gnu dot org
2009-08-06 11:55 ` jamborm at gcc dot gnu dot org
2009-08-06 12:09 ` [Bug middle-end/32964] [4.3/4.4 " jamborm at gcc dot gnu dot org
2010-05-22 18:19 ` rguenth 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).