From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7806) id CC5DE385AC34; Fri, 19 Nov 2021 15:57:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC5DE385AC34 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Stefan Schulze Frielinghaus To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5408] IBM Z: Fix load-and-test peephole2 condition X-Act-Checkin: gcc X-Git-Author: Stefan Schulze Frielinghaus X-Git-Refname: refs/heads/master X-Git-Oldrev: 487d604b6fa0f0a981eadc216d9e481d08ed7e7b X-Git-Newrev: f47870e6a272dfe740a38422030c6c68e0fc7ff8 Message-Id: <20211119155736.CC5DE385AC34@sourceware.org> Date: Fri, 19 Nov 2021 15:57:36 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2021 15:57:36 -0000 https://gcc.gnu.org/g:f47870e6a272dfe740a38422030c6c68e0fc7ff8 commit r12-5408-gf47870e6a272dfe740a38422030c6c68e0fc7ff8 Author: Stefan Schulze Frielinghaus Date: Fri Nov 19 16:56:56 2021 +0100 IBM Z: Fix load-and-test peephole2 condition For a peephole2 condition variable insn points to the first matched insn. In order to refer to the second matched insn use peep2_next_insn(1) instead. gcc/ChangeLog: * config/s390/s390.md (define_peephole2): Variable insn points to the first matched insn. Use peep2_next_insn(1) to refer to the second matched insn. gcc/testsuite/ChangeLog: * gcc.target/s390/20211119.c: New test. Diff: --- gcc/config/s390/s390.md | 2 +- gcc/testsuite/gcc.target/s390/20211119.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index 4debdcd1247..c4f92bde061 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -1003,7 +1003,7 @@ (match_operand:GPR 2 "memory_operand")) (set (reg CC_REGNUM) (compare (match_dup 0) (match_operand:GPR 1 "const0_operand")))] - "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM + "s390_match_ccmode (peep2_next_insn (1), CCSmode) && TARGET_EXTIMM && GENERAL_REG_P (operands[0]) && satisfies_constraint_T (operands[2]) && !contains_constant_pool_address_p (operands[2])" diff --git a/gcc/testsuite/gcc.target/s390/20211119.c b/gcc/testsuite/gcc.target/s390/20211119.c new file mode 100644 index 00000000000..b9d216389f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/20211119.c @@ -0,0 +1,12 @@ +/* { dg-do run { target { s390_useable_hw } } } */ +/* { dg-options "-Os -march=z10" } */ +signed char a; +int b = -925974181, c; +unsigned *d = &b; +int *e = &c; +int main() { + *e = ((217 ^ a) > 585) < *d; + if (c != 1) + __builtin_abort(); + return 0; +}