]> git.ipfire.org Git - thirdparty/gcc.git/commit
s390: Fix s390_valid_shift_count() for TI mode [PR118835]
authorStefan Schulze Frielinghaus <stefansf@gcc.gnu.org>
Thu, 13 Feb 2025 08:13:06 +0000 (09:13 +0100)
committerStefan Schulze Frielinghaus <stefansf@linux.ibm.com>
Wed, 26 Feb 2025 06:47:42 +0000 (07:47 +0100)
commitb27fa6a7ca86a9b885cb4dbe8a55991e7fb666f0
tree2436292f306797e8ac7f3a1559680fcc05e6990e
parent6517238fadf6f24a7184290759f412d960f5f4b9
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)
gcc/config/s390/s390.cc
gcc/testsuite/gcc.target/s390/pr118835.c [new file with mode: 0644]