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

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <l...@gcc.gnu.org>:

https://gcc.gnu.org/g:9d68a2a67351fc5b56262c0028ef8fd1d1466627

commit r15-8080-g9d68a2a67351fc5b56262c0028ef8fd1d1466627
Author: Jeff Law <j...@ventanamicro.com>
Date:   Sun Mar 16 17:43:48 2025 -0600

    [RISC-V][PR target/116256][V4] Fix minor code quality regression in
reassociated arithmetic

    Arggh.  This time add arguments for rv32.  Hand edited the testcase part of
the
    patch, but I think I got it right.

    One.  More.  Time.

    -pedantic-errors this time ;(  Adding an explicit -std=gnu23 to shut that
up.
    Part of me wants to know why that's getting added by the pre-commit, but
not
    enough to chase it down.

    --

    This failed pre-commit CI the first time through. The only change is in the
    return type in the test bool -> _Bool.

    The patch for target/116256 significantly simplified the condition and, I
guess
    not too surprisingly, exposed a minor code quality regression.

    Specifically the split part of the define_insn_and_split only splits after
    reload (because we use a match_scratch).  So there's nothing to combine the
    load-immediate with the subsequent add into an addi when the immediate fits
    into a simm12 field.

    This patch adjusts the split code to handle that scenario directly and
generate
    the more efficient code.  We can squeeze out the slli in this test with a
bit
    more work, but that's out of scope right now since that isn't a regression.

    Tested in my tester.  Waiting on pre-commit testing to render a verdict.

            PR target/116256
    gcc
            * config/riscv/riscv.md (reassociation splitters): Do not load the
            adjusted addend into a register if it fits in a simm12.

    gcc/testsuite
            * gcc.target/riscv/pr116256-1.c: New test.

Reply via email to