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

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

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

commit r16-5022-ga50b4406e5d64adb6bb0ebde3710f6742a0bdbed
Author: Kishan Parmar <[email protected]>
Date:   Tue Nov 4 12:41:28 2025 +0530

    simplify-rtx: Canonicalize SUBREG and LSHIFTRT order for AND operations

    For a given rtx expression (and (lshiftrt (subreg X) shift) mask)
    combine pass tries to simplify the RTL form to

       (and (subreg (lshiftrt X shift)) mask)

    where the SUBREG wraps the result of the shift.  This leaves the AND
    and the shift in different modes, which complicates recognition.

       (and (lshiftrt (subreg X) shift) mask)

    where the SUBREG is inside the shift and both operations share the same
    mode.  This form is easier to recognize across targets and enables
    cleaner pattern matching.

    This patch checks in simplify-rtx to perform this transformation when
    safe: the SUBREG must be a lowpart, the shift amount must be valid, and
    the precision of the operation must be preserved.

    Tested on powerpc64le-linux-gnu, powerpc64-linux-gnu, and
    x86_64-pc-linux-gnu with no regressions.  On rs6000, the change reduces
    insn counts due to improved matching.

    2025-11-04  Kishan Parmar  <[email protected]>

    gcc/ChangeLog:

            PR rtl-optimization/93738
            * simplify-rtx.cc (simplify_binary_operation_1): Canonicalize
            SUBREG(LSHIFTRT) into LSHIFTRT(SUBREG) when valid.

    gcc/testsuite/ChangeLog:

            PR rtl-optimization/93738
            * gcc.target/powerpc/rlwimi-2.c: Update expected rldicl count.
  • [Bug target/93738] [13/14/15/16... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to