riscv: Implement Zbb based strlen and prefer it over the RVV based strlen implementation when Zbb is available

Jeffrey Law jeffrey.law@oss.qualcomm.com
Thu Jun 11 14:00:55 GMT 2026



On 6/10/2026 10:09 PM, Jeffrey Law wrote:
>
> So we've had Zbb variants for strlen, strcmp and a few other routines 
> sitting here in our local repositories for a long time. The original 
> implementations were done by the VRULL team, then adjusted for minor 
> bugs caught by the glibc testsuite and later wired into the hwprobe 
> mechanism.
[ ... ]
So a follow-up on the K1 performance behavior.  Again Zbb wins across 
the board, though the size of the win is much smaller.  For really short 
strings it's about 2.4x faster and the gap closes to 1.2x by the time 
we're doing strings of > 64 bytes.

What's kind of interesting is as we get into the 32-63 length bucket the 
performance of Zbb and RVV is nearly identical.  That's also where RVV 
made its best showing on the K3, though it never caught Zbb.  Regardless 
Zbb is a clear win on the K1 design.

jeff


More information about the Libc-alpha mailing list