public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jeffhurchalla at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/98801] Request for a conditional move built-in function
Date: Wed, 27 Jan 2021 05:18:47 +0000	[thread overview]
Message-ID: <bug-98801-4-puJIb39NkK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98801-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Jeff Hurchalla <jeffhurchalla at gmail dot com> ---
It might be good to ignore my suggestion to satisfy security needs - if for no
other reason than I can't speak well to those needs.  I get the sense crypto's
need to avoid optimizations can be complicated, for example
https://lists.llvm.org/pipermail/llvm-dev/2019-September/135079.html

( Interestingly, the writer mentioned there exists a non-upstreamed patch for
clang/llvm that has an intrinsic called __builtin_ct_choose, which provides a
guaranteed constant time conditional select.  See
https://www.computer.org/csdl/pds/api/csdl/proceedings/download-article/12OmNqJZgIG/pdf
)

So I'd limit my request to a conditional move builtin, just motivated by desire
for performance in situations where a predicate is unpredictable.

FYI, clang's __built_unpredictable seems suitable at first, but it's not as
good as it seems.  It's a hint that doesn't always survive optimization passes,
which puts it in the same category as the ternary operator idiom.  Any change
to compiler flags or version means rechecking generated assembly, which is
awkward even the first time.

  parent reply	other threads:[~2021-01-27  5:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-23  4:47 [Bug c++/98801] New: " jeffhurchalla at gmail dot com
2021-01-23  6:53 ` [Bug c++/98801] " pinskia at gcc dot gnu.org
2021-01-23 19:37 ` jeffhurchalla at gmail dot com
2021-01-23 20:28 ` jeffhurchalla at gmail dot com
2021-01-25  9:36 ` [Bug middle-end/98801] " rguenth at gcc dot gnu.org
2021-01-25 19:19 ` peter at cordes dot ca
2021-01-26  0:17 ` jeffhurchalla at gmail dot com
2021-01-27  5:18 ` jeffhurchalla at gmail dot com [this message]
2023-05-27 17:56 ` richard.yao at alumni dot stonybrook.edu

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-98801-4-puJIb39NkK@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).