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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Daniel Fruzynski from comment #3)
> Created attachment 42980 [details]
> Benchmark
> 
> Here is benchmark for this case. With unlikely() execution time decreases
> from 20.5sec to 20.3sec - about 1%. For my real app change it was a bit more
> than 2%.

Thanks for the micro-benchmark.

> 
> Thanks for information about this parameter, I will give it a try. So far I
> noticed that gcc uses CMOV when values are stored in registers. When they
> are in memory as a class fields, it generates code with branches. I am still
> playing with this code, so maybe I will need it later.
> 
> BTW, what do you thing about adding 3rd param to __builtin_expect, which
> will specify probability? It may be helpful in cases like mine.

Well I haven't thought about it. From implementation point of view it will be
simple. But usage can be then a bit complicated.

Thoughts?

Reply via email to