[llvm-bugs] [Bug 39469] New: Support "__builtin_expect_with_probability" (C/C++)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 28 02:58:59 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=39469

            Bug ID: 39469
           Summary: Support "__builtin_expect_with_probability" (C/C++)
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: haneef503 at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

The next GCC includes support for a new builtin ` ` [1] that is similar to
`__builtin_expect()`, except with support for real probabilities:


> (long exp, long c, long probability)

> The built-in has same semantics as __builtin_expect_with_probability,
> but user can provide expected probability (in percent) for value of exp.
> Last argument probability is of float type and valid values are in
> inclusive range 0.0f and 1.0f.

This builtin is useful in that it allows better specification of branch
probabilities, which in theory should be able to be used to make more informed
decisions regarding code block generation and organization.


[1]:
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005fexpect_005fwith_005fprobability

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181028/7a355e8b/attachment.html>


More information about the llvm-bugs mailing list