public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/23322] [4.1/4.2/4.3 regression] performance regression, possibly related to caching
Date: Thu, 13 Dec 2007 14:10:00 -0000	[thread overview]
Message-ID: <20071213141026.15089.qmail@sourceware.org> (raw)
In-Reply-To: <bug-23322-10914@http.gcc.gnu.org/bugzilla/>



------- Comment #9 from ubizjak at gmail dot com  2007-12-13 14:10 -------
Reduced c++ testcase that is the cause of the runtime difference:

--cut here--
#include <iostream>

extern double *dpb;

void s000005m_test(void)
{
  double result = 0.0;

  for (int n = 0; n < 2000; ++n)
    result += dpb[n];

#ifdef FUBAR
    std::cerr << "Blah" << result << std::endl;
#else
    std::cerr << result << std::endl;
#endif
}
--cut here--

g++ -O2:

        ...
.LCFI8:
        movl    dpb, %edx       # dpb, dpb.68
        fldz
.L4:
        faddl   (%edx,%eax,8)   #* dpb.68
        addl    $1, %eax        #, n
        cmpl    $2000, %eax     #, n
        jne     .L4     #,
        fstpl   4(%esp) #
        movl    $_ZSt4cerr, (%esp)      #,
        call    _ZNSo9_M_insertIdEERSoT_        #
        ...

g++ -O2 -DFUBAR:

        ...
.LCFI8:
        movl    dpb, %edx       # dpb, dpb.68
        fldz
        fstpl   -288(%ebp)      # result
        .p2align 4,,7
        .p2align 3
.L4:
        fldl    -288(%ebp)      # result
        faddl   (%edx,%eax,8)   #* dpb.68
        addl    $1, %eax        #, n
        cmpl    $2000, %eax     #, n
        fstpl   -288(%ebp)      # result
        jne     .L4     #,
        movl    $4, 8(%esp)     #,
        movl    $.LC1, 4(%esp)  #,
        movl    $_ZSt4cerr, (%esp)      #,
        call   
_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i  
#
        movl    $_ZSt4cerr, (%esp)      #,
        fldl    -288(%ebp)      # result
        fstpl   4(%esp) #
        call    _ZNSo9_M_insertIdEERSoT_        #
        ...

Please see what happens to "result" variable in -DFUBAR case.

Similar effect happens for -mfpmath=sse, but postreload gcse eliminates the
load (but not the store) from the loop (stack regs are not gcse'd after reload
by design). IMO, this is not target dependant, but pure RA problem.


-- 


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


  parent reply	other threads:[~2007-12-13 14:10 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-23322-10914@http.gcc.gnu.org/bugzilla/>
2005-10-31  4:49 ` [Bug target/23322] [4.1 " mmitchel at gcc dot gnu dot org
2006-02-24  0:30 ` [Bug target/23322] [4.1/4.2 " mmitchel at gcc dot gnu dot org
2006-05-25  2:34 ` mmitchel at gcc dot gnu dot org
2006-08-27 18:46 ` pinskia at gcc dot gnu dot org
2007-02-14  9:06 ` [Bug target/23322] [4.1/4.2/4.3 " mmitchel at gcc dot gnu dot org
2007-12-13 14:10 ` ubizjak at gmail dot com [this message]
2007-12-13 14:13 ` ubizjak at gmail dot com
2007-12-13 14:24 ` ubizjak at gmail dot com
2007-12-13 14:36 ` rguenth at gcc dot gnu dot org
2007-12-13 14:43 ` rguenth at gcc dot gnu dot org
2007-12-13 14:54 ` rguenth at gcc dot gnu dot org
2007-12-13 15:00 ` rguenth at gcc dot gnu dot org
2007-12-13 15:42 ` [Bug target/23322] [4.1/4.2/4.3 regression] performance regression: global regalloc doesn't split live ranges ubizjak at gmail dot com
2008-02-05 16:19 ` hubicka at gcc dot gnu dot org
2008-02-05 16:25 ` [Bug target/23322] [4.1/4.2/4.3 regression] performance regression hubicka at gcc dot gnu dot org
2008-02-05 18:26 ` ubizjak at gmail dot com
2008-02-05 22:51 ` hubicka at gcc dot gnu dot org
2008-02-05 23:54 ` hubicka at gcc dot gnu dot org
2008-02-06  6:52 ` ubizjak at gmail dot com
2008-02-06  9:01 ` steven at gcc dot gnu dot org
2008-02-06 11:27 ` hubicka at gcc dot gnu dot org
2008-02-06 11:31 ` hubicka at gcc dot gnu dot org
2008-02-06 11:43 ` steven at gcc dot gnu dot org
2008-02-06 11:55 ` hubicka at gcc dot gnu dot org
2008-02-06 15:10 ` hubicka at gcc dot gnu dot org
2008-02-08 14:55 ` hubicka at gcc dot gnu dot org
2008-02-11  9:24 ` hubicka at gcc dot gnu dot org
2008-07-04 20:02 ` [Bug target/23322] [4.2/4.3/4.4 " jsm28 at gcc dot gnu dot org
2009-02-03 16:16 ` bonzini at gnu dot org
2009-02-03 16:16 ` bonzini at gnu dot org
2009-02-08 11:32 ` hubicka at gcc dot gnu dot org
2009-02-12 13:43 ` ubizjak at gmail dot com
2009-03-31 18:55 ` [Bug target/23322] [4.3/4.4/4.5 " jsm28 at gcc dot gnu dot org
2009-04-16 16:22 ` [Bug target/23322] [4.3 " pinskia at gcc dot gnu dot org
2009-04-22 15:11 ` rguenth 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=20071213141026.15089.qmail@sourceware.org \
    --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).