public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/36127] bad choice of loop IVs above -Os on x86
  2008-05-05  2:12 [Bug tree-optimization/36127] New: bad choice of loop IVs above -Os on x86 astrange at ithinksw dot com
  2008-05-05  2:12 ` [Bug tree-optimization/36127] " astrange at ithinksw dot com
@ 2008-05-05  2:12 ` astrange at ithinksw dot com
  2008-05-05  2:13 ` astrange at ithinksw dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: astrange at ithinksw dot com @ 2008-05-05  2:12 UTC (permalink / raw)
  To: gcc-bugs



-- 

astrange at ithinksw dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


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

* [Bug tree-optimization/36127]  New: bad choice of loop IVs above -Os on x86
@ 2008-05-05  2:12 astrange at ithinksw dot com
  2008-05-05  2:12 ` [Bug tree-optimization/36127] " astrange at ithinksw dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: astrange at ithinksw dot com @ 2008-05-05  2:12 UTC (permalink / raw)
  To: gcc-bugs

> /usr/local/gcc44/bin/gcc -v
[..]
gcc version 4.4.0 20080503 (experimental) (GCC)
> gcc -O3 -mfpmath=sse -fno-pic -fno-tree-vectorize -S himenoBMTxps.c

With -O2/-O3, the inner loop in jacobi() in this program ends containing a lot
of this:
        movss   _p-4(%edi,%edx,4), %xmm0
        movl    -96(%ebp), %edi
        subss   _p-4(%edi,%edx,4), %xmm0
        movl    -108(%ebp), %edi
        subss   _p-4(%edi,%edx,4), %xmm0
        movl    -92(%ebp), %edi
        addss   _p-4(%edi,%edx,4), %xmm0
        movl    -124(%ebp), %edi

At -O1 or -Os, it instead produces:
        movss   34056(%eax), %xmm0
        subss   33024(%eax), %xmm0
        subss   -33024(%eax), %xmm0
        addss   -34056(%eax), %xmm0

which is much better. On core 2 it claims to be 40% faster at -Os.

IIRC this isn't a problem on x86-64, but IRA+-O3 was much worse again.


-- 
           Summary: bad choice of loop IVs above -Os on x86
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: astrange at ithinksw dot com
GCC target triplet: i?86-*-*


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


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

* [Bug tree-optimization/36127] bad choice of loop IVs above -Os on x86
  2008-05-05  2:12 [Bug tree-optimization/36127] New: bad choice of loop IVs above -Os on x86 astrange at ithinksw dot com
@ 2008-05-05  2:12 ` astrange at ithinksw dot com
  2008-05-05  2:12 ` astrange at ithinksw dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: astrange at ithinksw dot com @ 2008-05-05  2:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from astrange at ithinksw dot com  2008-05-05 02:12 -------
Created an attachment (id=15578)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15578&action=view)
source


-- 


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


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

* [Bug tree-optimization/36127] bad choice of loop IVs above -Os on x86
  2008-05-05  2:12 [Bug tree-optimization/36127] New: bad choice of loop IVs above -Os on x86 astrange at ithinksw dot com
                   ` (2 preceding siblings ...)
  2008-05-05  2:13 ` astrange at ithinksw dot com
@ 2008-05-05  2:13 ` astrange at ithinksw dot com
  2008-05-07 17:37 ` astrange at ithinksw dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: astrange at ithinksw dot com @ 2008-05-05  2:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from astrange at ithinksw dot com  2008-05-05 02:12 -------
Created an attachment (id=15579)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15579&action=view)
compiled at -O3 on darwin


-- 


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


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

* [Bug tree-optimization/36127] bad choice of loop IVs above -Os on x86
  2008-05-05  2:12 [Bug tree-optimization/36127] New: bad choice of loop IVs above -Os on x86 astrange at ithinksw dot com
  2008-05-05  2:12 ` [Bug tree-optimization/36127] " astrange at ithinksw dot com
  2008-05-05  2:12 ` astrange at ithinksw dot com
@ 2008-05-05  2:13 ` astrange at ithinksw dot com
  2008-05-05  2:13 ` astrange at ithinksw dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: astrange at ithinksw dot com @ 2008-05-05  2:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from astrange at ithinksw dot com  2008-05-05 02:13 -------
Created an attachment (id=15580)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15580&action=view)
and at -Os


-- 


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


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

* [Bug tree-optimization/36127] bad choice of loop IVs above -Os on x86
  2008-05-05  2:12 [Bug tree-optimization/36127] New: bad choice of loop IVs above -Os on x86 astrange at ithinksw dot com
                   ` (3 preceding siblings ...)
  2008-05-05  2:13 ` astrange at ithinksw dot com
@ 2008-05-07 17:37 ` astrange at ithinksw dot com
  2009-08-07  3:04 ` astrange at ithinksw dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: astrange at ithinksw dot com @ 2008-05-07 17:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from astrange at ithinksw dot com  2008-05-07 17:36 -------
Created an attachment (id=15592)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15592&action=view)
minimal source


-- 


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


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

* [Bug tree-optimization/36127] bad choice of loop IVs above -Os on x86
  2008-05-05  2:12 [Bug tree-optimization/36127] New: bad choice of loop IVs above -Os on x86 astrange at ithinksw dot com
                   ` (4 preceding siblings ...)
  2008-05-07 17:37 ` astrange at ithinksw dot com
@ 2009-08-07  3:04 ` astrange at ithinksw dot com
  2009-08-07  4:40 ` spop at gcc dot gnu dot org
  2009-08-07  8:32 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: astrange at ithinksw dot com @ 2009-08-07  3:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from astrange at ithinksw dot com  2009-08-07 03:04 -------
Fixed with -O3 -fgraphite-identity. Why did I even bother checking that?


-- 


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


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

* [Bug tree-optimization/36127] bad choice of loop IVs above -Os on x86
  2008-05-05  2:12 [Bug tree-optimization/36127] New: bad choice of loop IVs above -Os on x86 astrange at ithinksw dot com
                   ` (5 preceding siblings ...)
  2009-08-07  3:04 ` astrange at ithinksw dot com
@ 2009-08-07  4:40 ` spop at gcc dot gnu dot org
  2009-08-07  8:32 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: spop at gcc dot gnu dot org @ 2009-08-07  4:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from spop at gcc dot gnu dot org  2009-08-07 04:40 -------
Fixed.


-- 

spop at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/36127] bad choice of loop IVs above -Os on x86
  2008-05-05  2:12 [Bug tree-optimization/36127] New: bad choice of loop IVs above -Os on x86 astrange at ithinksw dot com
                   ` (6 preceding siblings ...)
  2009-08-07  4:40 ` spop at gcc dot gnu dot org
@ 2009-08-07  8:32 ` rguenth at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-08-07  8:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2009-08-07 08:32 -------
Err, that's not exactly a fix for -O2/-O3 ;)


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/36127] bad choice of loop IVs above -Os on x86
       [not found] <bug-36127-4@http.gcc.gnu.org/bugzilla/>
  2023-06-21  3:44 ` pinskia at gcc dot gnu.org
@ 2023-06-21  8:05 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-21  8:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #8)
> So what seems to be happening is PRE is pull out the following from the loop:
> 
>   pretmp_250 = MEM[(float *)_2 + 4294933760B + ivtmp.159_57 * 1];
>   _22 = (void *) ivtmp.140_79;
>   pretmp_253 = MEM[(float *)_22 + 4294934276B];
>   pretmp_257 = MEM[(float *)_22 + 4294900220B];
>   pretmp_259 = MEM[(float *)_22 + 4294933244B];
>   pretmp_261 = MEM[(float *)_22 + 4294933760B];

I don't see any of that for the original testcase, in fact the original
reported issue that -O2/-O3 -fno-vectorize are slower than -O/-Os
-fno-vectorize is no longer present.

vectorizing also provides a nice speedup for me

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

* [Bug tree-optimization/36127] bad choice of loop IVs above -Os on x86
       [not found] <bug-36127-4@http.gcc.gnu.org/bugzilla/>
@ 2023-06-21  3:44 ` pinskia at gcc dot gnu.org
  2023-06-21  8:05 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-21  3:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So what seems to be happening is PRE is pull out the following from the loop:

  pretmp_250 = MEM[(float *)_2 + 4294933760B + ivtmp.159_57 * 1];
  _22 = (void *) ivtmp.140_79;
  pretmp_253 = MEM[(float *)_22 + 4294934276B];
  pretmp_257 = MEM[(float *)_22 + 4294900220B];
  pretmp_259 = MEM[(float *)_22 + 4294933244B];
  pretmp_261 = MEM[(float *)_22 + 4294933760B];

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

end of thread, other threads:[~2023-06-21  8:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-05  2:12 [Bug tree-optimization/36127] New: bad choice of loop IVs above -Os on x86 astrange at ithinksw dot com
2008-05-05  2:12 ` [Bug tree-optimization/36127] " astrange at ithinksw dot com
2008-05-05  2:12 ` astrange at ithinksw dot com
2008-05-05  2:13 ` astrange at ithinksw dot com
2008-05-05  2:13 ` astrange at ithinksw dot com
2008-05-07 17:37 ` astrange at ithinksw dot com
2009-08-07  3:04 ` astrange at ithinksw dot com
2009-08-07  4:40 ` spop at gcc dot gnu dot org
2009-08-07  8:32 ` rguenth at gcc dot gnu dot org
     [not found] <bug-36127-4@http.gcc.gnu.org/bugzilla/>
2023-06-21  3:44 ` pinskia at gcc dot gnu.org
2023-06-21  8:05 ` rguenth 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).