]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR 106101: IBM zSystems: Fix strict_low_part problem
authorAndreas Krebbel <krebbel@linux.ibm.com>
Mon, 23 Jan 2023 07:56:05 +0000 (08:56 +0100)
committerAndreas Krebbel <krebbel@linux.ibm.com>
Mon, 23 Jan 2023 07:58:17 +0000 (08:58 +0100)
commite1357577e6e39430869e294f94c2c547717b960f
treeb79ccf4fcc67f8907084cbc7dafd8e5134124c5a
parent14207e5481e7c76636ff314bc3c730c0cd2804e7
PR 106101: IBM zSystems: Fix strict_low_part problem

This avoids generating illegal (strict_low_part (reg ...)) RTXs. This
required two changes:

1. Do not use gen_lowpart to generate the inner expression of a
STRICT_LOW_PART.  gen_lowpart might fold the SUBREG either because
there is already a paradoxical subreg or because it can directly be
applied to the register. A new wrapper function makes sure that we
always end up having an actual SUBREG.

2. Change the movstrict patterns to enforce a SUBREG as inner operand
of the STRICT_LOW_PARTs.  The new predicate introduced for the
destination operand requires a SUBREG expression with a
register_operand as inner operand.  However, since reload strips away
the majority of the SUBREGs we have to accept single registers as well
once we reach reload.

Bootstrapped and regression tested on IBM zSystems 64 bit.

gcc/ChangeLog:

PR target/106101
* config/s390/predicates.md (subreg_register_operand): New
predicate.
* config/s390/s390-protos.h (s390_gen_lowpart_subreg): New
function prototype.
* config/s390/s390.cc (s390_gen_lowpart_subreg): New function.
(s390_expand_insv): Use s390_gen_lowpart_subreg instead of
gen_lowpart.
* config/s390/s390.md ("*get_tp_64", "*zero_extendhisi2_31")
("*zero_extendqisi2_31", "*zero_extendqihi2_31"): Likewise.
("movstrictqi", "movstricthi", "movstrictsi"): Use the
subreg_register_operand predicate instead of register_operand.

gcc/testsuite/ChangeLog:

PR target/106101
* gcc.c-torture/compile/pr106101.c: New test.

(cherry picked from commit 585a21bab3ec688c2039bff2922cc372d8558283)
gcc/config/s390/predicates.md
gcc/config/s390/s390-protos.h
gcc/config/s390/s390.cc
gcc/config/s390/s390.md
gcc/testsuite/gcc.c-torture/compile/pr106101.c [new file with mode: 0644]