public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redbeard0531 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/113682] Branches in branchless binary search rather than cmov/csel/csinc
Date: Thu, 01 Feb 2024 13:52:37 +0000	[thread overview]
Message-ID: <bug-113682-4-afCkNaHA5X@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113682-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Mathias Stearn <redbeard0531 at gmail dot com> ---
(In reply to Andrew Pinski from comment #2)
> I should note that on x86, 2 cmov in a row might be an issue and worse than
> branches. There is a cost model and the x86 backend rejects that.
> 
> There are some cores where it is worse. I don't know if it applies to recent
> ones though.

Do you know if that applies to any cores that support x86_64? I checked Agner
Fog's tables, and only very very old cores (P4 era) had high reciprocal
throughput, but even then it was less than latency. It looks like all AMD cores
and intel cores newer than ivy bridge (ie everything from the last 10 years)
are able to execute multiple CMOVs per cycle (reciprocal throughput < 1). From
what I can see, it looks like bad CMOV was a particular problem of the Pentium
4 and Prescott cores, and possibly PPro, but I don't see the numbers for it. I
don't think any of those cores should have an impact on the default cost model
in 2024.

  parent reply	other threads:[~2024-02-01 13:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31 13:48 [Bug other/113682] New: " redbeard0531 at gmail dot com
2024-01-31 14:16 ` [Bug rtl-optimization/113682] " rguenth at gcc dot gnu.org
2024-01-31 16:53 ` pinskia at gcc dot gnu.org
2024-01-31 18:00 ` [Bug middle-end/113682] " pinskia at gcc dot gnu.org
2024-02-01 10:30 ` tnfchris at gcc dot gnu.org
2024-02-01 13:52 ` redbeard0531 at gmail dot com [this message]
2024-02-02  1:04 ` pinskia at gcc dot gnu.org
2024-04-02 17:46 ` [Bug rtl-optimization/113682] " tnfchris at gcc dot gnu.org
2024-04-02 18:01 ` pinskia at gcc dot gnu.org
2024-04-03 11:10 ` tnfchris 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-113682-4-afCkNaHA5X@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).