From patchwork Fri Nov 19 09:45:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schulze Frielinghaus X-Patchwork-Id: 47925 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 44727385AC1F for ; Fri, 19 Nov 2021 09:48:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 44727385AC1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1637315320; bh=VttR/vNAGLUB7PkYZkYXMotdL5M2kaDdWNcudn6mDCk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=qnyq9AsJUm3uqdTvexkg2jzvzhzZryL/Ur3PLvIgN4wV0Tsci+9ZEC1gh1LFl30kV mfppxqLfwCFIeLSaDp6b/LZSsg/5Dv+vSGrzPsOQ/8cnh+iaBMmptWt9f/qF2uDDV4 sq1HzzU046Es8+wZLNK6bvkXGzvS+DrvBxvmXWz4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 450523858D3C for ; Fri, 19 Nov 2021 09:48:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 450523858D3C Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1AJ9ULbI027406 for ; Fri, 19 Nov 2021 09:48:09 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ce9bqr9t3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 19 Nov 2021 09:48:08 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1AJ9hes8031518 for ; Fri, 19 Nov 2021 09:47:11 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03ams.nl.ibm.com with ESMTP id 3ca50ay1rk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 19 Nov 2021 09:47:11 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1AJ9l82U33227116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Nov 2021 09:47:08 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 19EE311C050; Fri, 19 Nov 2021 09:47:08 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E944D11C05C; Fri, 19 Nov 2021 09:47:07 +0000 (GMT) Received: from t8345026.lnxne.boe (unknown [9.152.108.100]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 19 Nov 2021 09:47:07 +0000 (GMT) To: gcc-patches@gcc.gnu.org, krebbel@linux.ibm.com Subject: [PATCH] IBM Z: Fix load-and-test peephole2 condition Date: Fri, 19 Nov 2021 10:45:30 +0100 Message-Id: <20211119094529.2947208-1-stefansf@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211118095119.2819884-1-stefansf@linux.ibm.com> References: <20211118095119.2819884-1-stefansf@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: nnILhzqDTFdoF7_NLfiH86Z7GVAc6Qg3 X-Proofpoint-GUID: nnILhzqDTFdoF7_NLfiH86Z7GVAc6Qg3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-19_08,2021-11-17_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 bulkscore=0 clxscore=1015 mlxlogscore=995 spamscore=0 impostorscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111190052 X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stefan Schulze Frielinghaus via Gcc-patches From: Stefan Schulze Frielinghaus Reply-To: Stefan Schulze Frielinghaus Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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. Update: Added a test case Bootstrapped and regtested on IBM Z. Ok for mainline and gcc-{11,10,9}? 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. --- gcc/config/s390/s390.md | 2 +- gcc/testsuite/gcc.target/s390/20211119.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/s390/20211119.c 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..1a6df4f4b89 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/20211119.c @@ -0,0 +1,12 @@ +/* { dg-do run } */ +/* { 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; +}