https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128420

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <[email protected]>:

https://gcc.gnu.org/g:d692d443714fd75ee70e0378f8a0db14b1dcbef6

commit r17-5910-gd692d443714fd75ee70e0378f8a0db14b1dcbef6
Author: Jeff Law <[email protected]>
Date:   Tue Nov 3 22:15:29 2026 -0700

    [committed][PR target/128420] Convert RISC-V define_insn_and_split to
simpler define_split

    LLM review of x264 found a case where we had code like this:

            lui     a5,%hi(tab)
            andi    a4,a0,3
            addi    t0,a5,%lo(tab)
            sh2add  t1,a4,t0
            lbu     t2,0(t1)
            andi    a0,a0,3
    [ ... ]

    Note the two ANDI instructions.  They compute the same value and put it
into
    two different places.

    One is coming from a define_insn_and_split and thus we don't see it early
    enough to have any chance of optimizing it away.  Turning that pattern into
a
    simple define_split doesn't fix the problem, but it is a necessary step and
it
    fits into the long term desire to avoid define_insn_and_split when we can.

    Implemented thusly.  Tested on riscv32-elf and riscv64-elf.  Bootstrap on
K3
    and C920 in flight.  K1 is queued.  Pushing to the trunk.

            PR target/128420
    gcc/
            * config/riscv/bitmanip.md (andi_add.uw): Turn into define_split.

Reply via email to