>On 8/5/25 19:43, Richard Henderson wrote: >> That said, I'm a little confused >> why we'd want to use SUBS+B.{EQ,NE} instead of SUB+CB{Z,NZ}. > > The answer to that is that B.{EQ,NE} converts easily to CSEL/CSINC/CSINV.
I did it originally because that works out best - CBZ has a shorter branch range and was not efficient on all micro architectures at the time. It's possible that doing it differently works out better today - immediate generation is far more advanced now, CBZ is fast on all microarchitectures, and it may be that eg. something like: mov x0, imm16 cmp x1, x0, lsl 4 could be used in many cases. Interestingly I don't see it trigger even in basic examples, so the pattern may have bitrotted already... Cheers, Wilco