public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tim at klingt dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/37367]  New: gcc-4.4 speed regression
Date: Thu, 04 Sep 2008 10:03:00 -0000	[thread overview]
Message-ID: <bug-37367-12873@http.gcc.gnu.org/bugzilla/> (raw)

using a small piece of code of a digital filter, i was trying to benchmark
several looping constructs. on x86_64 the following code was running 5% faster
with g++-4.3 than with g++-4.4:

float __attribute__ ((noinline)) bench_5(float * out_sample, int n)
{
    float b1 = std::cos(0.01);
    float y1 = 0;
    float y2 = 1;

    do
    {
        float y0 = b1 * y1 - y2;
        *out_sample++ = y0;
        --n;
    }
    while (__builtin_expect(n!=0, 1));
}

tim@thinkpad:~$ g++-4.3 -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-0ubuntu3'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.2 (Ubuntu 4.3.2-0ubuntu3) 

tim@thinkpad:~$ g++-4.4 -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../gcc-4.4-20080815/configure
--enable-languages=c,c++,fortran,objc,obj-c++ --enable-shared
--with-system-zlib --enable-mpfr --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/local/include/c++/4.4 --program-suffix=-4.4
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
Thread model: posix
gcc version 4.4.0 20080815 (experimental) (GCC) 

the command line to compile the code was:
g++ benchmarks/loop_benchmark.cpp -O3 -lrt -march=core2

the difference in the machine code is the order of two subl and leal
instructions:
*** 340,347 ****
        addq    $16, %rax
        cmpl    %r8d, %edx
        jb      .L61
-       subl    %r9d, %esi
        leal    0(,%r9,4), %eax
        mov     %eax, %eax
        addq    %rax, %rcx
        cmpl    %r9d, %r10d
--- 340,347 ----
        addq    $16, %rax
        cmpl    %r8d, %edx
        jb      .L61
        leal    0(,%r9,4), %eax
+       subl    %r9d, %esi
        mov     %eax, %eax
        addq    %rax, %rcx
        cmpl    %r9d, %r10d
***************

since i read that gcc-4.4 is supposed to be aimed at code optimization, i
thought it may be interesting to report it ...
the complete code can be found at http://tinyurl.com/5socts


-- 
           Summary: gcc-4.4 speed regression
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tim at klingt dot org


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


             reply	other threads:[~2008-09-04 10:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-04 10:03 tim at klingt dot org [this message]
2008-09-06 21:45 ` [Bug target/37367] [4.4 Regression] " pinskia at gcc dot gnu dot org
2008-10-22  3:07 ` mmitchel at gcc dot gnu dot org
2009-01-31 14:19 ` bonzini at gnu dot org
2009-01-31 14:33 ` rguenth at gcc dot gnu dot org
2009-02-05 22:03 ` rguenth at gcc dot gnu dot org
2009-04-21 16:00 ` [Bug target/37367] [4.4/4.5 Regression] gcc-4.4/4.5 " jakub at gcc dot gnu dot org
2009-07-22 10:33 ` jakub at gcc dot gnu dot org
2009-10-15 12:55 ` jakub at gcc dot gnu dot org
2010-01-21 13:18 ` jakub at gcc dot gnu dot org
2010-03-21 12:20 ` steven at gcc dot gnu dot org
2010-03-21 14:44 ` howarth at nitro dot med dot uc dot edu
2010-03-21 16:20 ` hjl dot tools at gmail dot com
2010-03-22 10:01 ` rguenther at suse dot de
2010-03-22 10:47 ` jakub at gcc dot gnu dot org
2010-03-22 10:49 ` jakub at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-37367-12873@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).