On 10/28/25 1:31 PM, Andrew MacLeod wrote:


I added a chunk to print the range being returned.    With your path ranger, R is [irange] BITMAP_WORD [1, +INF]  , which I assuem si the value you are looking for?
Yea, we just need to know the value is nonzero. Essentially the loop doesn't terminate if presented with a zero value and thus transformation into a ctz instruction wouldn't be appropriate. Once we prove the value is known to be nonzero, then we zap the loop entirely and replace it with a ctz. The loop branch happens to be the single biggest source of branch mispredicts for 502.gcc input #2 on our design (and probably others given there really isn't a pattern for a branch predictor to lock onto).

Jeff


Reply via email to