[PATCH v2] aarch64: add optimised strspn/strcspn

lhr@disroot.org lhr@disroot.org
Fri Aug 29 16:19:04 GMT 2025


> It works, but the real issue is skipping half a cacheline at the start which
> means you end up using more cachelines, and worse, they have to be
> fetched immediately at the start of the function. Without it the initial
> loop fits within the first cacheline, which is far better overall.
> 
> So'm happy with it without the nop/balign 32. That means there are
> just 2 executed NOPs in both strcspn and strspn.

Does that mean keeping the .balign 16 before the second loop?  Without
skipping half a cacheline at the beginning, that means the second loop will
have 2 instructions over the next cacheline boundary.  Either it takes 4
instruction fetches but fits in one cacheline, or it takes 3 fetches but 2
cachelines.  Is it worth optimising for the instruction fetch at the expense
of the cache?


More information about the Libc-alpha mailing list