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

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

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

commit r16-5123-gca6e0f65afaf19bee5639971afc510410df098f5
Author: Dimitar Dimitrov <[email protected]>
Date:   Fri Nov 7 22:09:06 2025 +0200

    pru: Implement TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS [PR122415]

    Splitting a CONST_INT address into base and offset can be beneficial
    when accessing multiple addresses in the same UBYTE region.  The base
    constant load can be shared among those accesses.

    There is no regression for single accesses per UBYTE memory region.
    The transformation by TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS generates
    practically equivalent code:

       **before**                  **after**
       ldi32 r0, 0x11223344        ldi32 r0, 0x11223300
       lbbo  r1, r0, 0, 4          lbbo  r1, r0, 0x44, 4

    For PRU there is a small complication.  While load/store instructions
    support base+offset addressing, the call instructions do not.
    But the TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS arguments do not show
    which operation is using the address, so invalid address is emitted for
    call instructions to CONST_INT addresses.  This is solved by fixing up
    the call address operands during expansion.

            PR target/122415

    gcc/ChangeLog:

            * config/pru/pru-protos.h (pru_fixup_jump_address_operand):
            Declare.
            * config/pru/pru.cc (pru_fixup_jump_address_operand): New
            function.
            (pru_addr_space_legitimize_address): New function.
            (TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS): Declare.
            * config/pru/pru.md (call): Fixup the address operand.
            (call_value): Ditto.
            (sibcall): Ditto.
            (sibcall_value): Ditto.

    gcc/testsuite/ChangeLog:

            * gcc.target/pru/pr122415-1.c: New test.
            * gcc.target/pru/pr122415-2.c: New test.

    Signed-off-by: Dimitar Dimitrov <[email protected]>

Reply via email to