On 2/19/24 21:26, Alexandre Oliva wrote:
This backport for gcc-13 is required for pr90838.c to get the expected
count of andi instructions on riscv64-elf, rather than fail because of
two extra andi insns in functions where it is not necessary.  (On
riscv32-elf, it passes).  Regstrapped on x86_64-linux-gnu, along with
other backports, and tested manually on riscv64-elf.  Ok to install?

From: Raphael Moreira Zinsly <rzin...@ventanamicro.com>

Changes since v1:
        - Remove subreg from operand 1.

-- >8 --

We were not able to match the CTZ sign extend pattern on RISC-V
because it gets optimized to zero extend and/or to ANDI patterns.
For the ANDI case, combine scrambles the RTL and generates the
extension by using subregs.

gcc/ChangeLog:
        PR target/106888
        * config/riscv/bitmanip.md
        (<bitmanip_optab>disi2): Match with any_extend.
        (<bitmanip_optab>disi2_sext): New pattern to match
        with sign extend using an ANDI instruction.

gcc/testsuite/ChangeLog:
        PR target/106888
        * gcc.target/riscv/pr106888.c: New test.
        * gcc.target/riscv/zbbw.c: Check for ANDI.
In general, shouldn't backports be focused on correctness issues? It's unclear what the motivation is for backporting this change into gcc-13.

Not objecting, trying understand at this stage.
Jeff

Reply via email to