> Richard Henderson wrote: > On 08/12/2015 08:59 AM, Wilco Dijkstra wrote: > > I looked at the statistics of AArch64 immediate generation a while ago. > > The interesting thing is ~95% of calls are queries, and the same query is on > > average repeated 10 times in a row. So (a) it is not important to cache the > > expansions, and (b) the high repetition rate means a single-entry cache > > has a 90% hitrate. We already have a patch for this and could collect stats > > comparing the approaches. If a single-entry cache can provide a similar > > benefit as caching all immediates then my preference would be to keep things > > simple and just cache the last query. > > Interesting. That's already more detailed investigation than I'd done. I had > no idea the queries were so clustered. I assumed that the queries would be > scattered across various passes, and so the various constants across the > function would get checked in sequence. > > I would be very interested in seeing those stats when you've done.
Caching improves average buildtime by 0.1-0.2% - your patch seems to be slightly faster than caching just 1 query, so that suggests caching a few entries would be beneficial. However looking at the immediates that are generated by the loops, it's feasible to avoid linear/quadratic search loops altogether. So I think a generic immediate caching scheme won't be useful for AArch64. Wilco