Discussion:
[wwwdocs] Typo in description of __builtin_expect_with_probability
Alexander Oblovatniy
2018-10-30 02:56:38 UTC
Permalink
Hello,

I'd like to report a typo in description of
«__builtin_expect_with_probability»:
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#Other-Builtins

The description starts with "The built-in has same semantics as
*__builtin_expect_with_probability*", but it seems like *__builtin_expect*
should be there.

Thanks!
Martin Liška
2018-10-30 08:29:16 UTC
Permalink
Post by Alexander Oblovatniy
Hello,
I'd like to report a typo in description of
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#Other-Builtins
The description starts with "The built-in has same semantics as
*__builtin_expect_with_probability*", but it seems like *__builtin_expect*
should be there.
Thanks for reporting the issue. It's fixed as r265615.

Martin
Post by Alexander Oblovatniy
Thanks!
Rasmus Villemoes
2018-10-30 09:18:14 UTC
Permalink
Post by Martin Liška
Post by Alexander Oblovatniy
Hello,
I'd like to report a typo in description of
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#Other-Builtins
The description starts with "The built-in has same semantics as
*__builtin_expect_with_probability*", but it seems like *__builtin_expect*
should be there.
Thanks for reporting the issue. It's fixed as r265615.
Other issues around the same place: "expected probability (in percent)"
seems to contradict "valid values are in inclusive range 0.0f and 1.0f".
The prototype is listed as

(long exp, long c, long probability)

contradicting the prose "Last argument probability is of float type".
So, should probability be an integer in [0, 100], or a float in [0, 1]?

Rasmus
Rasmus Villemoes
2018-10-30 10:11:00 UTC
Permalink
Post by Rasmus Villemoes
Post by Martin Liška
Post by Alexander Oblovatniy
Hello,
I'd like to report a typo in description of
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#Other-Builtins
The description starts with "The built-in has same semantics as
*__builtin_expect_with_probability*", but it seems like *__builtin_expect*
should be there.
Thanks for reporting the issue. It's fixed as r265615.
Other issues around the same place: "expected probability (in percent)"
seems to contradict "valid values are in inclusive range 0.0f and 1.0f".
The prototype is listed as
(long exp, long c, long probability)
The testcases added alongside the new built-in use float arguments,
but the actual definition of the built-in seems to use a long double.
In

DEF_FUNCTION_TYPE_3 (BT_FN_LONG_LONG_LONG_DOUBLE,
BT_LONG, BT_LONG, BT_LONG, BT_DOUBLE)


doesn't the first LONG refer to the return type, so that the third
argument just has type double? Other than that, your suggested update
makes sense (provided it actually matches the implementation, which I
can't verify).
Jakub Jelinek
2018-10-30 10:14:01 UTC
Permalink
Post by Rasmus Villemoes
In
DEF_FUNCTION_TYPE_3 (BT_FN_LONG_LONG_LONG_DOUBLE,
BT_LONG, BT_LONG, BT_LONG, BT_DOUBLE)
doesn't the first LONG refer to the return type, so that the third
argument just has type double? Other than that, your suggested update
Yes. A long double argument would be BT_LONGDOUBLE or written as _LONGDOUBLE
in the name of the fn type.

Jakub
Martin Liška
2018-10-30 12:06:34 UTC
Permalink
Post by Rasmus Villemoes
Post by Martin Liška
Post by Alexander Oblovatniy
Hello,
I'd like to report a typo in description of
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#Other-Builtins
The description starts with "The built-in has same semantics as
*__builtin_expect_with_probability*", but it seems like *__builtin_expect*
should be there.
Thanks for reporting the issue. It's fixed as r265615.
Other issues around the same place: "expected probability (in percent)"
seems to contradict "valid values are in inclusive range 0.0f and 1.0f".
The prototype is listed as
(long exp, long c, long probability)
The testcases added alongside the new built-in use float arguments,
but the actual definition of the built-in seems to use a long double.
What does "user can provide expected probability (in percent) for
Don't you mean the probability that exp==c?
Also the grammar in the text needs several fixes.
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -12025,12 +12025,12 @@ when testing pointer or floating-point values.
@end deftypefn
@deftypefn {Built-in Function} long __builtin_expect_with_probability
Hi.

Thanks for rewording!

I guess we should use:
s/long double/double
-are in inclusive range 0.0f and 1.0f.
+range 0.0 to 1.0, inclusive.
@end deftypefn
That's definitely much better, can you pleas install it?

Thanks,
Martin
@deftypefn {Built-in Function} void __builtin_trap (void)
Loading...