Question x86 vs M1 branch predictor

Jul 27, 2020
26,210
18,054
146
Branch predictor: How many "if"s are too many? Including x86 and M1 benchmarks! (cloudflare.com)

On x86 the hot code needs to split the BTB budget between function calls and taken branches. The BTB has only a size of 4096 entries. There are strong benefits in keeping the hot code under 16KiB.

On the other hand on M1 the BTB seems to be limited by L1 instruction cache. If you're writing super hot code, ideally it should fit 4KiB.

Anyone know if these tests have been done for the recent CPUs (M2 / Zen 4 / Raptor Lake)?
 

Doug S

Diamond Member
Feb 8, 2020
3,332
5,814
136
Not sure if he has updated it since this version or is going to devote this amount of effort to M2, but @name99 (with help from other contributors) has one heck of a detailed writeup on M1 here.
 
  • Like
Reactions: Tlh97 and Viknet