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 21:30:48 GMT 2026



On 6/11/2026 1:51 PM, Adhemerval Zanella Netto wrote:
> Did you check the generic implementation? Both 3d6fcf1bd7f462d333c36a14efc0e03f2fdd3f9e
> and 4c966c078036abe0e36bd86c9eaeb4501e552977 added zbb handling, so building with
> -march=rv64imafdc_zbb -mabi=lp64d with gcc-16 I see:
It included the generic, but I didn't build with flags that would have 
flipped Zbb on.

[ ... ]

> The ASM version seems to have an extra cost of li/sub valid-bytes setup, longer
> first-word path, and the alignment padding nops.  I would guess both would have
> similar performance profiles.
Yea, I would expect largely similar.

>
> And there is another question if adding a zbb sysdep is really a good move here.
> My understanding is chip produces and distros are moving to RVA23U64/RVA23S64,
> which implies in zbb and thus you can select it without the need to add an
> specific implementation.
While I would *love* to see everyone settle on rva23, but I'm highly 
skeptical based on my conversations with distros and others.

Jeff


More information about the Libc-alpha mailing list