[Bug c/42621] New: 4.4/4.5 Regression, Computed gotos on AMD 800% slower

2010-01-05 Thread fredrik dot svahn at gmail dot com
   

  not_implemented: 
fail_op = 8; //exit
goto handle_fail;

  exit:
return -1;


  handle_fail: 
goto *ops[fail_op];
}


-- 
   Summary: 4.4/4.5 Regression, Computed gotos on AMD 800% slower
   Product: gcc
   Version: 4.4.2
Status: UNCONFIRMED
  Severity: normal
      Priority: P3
     Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fredrik dot svahn at gmail dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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



[Bug rtl-optimization/42621] [4.4/4.5 Regression] Computed gotos on AMD 800% slower

2010-01-06 Thread fredrik dot svahn at gmail dot com


--- Comment #5 from fredrik dot svahn at gmail dot com  2010-01-06 11:36 
---
Thanks for the quick patch! 

Unfortunately it only works for me with option "-march=athlon64"? Is this
intentional ("-march" is not needed for gcc-4.3)? 

Am I doing something wrong?

$ gcc-4.3 -v && /opt/gcc/bin/gcc-4.4.2-new -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr --enable-shared
--enable-languages=c,c++ --enable-threads=posix --mandir=/usr/share/man
--infodir=/usr/share/info --enable-__cxa_atexit --disable-multilib
--libdir=/usr/lib --libexecdir=/usr/lib --enable-clocale=gnu
--disable-libstdcxx-pch --with-tune=generic --disable-werror
--enable-checking=release --program-suffix=-4.3
--enable-version-specific-runtime-libs
Thread model: posix
gcc version 4.3.3 (GCC) 
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.4.2/configure --prefix=/opt/gcc --enable-shared
--enable-languages=c,c++ --enable-threads=posix --mandir=/usr/share/man
--infodir=/usr/share/info --enable-__cxa_atexit --disable-multilib
--libdir=/usr/lib --libexecdir=/usr/lib --enable-clocale=gnu
--disable-libstdcxx-pch --with-tune=generic --disable-werror
--enable-checking=release --program-suffix=-4.4.2-new
--enable-version-specific-runtime-libs
Thread model: posix
gcc version 4.4.2 (GCC)

$ gcc-4.3 -g -O3 test.c -o testp.4.3 &&  /opt/gcc/bin/gcc-4.4.2-new -g -Wall
-O3  test.c -o testp.4.4.2 
$ time ./testp.4.3 && time ./testp.4.4.2 

real0m0.889s
user0m0.880s
sys 0m0.000s

real0m4.043s
user0m4.036s
sys 0m0.003s
$ gcc-4.3 -g -O3 test.c -o testp.4.3 &&  /opt/gcc/bin/gcc-4.4.2-new -g -Wall
-march=athlon64 -O3  test.c -o testp.4.4.2 
$ time ./testp.4.3 && time ./testp.4.4.2 

real0m0.888s
user0m0.880s
sys 0m0.000s

real0m0.638s
user0m0.627s
sys 0m0.003s


-- 


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



[Bug rtl-optimization/42621] [4.4/4.5 Regression] Computed gotos on AMD 800% slower

2010-01-06 Thread fredrik dot svahn at gmail dot com


--- Comment #6 from fredrik dot svahn at gmail dot com  2010-01-06 11:44 
---
I will try to distclean and rebuild from scratch to confirm my statement above.


-- 

fredrik dot svahn at gmail dot com changed:

   What|Removed |Added

 CC||fredrik dot svahn at gmail
   ||dot com


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



[Bug rtl-optimization/42621] [4.4/4.5 Regression] Computed gotos on AMD 800% slower

2010-01-06 Thread fredrik dot svahn at gmail dot com


--- Comment #7 from fredrik dot svahn at gmail dot com  2010-01-06 23:00 
---
Summary:
The patch works great when building gcc from trunk (revision 155680). Both
supplied test program and real application are optimized.

With gcc-4.4.2 I get the optimization for the test program only with e.g.
-march=athlon64 or -mtune=native (which is an improvement, previously I could
not get it to work even with these options). Without -mtune/-march optimization
seems to bail out on the following check in
bb-reorder.c@@duplicate_computed_gotos(void):

  /* Obviously the block has to end in a computed jump.  */
  if (!computed_jump_p (BB_END (bb)))
continue;

I assume the patch was written for 4.5 so maybe testing it on 4.4.2 is a bit
premature. Hope it helps anyway.


-- 


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