public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/63599] "wrong" branch optimization with Ofast in a loop
Date: Mon, 20 Oct 2014 09:17:00 -0000	[thread overview]
Message-ID: <bug-63599-4-PtCnbqm1hV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-63599-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63599

--- Comment #2 from vincenzo Innocente <vincenzo.innocente at cern dot ch> ---
I agree that the code produces correct results. It looks to me  sub-optimal.
I understand that with Ofast the sequence below will be always executed

    andps    %xmm5, %xmm8
    rcpps    %xmm3, %xmm0
    mulps    %xmm0, %xmm3
    mulps    %xmm0, %xmm3
    addps    %xmm0, %xmm0
    subps    %xmm3, %xmm0
    mulps    %xmm0, %xmm1
    movaps    %xmm2, %xmm0
    cmpleps    %xmm4, %xmm0
    blendvps    %xmm0, %xmm2, %xmm1

while with O2 it will not.
and this generates a performance penalty for samples where the test is often
false.
( I tried to add __builtin_expect(x, false) with no effect. )


  parent reply	other threads:[~2014-10-20  9:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-20  7:35 [Bug tree-optimization/63599] New: " vincenzo.innocente at cern dot ch
2014-10-20  7:39 ` [Bug target/63599] " pinskia at gcc dot gnu.org
2014-10-20  9:17 ` vincenzo.innocente at cern dot ch [this message]
2014-10-20 10:07 ` glisse at gcc dot gnu.org
2014-10-20 17:29 ` jakub at gcc dot gnu.org
2024-03-12 23:06 ` pinskia at gcc dot gnu.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-63599-4-PtCnbqm1hV@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).