[EXT] [PATCH 1/1] riscv: Add Zbkb optimized repeat_bytes helper

Peter Bergner bergner@tenstorrent.com
Wed Sep 17 18:04:29 GMT 2025


On 9/17/25 1:56 AM, Pincheng Wang wrote:
> I also reran the microbenchmarks on the Raspberry Pi Pico 2. With the 
> corrected constraints, the v2 function (using temporaries) is about 4% 
> *slower* than v1 on this Hazard3 RV32 core.

Hi Pincheng,

So you're saying the:

	packh a0,a0,a0
	pack. a0,a0,a0

sequence is actually faster than the:

	packh a5,a0,a0
	pack. a0,a5,a5

sequence on your Hazard3 RV32 core?  If so, then I'm a little surprised,
but I won't argue against actual data!  Higher performant cores with
register renaming shouldn't care either way.  Thanks for taking the
time to perform the tests!

Just as an FYI for me, how much slower was the generic code than the v1
sequence?


> Given these results, I'm inclined to keep the simpler v1 sequence, which 
> performs better here in practice. I'm happy to hear any further thoughts 
> from you or others on this trade-off. Once we settle on the preferred 
> approach, I will prepare and submit the v2 patch.

So given the above, it seems the only change needed then is Adhemerval's
suggestion to remove the redundant __riscv_zbkb usage.

Peter




More information about the Libc-alpha mailing list