]> 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@gcc.gnu.org>
Thu, 13 Feb 2025 08:13:06 +0000 (09:13 +0100)
commitac9806dae30d07ab082ac341fe5646987753adcb
tree22e951b14f866308d6e7fc21373ad7dfb33365ff
parent77d01927bd7c989d431035251a5c196fe39bcec9
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.
gcc/config/s390/s390.cc
gcc/testsuite/gcc.target/s390/pr118835.c [new file with mode: 0644]