public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/57051] New: Optimization regression in 4.8.0 from 4.7.2
@ 2013-04-23 16:25 tony.howard-co84udjx at yopmail dot com
  2013-04-24  8:10 ` [Bug tree-optimization/57051] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: tony.howard-co84udjx at yopmail dot com @ 2013-04-23 16:25 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 57051
           Summary: Optimization regression in 4.8.0 from 4.7.2
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tony.howard-co84udjx@yopmail.com


The problem can be exhibited using the following snippet of code:

/* begin */
int total = 0;


inline void foo(int bar)
{
   total += bar*10;
}

void hello()
{
   for(int i = 0; i < 10; ++i)
   {
      foo(i);
   }
}
/* end */

With the option -O3,
gcc 4.7.2 and previous versions produce the following assembly code:
hello():
    addl    $450, total(%rip)
    ret

gcc 4.8.0 fails to optimize the code:
hello():
    movdqa    .LC0(%rip), %xmm0
    movdqa    %xmm0, %xmm2
    psrldq    $8, %xmm2
    paddd    %xmm2, %xmm0
    movdqa    %xmm0, %xmm3
    psrldq    $4, %xmm3
    paddd    %xmm3, %xmm0
    movdqa    %xmm0, %xmm4
    movd    %xmm4, -12(%rsp)
    movl    -12(%rsp), %eax
    addl    total(%rip), %eax
    addl    $170, %eax
    movl    %eax, total(%rip)
    ret


The results can be easily reproduced using http://gcc.godbolt.org/

The 4.7.2's configure options are:
Target: x86_64-linux-gnu

Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.7.2-11precise2' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu

The 4.8.0's configure options are:
Target: x86_64-linux-gnu

Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.8.0-3ubuntu3~12.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --enable-objc-gc --enable-multiarch --disable-werror
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu

The problem is not linked to Linaro or Ubuntu patches as it can be reproduced
as well on a stock version of gcc 4.8.0


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

end of thread, other threads:[~2013-05-17 12:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-23 16:25 [Bug c/57051] New: Optimization regression in 4.8.0 from 4.7.2 tony.howard-co84udjx at yopmail dot com
2013-04-24  8:10 ` [Bug tree-optimization/57051] " mpolacek at gcc dot gnu.org
2013-04-24  8:30 ` [Bug tree-optimization/57051] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2013-04-24 10:44 ` jakub at gcc dot gnu.org
2013-04-26 13:17 ` jakub at gcc dot gnu.org
2013-05-03 13:57 ` [Bug tree-optimization/57051] [4.8 " jakub at gcc dot gnu.org
2013-05-03 14:00 ` [Bug tree-optimization/57051] " jakub at gcc dot gnu.org
2013-05-06 11:55 ` rguenth at gcc dot gnu.org
2013-05-17 12:27 ` jakub 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).