[webkit-dev] Time to remove LIKELY and UNLIKELY macros?
Filip Pizlo
fpizlo at apple.com
Tue Oct 2 00:49:46 PDT 2012
On Oct 2, 2012, at 12:48 AM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> On Tue, Oct 2, 2012 at 12:17 AM, Mike Lawther <mikelawther at google.com> wrote:
>
> On 2 October 2012 16:29, Maciej Stachowiak <mjs at apple.com> wrote:
>
> Note, despite the stackoverflow thread cited, I would be highly surprised if static branch predicition had no effect ever, even on modern architectures. While recent intel CPUs have very good dynamic branch prediction, the basic block reordering should still have a significant impact in some cases due to cache effects.
>
> Aside: interestingly, the Core2 family of CPUs doesn't do 'static branch prediction' in the traditional sense. When they encounter a branch not already in the BTB, a BTB index is assigned to it. The prediction now proceeds as though it were dynamic - meaning that this first time, it predicts based on the previous data in that index. That is, it's effectively a 50% chance of taken/not taken the first time the branch is encountered (source: http://www.agner.org/optimize/microarchitecture.pdf, Section 3.15).
>
> Strange. I still observed ~10% performance gain from adding LIKELY/UNLIKELY on Westmere.
Two reasons: code placement (i.e. icache behavior) and register allocation.
-F
>
> - Ryosuke
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo/webkit-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20121002/54b85360/attachment.html>
More information about the webkit-dev
mailing list