On 11/19/26 8:50 AM, Jiawei wrote:
Zbkb can zero-extend a halfword with pack on RV32 and packw on RV64
when the second source is x0. Use the existing zext.h pattern and
account for the single instruction when costing register extensions.
gcc/ChangeLog:
* config/riscv/bitmanip.md (*zero_extendhi<GPR:mode>2_bitmanip):
Enable for Zbkb.
* config/riscv/riscv.cc (riscv_extend_cost): Account for zext.h
with Zbkb.
* config/riscv/riscv.md (zero_extendhi<GPR:mode>2)
(*zero_extendhi<GPR:mode>2): Use the bitmanip pattern with Zbkb.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/zbkb-zext-h.c: New test.
LGTM and sashiko clean. Like the prior patch in this series converting
TARGET_ZBB -> (TARGET_ZBB || TARGET_ZBKB) is clearly correct. There's a
trivial cost change as well, but those are explicitly OK during this phase.
OK for the trunk.
jeff