From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50963 invoked by alias); 12 Jul 2017 15:02: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 50947 invoked by uid 89); 12 Jul 2017 15:02:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=Hx-languages-length:2555 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; Wed, 12 Jul 2017 15:02:42 +0000 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6CExdDn104340 for ; Wed, 12 Jul 2017 11:02:40 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bncj5qdg9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 12 Jul 2017 11:02:40 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Jul 2017 16:02:37 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 12 Jul 2017 16:02:36 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6CF2ZiD40239244 for ; Wed, 12 Jul 2017 15:02:35 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C292352047 for ; Wed, 12 Jul 2017 14:58:54 +0100 (BST) Received: from maggie.boeblingen.de.ibm.com (unknown [9.152.212.134]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id A538D52045 for ; Wed, 12 Jul 2017 14:58:54 +0100 (BST) From: Andreas Krebbel To: gcc-patches@gcc.gnu.org Subject: [Committed] S/390: Calculate costs for load/store on condition Date: Wed, 12 Jul 2017 15:02:00 -0000 X-TM-AS-GCONF: 00 x-cbid: 17071215-0040-0000-0000-000003E2A8DB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071215-0041-0000-0000-0000207DD546 Message-Id: <20170712150234.23078-1-krebbel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-12_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707120244 X-IsSubscribed: yes X-SW-Source: 2017-07/txt/msg00592.txt.bz2 This adds code to the backend rtx_costs function in order to model the costs of a load/store on condition. Bootstrapped and regression tested on s390x. gcc/ChangeLog: 2017-07-12 Andreas Krebbel * config/s390/s390.c (s390_rtx_costs): Return proper costs for load/store on condition. --- gcc/ChangeLog | 5 +++++ gcc/config/s390/s390.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e3d096c..128fc92 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-07-12 Andreas Krebbel + + * config/s390/s390.c (s390_rtx_costs): Return proper costs for + load/store on condition. + 2017-07-11 Michael Collison * config/aarch64/aarch64-simd.md (aarch64_sub_compare0): diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 958ee3b..31ced21 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -3414,6 +3414,48 @@ s390_rtx_costs (rtx x, machine_mode mode, int outer_code, *total = 0; return true; + case SET: + { + /* Without this a conditional move instruction would be + accounted as 3 * COSTS_N_INSNS (set, if_then_else, + comparison operator). That's a bit pessimistic. */ + + if (!TARGET_Z196 || GET_CODE (SET_SRC (x)) != IF_THEN_ELSE) + return false; + + rtx cond = XEXP (SET_SRC (x), 0); + + if (!CC_REG_P (XEXP (cond, 0)) || !CONST_INT_P (XEXP (cond, 1))) + return false; + + /* It is going to be a load/store on condition. Make it + slightly more expensive than a normal load. */ + *total = COSTS_N_INSNS (1) + 1; + + rtx dst = SET_DEST (x); + rtx then = XEXP (SET_SRC (x), 1); + rtx els = XEXP (SET_SRC (x), 2); + + /* It is a real IF-THEN-ELSE. An additional move will be + needed to implement that. */ + if (reload_completed + && !rtx_equal_p (dst, then) + && !rtx_equal_p (dst, els)) + *total += COSTS_N_INSNS (1) / 2; + + /* A minor penalty for constants we cannot directly handle. */ + if ((CONST_INT_P (then) || CONST_INT_P (els)) + && (!TARGET_Z13 || MEM_P (dst) + || (CONST_INT_P (then) && !satisfies_constraint_K (then)) + || (CONST_INT_P (els) && !satisfies_constraint_K (els)))) + *total += COSTS_N_INSNS (1) / 2; + + /* A store on condition can only handle register src operands. */ + if (MEM_P (dst) && (!REG_P (then) || !REG_P (els))) + *total += COSTS_N_INSNS (1) / 2; + + return true; + } case IOR: /* risbg */ if (GET_CODE (XEXP (x, 0)) == AND -- 2.9.1