public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/30801] 4.3 performance regression on uint64_t operations
  2007-02-14 23:21 [Bug middle-end/30801] New: 4.3 performance regression on uint64_t operations fxcoudert at gcc dot gnu dot org
@ 2007-02-14 23:21 ` fxcoudert at gcc dot gnu dot org
  2007-02-14 23:26 ` [Bug target/30801] " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-02-14 23:21 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-02-14 23:21:03
               date|                            |


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


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

* [Bug middle-end/30801]  New: 4.3 performance regression on uint64_t operations
@ 2007-02-14 23:21 fxcoudert at gcc dot gnu dot org
  2007-02-14 23:21 ` [Bug middle-end/30801] " fxcoudert at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-02-14 23:21 UTC (permalink / raw)
  To: gcc-bugs

I noticed a performance regression on the following code:

$ cat a.c
#include <stdint.h>
#include <stdio.h>

void
add256 (uint64_t x[4], const uint64_t y[4])
{
 unsigned char carry;
 x[0] += y[0];
 carry = (x[0] < y[0]);
 x[1] += y[1]+carry;
 carry = carry ? (x[1] <= y[1]) : (x[1] < y[1]);
 x[2] += y[2]+carry;
 carry = carry ? (x[2] <= y[2]) : (x[2] < y[2]);
 x[3] += y[3]+carry;
}

int
main (void)
{
 int i;
 uint64_t x[4], y[4];

 x[0] = 0;  x[1] = 0;  x[2] = 0;  x[3] = 0;
 y[0] = 0x0123456789abcdefULL;
 y[1] = 0xfedcba9876543210ULL;
 y[2] = 0xdeadbeeff001baadULL;
 y[3] = 0x001001001001ffffULL;
 for ( i=0 ; i<100000000 ; i++ )
   add256 (x, y);
 printf ("%016llx%016llx%016llx%016llx\n",
         (unsigned long long)x[3],
         (unsigned long long)x[2],
         (unsigned long long)x[1],
         (unsigned long long)x[0]);
 return 0;
}
$ gcc -march=pentium4 -O3 a.c && time ./a.out
064069fbc13963b920219c3e939225e38e38e38e3956d81c71c71c71c0ba0f00
./a.out  1.81s user 0.00s system 99% cpu 1.818 total
$ gcc-4.3 -march=pentium4 -O3 a.c && time ./a.out
064069fbc13963b920219c3e939225e38e38e38e3956d81c71c71c71c0ba0f00
./a.out  2.40s user 0.01s system 87% cpu 2.746 total

where gcc is gcc version 4.1.1 20070105 (Red Hat 4.1.1-51) and gcc-4.3
is gcc version 4.3.0 20070209 (experimental).

Pawel Sikora confirmed he's seeing the same kind of regression between 4.2 and
4.3 (http://gcc.gnu.org/ml/gcc/2007-02/msg00319.html)


-- 
           Summary: 4.3 performance regression on uint64_t operations
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


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


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

* [Bug target/30801] 4.3 performance regression on uint64_t operations
  2007-02-14 23:21 [Bug middle-end/30801] New: 4.3 performance regression on uint64_t operations fxcoudert at gcc dot gnu dot org
  2007-02-14 23:21 ` [Bug middle-end/30801] " fxcoudert at gcc dot gnu dot org
@ 2007-02-14 23:26 ` pinskia at gcc dot gnu dot org
  2007-02-14 23:26 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-14 23:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-02-14 23:26 -------
This was NOT caused by the lowering pass at all


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |target


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


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

* [Bug target/30801] 4.3 performance regression on uint64_t operations
  2007-02-14 23:21 [Bug middle-end/30801] New: 4.3 performance regression on uint64_t operations fxcoudert at gcc dot gnu dot org
  2007-02-14 23:21 ` [Bug middle-end/30801] " fxcoudert at gcc dot gnu dot org
  2007-02-14 23:26 ` [Bug target/30801] " pinskia at gcc dot gnu dot org
@ 2007-02-14 23:26 ` pinskia at gcc dot gnu dot org
  2007-09-11 11:52 ` [Bug target/30801] [4.3 Regression] " jsm28 at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-14 23:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-02-14 23:26 -------
(In reply to comment #1)
> This was NOT caused by the lowering pass at all.
                            ^
                          subreg


-- 


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


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

* [Bug target/30801] [4.3 Regression] performance regression on uint64_t operations
  2007-02-14 23:21 [Bug middle-end/30801] New: 4.3 performance regression on uint64_t operations fxcoudert at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-02-14 23:26 ` pinskia at gcc dot gnu dot org
@ 2007-09-11 11:52 ` jsm28 at gcc dot gnu dot org
  2007-10-10 17:44 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2007-09-11 11:52 UTC (permalink / raw)
  To: gcc-bugs



-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|4.3 performance regression  |[4.3 Regression] performance
                   |on uint64_t operations      |regression on uint64_t
                   |                            |operations
   Target Milestone|---                         |4.3.0


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


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

* [Bug target/30801] [4.3 Regression] performance regression on uint64_t operations
  2007-02-14 23:21 [Bug middle-end/30801] New: 4.3 performance regression on uint64_t operations fxcoudert at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-09-11 11:52 ` [Bug target/30801] [4.3 Regression] " jsm28 at gcc dot gnu dot org
@ 2007-10-10 17:44 ` mmitchel at gcc dot gnu dot org
  2007-10-25 18:58 ` rask at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-10-10 17:44 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug target/30801] [4.3 Regression] performance regression on uint64_t operations
  2007-02-14 23:21 [Bug middle-end/30801] New: 4.3 performance regression on uint64_t operations fxcoudert at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-10-10 17:44 ` mmitchel at gcc dot gnu dot org
@ 2007-10-25 18:58 ` rask at gcc dot gnu dot org
  2007-11-07 16:35 ` rask at gcc dot gnu dot org
  2007-11-07 16:49 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rask at gcc dot gnu dot org @ 2007-10-25 18:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rask at gcc dot gnu dot org  2007-10-25 18:58 -------
I see a substantial improvent when testing on the compile farm hardware:

processor       : 3
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 65
model name      : Dual-Core AMD Opteron(tm) Processor 2212
stepping        : 3
cpu MHz         : 2000.240
cache size      : 1024 KB
...

$ gcc --version | head -n 1
gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
$ gcc -O3 ~/pr30801.c && time ./a.out
064069fbc13963b920219c3e939225e38e38e38e3956d81c71c71c71c0ba0f00

real    0m0.555s
user    0m0.552s
sys     0m0.004s

$ (cd ~/build/gcc-x86_64-unknown-linux-gnu/gcc && ./xgcc --version | head -n 1)
xgcc (GCC) 4.3.0 20071022 (experimental)
$ (cd ~/build/gcc-x86_64-unknown-linux-gnu/gcc && ./xgcc -B./ -O3 ~/pr30801.c
&& time ./a.out)
064069fbc13963b920219c3e939225e38e38e38e3956d81c71c71c71c0ba0f00

real    0m0.455s
user    0m0.452s
sys     0m0.004s

Note that your -march=pentium4 option is rejected without -m32:
$ gcc -march=pentium4 -O3 ~/pr30801.c && time ./a.out
/home/rask/pr30801.c:1: error: CPU you selected does not support x86-64
instruction set
/home/rask/pr30801.c:1: error: CPU you selected does not support x86-64
instruction set

$ gcc -O3 ~/pr30801.c -m32 -march=pentium4 && time ./a.out
064069fbc13963b920219c3e939225e38e38e38e3956d81c71c71c71c0ba0f00

real    0m2.234s
user    0m2.232s
sys     0m0.004s

$ (cd ~/build/gcc-x86_64-unknown-linux-gnu/gcc && ./xgcc -B./ -O3 ~/pr30801.c
-m32 -march=pentium4 && time ./a.out)
064069fbc13963b920219c3e939225e38e38e38e3956d81c71c71c71c0ba0f00

real    0m1.488s
user    0m1.484s
sys     0m0.004s

So GCC 4.3 is 22 % faster with just the default -m64 + no -march and an
impressive 50 % faster with -m32 -march=pentium4.


-- 


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


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

* [Bug target/30801] [4.3 Regression] performance regression on uint64_t operations
  2007-02-14 23:21 [Bug middle-end/30801] New: 4.3 performance regression on uint64_t operations fxcoudert at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-10-25 18:58 ` rask at gcc dot gnu dot org
@ 2007-11-07 16:35 ` rask at gcc dot gnu dot org
  2007-11-07 16:49 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: rask at gcc dot gnu dot org @ 2007-11-07 16:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rask at gcc dot gnu dot org  2007-11-07 16:35 -------
Francois-Xavier, do you still see a performance regression? If so, please post
asm output (-S -dp) from both versions?


-- 

rask at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rask at gcc dot gnu dot org


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


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

* [Bug target/30801] [4.3 Regression] performance regression on uint64_t operations
  2007-02-14 23:21 [Bug middle-end/30801] New: 4.3 performance regression on uint64_t operations fxcoudert at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-11-07 16:35 ` rask at gcc dot gnu dot org
@ 2007-11-07 16:49 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-11-07 16:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2007-11-07 16:49 -------
No, I don't see it any more.


-- 

fxcoudert at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2007-11-07 16:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-14 23:21 [Bug middle-end/30801] New: 4.3 performance regression on uint64_t operations fxcoudert at gcc dot gnu dot org
2007-02-14 23:21 ` [Bug middle-end/30801] " fxcoudert at gcc dot gnu dot org
2007-02-14 23:26 ` [Bug target/30801] " pinskia at gcc dot gnu dot org
2007-02-14 23:26 ` pinskia at gcc dot gnu dot org
2007-09-11 11:52 ` [Bug target/30801] [4.3 Regression] " jsm28 at gcc dot gnu dot org
2007-10-10 17:44 ` mmitchel at gcc dot gnu dot org
2007-10-25 18:58 ` rask at gcc dot gnu dot org
2007-11-07 16:35 ` rask at gcc dot gnu dot org
2007-11-07 16:49 ` fxcoudert 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).