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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Stefan Schulze Frielinghaus
<stefa...@gcc.gnu.org>:

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

commit r13-9399-gb7466cff8cd4984cea6a2a134c54ca18e20f3fb3
Author: Stefan Schulze Frielinghaus <stefa...@gcc.gnu.org>
Date:   Thu Feb 13 09:13:06 2025 +0100

    s390: Fix s390_valid_shift_count() for TI mode [PR118835]

    During combine we may end up with

    (set (reg:DI 66 [ _6 ])
         (ashift:DI (reg:DI 72 [ x ])
                    (subreg:QI (and:TI (reg:TI 67 [ _1 ])
                                       (const_wide_int 0x0aaaaaaaaaaaaaabf))
                               15)))

    where the shift count operand does not trivially fit the scheme of
    address operands.  Reject those operands, especially since
    strip_address_mutations() expects expressions of the form
    (and ... (const_int ...)) and fails for (and ... (const_wide_int ...)).

    Thus, be more strict here and accept only CONST_INT operands.  Done by
    replacing immediate_operand() with const_int_operand() which is enough
    since the former only additionally checks for LEGITIMATE_PIC_OPERAND_P
    and targetm.legitimate_constant_p which are always true for CONST_INT
    operands.

    While on it, fix indentation of the if block.

    gcc/ChangeLog:

            PR target/118835
            * config/s390/s390.cc (s390_valid_shift_count): Reject shift
            count operands which do not trivially fit the scheme of
            address operands.

    gcc/testsuite/ChangeLog:

            * gcc.target/s390/pr118835.c: New test.

    (cherry picked from commit ac9806dae30d07ab082ac341fe5646987753adcb)

Reply via email to