[V2] riscv: Implement Zbb based strlen and prefer it over the RVV based strlen implementation when Zbb is available
Florian Weimer
fweimer@redhat.com
Sun Jul 5 12:20:52 GMT 2026
* Jeffrey Law:
> I'm seeing some really weird results and I wish camel-cdr had data on
> a Zbb implemenation to correlate against -- his data has been
> incredibly helpful in confirming the vector behavior as well as the
> generic implementation behavior. But he didn't have a zbb variant.
>
> Basically it appears yours is meaningfully slower for small strings.
> It starts off about 50% slower, but closes the gap for each 2^n length
> bucket. The crossover point is around 128 bytes after which it blows
> away the other zbb variant -- it was still widening the gap at the 8k
> bucket where it was about 60% faster. *BUT* the loop itself is
> unchanged and while it appears there's one less architectural register
> in use, I'd be amazed if that one register was enough to make this
> kind of difference at the uarch level.
Hmm, maybe it's not working correctly and incorrectly returning early?
As I said, it's untested. Or maybe it's related to the .p2align?
The dependency chains should be equal or shorter even for short strings,
so the regression is surprising. And the loop really should not get any
faster.
Thanks,
Florian
More information about the Libc-alpha
mailing list