On 11/19/26 8:50 AM, Jiawei wrote:
Zbkb provides andn, orn and xnor.  Consider the complemented constant
when synthesizing a logical operation and charge the same cost as for
Zbb.  A mask such as ~0xf000UL then needs only a lui and an andn.

gcc/ChangeLog:

        * config/riscv/bitmanip.md: Enable the constant IOR/XOR splitter
        for Zbkb.
        * config/riscv/riscv.cc (riscv_rtx_costs, synthesize_ior_xor,
        synthesize_and): Handle inverted logical operations with Zbkb.

gcc/testsuite/ChangeLog:

        * gcc.target/riscv/zbkb-logic-imm.c: New test.
LGTM and sashiko clean.  OK for the trunk.

This is clearly correct and while not technically a bugfix, I think it's the right thing to do to get on the trunk now.

Jeff

Reply via email to