From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3860 invoked by alias); 19 Nov 2018 16:08:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 3844 invoked by uid 89); 19 Nov 2018 16:08:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=sk:s390x-r, sk:iiilin, iii@linux.ibm.com, Ilya X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Nov 2018 16:08:41 +0000 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wAJG4ApJ138381 for ; Mon, 19 Nov 2018 11:08:40 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nuyj92qjv-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 19 Nov 2018 11:08:40 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Nov 2018 16:08:37 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 19 Nov 2018 16:08:35 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wAJG8X8e7471496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 19 Nov 2018 16:08:33 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8E56AE04D; Mon, 19 Nov 2018 16:08:33 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D52CAE045; Mon, 19 Nov 2018 16:08:33 +0000 (GMT) Received: from white.boeblingen.de.ibm.com (unknown [9.152.97.85]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 19 Nov 2018 16:08:33 +0000 (GMT) From: Ilya Leoshkevich To: gcc-patches@gcc.gnu.org Cc: krebbel@linux.ibm.com, rdapp@linux.ibm.com, Ilya Leoshkevich Subject: [PATCH] S/390: Skip LT(G) peephole when literal pool is involved Date: Mon, 19 Nov 2018 16:08:00 -0000 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit x-cbid: 18111916-0028-0000-0000-0000031D1425 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18111916-0029-0000-0000-000023D91497 Message-Id: <20181119160826.10831-1-iii@linux.ibm.com> X-IsSubscribed: yes X-SW-Source: 2018-11/txt/msg01642.txt.bz2 Bootstrapped and regtested on s390x-redhat-linux. By the time peephole optimizations run, we've already made up our mind whether to use base-register or relative addressing for literal pool entries. LT(G) supports only base-register addressing, and so it is too late to convert L(G)RL + compare to LT(G). This change should not make the code worse unless building with e.g. -fno-dce, since comparing literal pool entries to zero should be optimized away during earlier passes. gcc/ChangeLog: 2018-11-19 Ilya Leoshkevich PR target/88083 * config/s390/s390.md: Skip LT(G) peephole when literal pool is involved. * rtl.h (contains_constant_pool_address_p): New function. * rtlanal.c (contains_constant_pool_address_p): Likewise. gcc/testsuite/ChangeLog: 2018-11-19 Ilya Leoshkevich PR target/88083 * gcc.target/s390/pr88083.c: New test. --- gcc/config/s390/s390.md | 3 ++- gcc/rtl.h | 1 + gcc/rtlanal.c | 14 ++++++++++++++ gcc/testsuite/gcc.target/s390/pr88083.c | 9 +++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/s390/pr88083.c diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index 7a556d40224..721222d221f 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -941,7 +941,8 @@ (compare (match_dup 0) (match_operand:GPR 1 "const0_operand")))] "s390_match_ccmode(insn, CCSmode) && TARGET_EXTIMM && GENERAL_REG_P (operands[0]) - && satisfies_constraint_T (operands[2])" + && satisfies_constraint_T (operands[2]) + && !contains_constant_pool_address_p (operands[2])" [(parallel [(set (reg:CCS CC_REGNUM) (compare:CCS (match_dup 2) (match_dup 1))) diff --git a/gcc/rtl.h b/gcc/rtl.h index 68d3ceab29f..4f28afcf841 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -3385,6 +3385,7 @@ extern void set_insn_deleted (rtx_insn *); extern rtx single_set_2 (const rtx_insn *, const_rtx); extern bool contains_symbol_ref_p (const_rtx); extern bool contains_symbolic_reference_p (const_rtx); +extern bool contains_constant_pool_address_p (const_rtx); /* Handle the cheap and common cases inline for performance. */ diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index e8b6b9c7a42..0bae21e14c5 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -6550,6 +6550,20 @@ contains_symbolic_reference_p (const_rtx x) return false; } +/* Return true if RTL X contains a constant pool address. */ + +bool +contains_constant_pool_address_p (const_rtx x) +{ + subrtx_iterator::array_type array; + FOR_EACH_SUBRTX (iter, array, x, ALL) + if (SYMBOL_REF_P (*iter) && CONSTANT_POOL_ADDRESS_P (*iter)) + return true; + + return false; +} + + /* Return true if X contains a thread-local symbol. */ bool diff --git a/gcc/testsuite/gcc.target/s390/pr88083.c b/gcc/testsuite/gcc.target/s390/pr88083.c new file mode 100644 index 00000000000..d5e530eef83 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr88083.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-fno-sched-last-insn-heuristic -fno-dce -march=z196 -O2" } */ + +void *a, *b; + +void c(void) +{ + __builtin_memcpy(a, b, -1); /* { dg-warning "exceeds maximum object size" } */ +} -- 2.19.1