On Oct 2, 2012, at 12:48 AM, Ryosuke Niwa <rn...@webkit.org> wrote:

> On Tue, Oct 2, 2012 at 12:17 AM, Mike Lawther <mikelawt...@google.com> wrote:
> 
> On 2 October 2012 16:29, Maciej Stachowiak <m...@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@lists.webkit.org
> http://lists.webkit.org/mailman/listinfo/webkit-dev

_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-dev

Reply via email to