public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/56309] -O3 optimizer generates conditional moves instead of compare and branch resulting in almost 2x slower code
Date: Fri, 15 Feb 2013 09:33:00 -0000	[thread overview]
Message-ID: <bug-56309-4-k43fwmIC10@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56309-4@http.gcc.gnu.org/bugzilla/>


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

--- Comment #23 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-15 09:33:22 UTC ---
(In reply to comment #20)
> (In reply to comment #12)
> > --- by-val-O3.s.orig    2013-02-14 18:06:56.000000000 +0100
> > +++ by-val-O3.s 2013-02-14 18:07:23.000000000 +0100
> > @@ -357,9 +357,8 @@
> >         shrq    $32, %rdi
> >         cmpq    %r8, %rdx
> >         cmovbe  %r11, %rdi
> > -       addq    $1, %rax
> > -       cmpq    %r8, %rdx
> >         cmovbe  %rdx, %rcx
> > +       addq    $1, %rax
> >         cmpq    %rbp, %rax
> >         movq    %rcx, -8(%rsi,%rax,8)
> >         jne     .L50
> > 
> > unmodified: Took 14.31 seconds total.
> > modified:   Took 13.04 seconds total.
> > 
> > So re. comment #9: it's not the problem but it'd be a small improvement.
> 
> FWIW this comes from not eliminating the condition expression in
> the conditional moves that ifcvt creates:
> 
>   tmp_97 = tmp_93 > 4294967295 ? tmp_95 : tmp_93;
>   carry_105 = tmp_93 > 4294967295 ? carry_94 : 0;
> 
> I'm surprised this form is allowed at all, I'd expect we only allow
> is_gimple_reg() for a COND_EXPR_COND in a RHS context.

Yeah, it's on my list (even with partial patches available ...).
Note that then vectorizing a COND_EXPR is not different from being
able to vectorize a comparison statement.

   pred_2 = tmp_93 > 4294967295;
   tmp_97 = pred_2 ? tmp_95 : tmp_93;
   carry_105 = pred_2 ? carry_94 : 0;

this form, both vectorized and not vectorized has issues when doing
initial instruction selection during expand (with multiple uses of
pred_2 we don't TER it).  So it might be that we present combine and
other RTL optimizers with initial code they will not be able to handle
as well as what we do right now.

> Anyway -- separate problem.

Indeed.


  parent reply	other threads:[~2013-02-15  9:33 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-13 20:21 [Bug middle-end/56309] New: " arturomdn at gmail dot com
2013-02-13 20:23 ` [Bug middle-end/56309] " arturomdn at gmail dot com
2013-02-13 20:26 ` [Bug target/56309] " pinskia at gcc dot gnu.org
2013-02-13 20:29 ` arturomdn at gmail dot com
2013-02-14  8:16 ` ubizjak at gmail dot com
2013-02-14  8:22 ` ubizjak at gmail dot com
2013-02-14  8:28 ` ubizjak at gmail dot com
2013-02-14 14:49 ` ysrumyan at gmail dot com
2013-02-14 15:53 ` arturomdn at gmail dot com
2013-02-14 16:01 ` arturomdn at gmail dot com
2013-02-14 16:44 ` arturomdn at gmail dot com
2013-02-14 16:59 ` steven at gcc dot gnu.org
2013-02-14 17:10 ` steven at gcc dot gnu.org
2013-02-14 17:26 ` [Bug tree-optimization/56309] " steven at gcc dot gnu.org
2013-02-14 17:31 ` arturomdn at gmail dot com
2013-02-14 17:34 ` ubizjak at gmail dot com
2013-02-14 17:43 ` arturomdn at gmail dot com
2013-02-14 17:50 ` ubizjak at gmail dot com
2013-02-14 18:23 ` ubizjak at gmail dot com
2013-02-14 18:35 ` [Bug target/56309] " ubizjak at gmail dot com
2013-02-14 22:18 ` steven at gcc dot gnu.org
2013-02-15  6:50 ` izamyatin at gmail dot com
2013-02-15  7:15 ` jakub at gcc dot gnu.org
2013-02-15  9:33 ` rguenth at gcc dot gnu.org [this message]
2013-02-15  9:36 ` rguenth at gcc dot gnu.org
2013-02-17  8:35 ` [Bug target/56309] conditional moves instead of compare and branch result " ubizjak at gmail dot com
2013-02-17  8:38 ` ubizjak at gmail dot com
2013-02-17 10:10 ` ubizjak at gmail dot com
2013-09-22  6:37 ` icegood1980 at gmail dot com
2013-10-18  9:12 ` jakub at gcc dot gnu.org
2013-10-18 10:06 ` ubizjak at gmail dot com
2015-08-06  9:35 ` ysrumyan at gmail dot com
2021-09-04 20:24 ` peter at cordes dot ca
2021-09-04 20:26 ` peter at cordes dot ca

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-56309-4-k43fwmIC10@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).