public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/110007] New: Implement support for Clang’s __builtin_unpredictable()
@ 2023-05-27 17:54 richard.yao at alumni dot stonybrook.edu
  2023-05-27 17:59 ` [Bug c/110007] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: richard.yao at alumni dot stonybrook.edu @ 2023-05-27 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110007
           Summary: Implement support for Clang’s
                    __builtin_unpredictable()
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richard.yao at alumni dot stonybrook.edu
  Target Milestone: ---

Having the ability to specify __builtin_unpredictable() as a hint to encourage
the compiler to use cmov would be useful for implementing algorithms like
binary search that have unpredictable branches.
__builtin_expect_with_probability() looks like a possible substitute, but Clang
does not support it and it does not always work as described in #110001.

Combining this with C’s ternary operator should make the proposed cmov builtin
from #98801 unnecessary.

Note that while clang implements __builtin_unpredictable(), it does not
currently pass that information to the backend:

https://github.com/llvm/llvm-project/issues/62790#issuecomment-1552671099

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-05-30  7:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-27 17:54 [Bug c/110007] New: Implement support for Clang’s __builtin_unpredictable() richard.yao at alumni dot stonybrook.edu
2023-05-27 17:59 ` [Bug c/110007] " pinskia at gcc dot gnu.org
2023-05-27 18:01 ` pinskia at gcc dot gnu.org
2023-05-27 18:19 ` richard.yao at alumni dot stonybrook.edu
2023-05-27 18:25 ` pinskia at gcc dot gnu.org
2023-05-27 20:26 ` richard.yao at alumni dot stonybrook.edu
2023-05-28  5:42 ` amonakov at gcc dot gnu.org
2023-05-28 16:21 ` hubicka at gcc dot gnu.org
2023-05-28 21:37 ` richard.yao at alumni dot stonybrook.edu
2023-05-30  7:49 ` rguenth at gcc dot gnu.org

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).