On 11/19/26 8:50 AM, Jiawei wrote:
A constant byte selector lets xperm8 implement a byte swap when rev8
is unavailable. Use a four-byte selector for a word swap on RV64 and
take the low word of the result.
Use this expansion when optimizing for speed. Materializing the
eight-byte selector can make an RV64 caller larger than a libcall.
gcc/ChangeLog:
* config/riscv/bitmanip.md (bswapdi2, bswapsi2): Combine into
bswap<mode>2.
(bswap<mode>2): Expand byte swaps with xperm8 for Zbkx.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/zbkx-bswap.c: New test.
Let's defer this to gcc-18. I don't have any particular worries, but I
don't really see that it fits the bugfix phase.
jeff