From patchwork Wed Oct 11 11:53:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Dapp X-Patchwork-Id: 824368 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-463927-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="vQZLrNJv"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yBsp95jJwz9sNc for ; Wed, 11 Oct 2017 22:54:09 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:in-reply-to:references:message-id; q=dns; s= default; b=mh2MOnxDy4iUZmYH27qMOqt8u9p1ni5SZsFq2eElPuuzJ4axErih6 mFho8uyaH98//APCfLR60Zj+8DdMX39JaG22AmLvWyna0HSXr9WlUtEf83LeqcL1 2OjiPK83W8uMiddDKmQHjYDQmFUHIS5Lx9SNmPxgc2Pb1LBbboZZz0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:in-reply-to:references:message-id; s= default; bh=GkTML8PXrQ29OarSksB8uwSsyfg=; b=vQZLrNJvbUyr1g0H2woY 8kQnzm1y2ZKQpPaOJNFJyP91UwWtsQcbUhx7WsPz4Y+MQi1o2eUd4PoptY3cZjt1 ogPKtCFO63ciCL0mBIDU+oPiJEKRMhLsgLXox6oxtSgGgarr5svPRHBWu/48yu2o WnmFsfxJxIj5HjweIQ8ayro= Received: (qmail 55805 invoked by alias); 11 Oct 2017 11:53:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 55712 invoked by uid 89); 11 Oct 2017 11:53:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 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=Robin, robin 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, 11 Oct 2017 11:53:49 +0000 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9BBrbA8100903 for ; Wed, 11 Oct 2017 07:53:44 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dhej3xcp4-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 11 Oct 2017 07:53:43 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 11 Oct 2017 12:53:41 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 11 Oct 2017 12:53:40 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9BBrd1d30998616; Wed, 11 Oct 2017 11:53:39 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 05A5E4203F; Wed, 11 Oct 2017 12:49:22 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA4C942042; Wed, 11 Oct 2017 12:49:21 +0100 (BST) Received: from oc6142347168.ibm.com (unknown [9.152.212.41]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 11 Oct 2017 12:49:21 +0100 (BST) From: Robin Dapp To: gcc-patches@gcc.gnu.org Cc: krebbel@linux.vnet.ibm.com Subject: [PATCH 2/2] S/390: Do not end groups after fallthru edge Date: Wed, 11 Oct 2017 13:53:38 +0200 In-Reply-To: <20171011115338.4072-1-rdapp@linux.vnet.ibm.com> References: <20171011115338.4072-1-rdapp@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17101111-0012-0000-0000-00000580BC6E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101111-0013-0000-0000-000018FAC9A5 Message-Id: <20171011115338.4072-2-rdapp@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-11_05:, , 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-1707230000 definitions=main-1710110165 This patch fixes cases where we start a new group although the previous one has not ended. Regression tested on s390x. gcc/ChangeLog: 2017-10-11 Robin Dapp * config/s390/s390.c (s390_has_ok_fallthru): New function. (s390_sched_score): Temporarily change s390_sched_state. (s390_sched_variable_issue): Use s390_last_sched_state in case the group is not finished yet. (s390_sched_init): Init s390_last_sched_state. --- gcc/config/s390/s390.c | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 2411c67..7f08ba2 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -14346,6 +14346,31 @@ s390_z10_prevent_earlyload_conflicts (rtx_insn **ready, int *nready_p) ready[0] = tmp; } +static bool +s390_has_ok_fallthru (rtx_insn *insn) +{ + edge e, fallthru_edge; + edge_iterator ei; + bool other_likely_edge = false; + + fallthru_edge = + find_fallthru_edge (BLOCK_FOR_INSN (insn)->preds); + FOR_EACH_EDGE (e, ei, BLOCK_FOR_INSN (insn)->preds) + { + if (e != fallthru_edge + && e->probability >= profile_probability::unlikely ()) + { + other_likely_edge = true; + break; + } + } + + if (fallthru_edge && !other_likely_edge) + return true; + + return false; +} + /* The s390_sched_state variable tracks the state of the current or the last instruction group. @@ -14355,6 +14380,7 @@ s390_z10_prevent_earlyload_conflicts (rtx_insn **ready, int *nready_p) 4 the last group was a cracked/expanded insn */ static int s390_sched_state; +static int s390_last_sched_state; #define S390_SCHED_STATE_NORMAL 3 #define S390_SCHED_STATE_CRACKED 4 @@ -14430,7 +14456,14 @@ s390_sched_score (rtx_insn *insn) unsigned int mask = s390_get_sched_attrmask (insn); int score = 0; - switch (s390_sched_state) + int temp_sched_state = s390_sched_state; + + if (s390_sched_state < s390_last_sched_state + && s390_last_sched_state < S390_SCHED_STATE_NORMAL + && s390_has_ok_fallthru (insn)) + temp_sched_state = s390_last_sched_state; + + switch (temp_sched_state) { case 0: /* Try to put insns into the first slot which would otherwise @@ -14656,11 +14689,15 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more) switch (s390_sched_state) { case 0: + if (s390_last_sched_state > 0 && s390_has_ok_fallthru (insn)) + s390_sched_state = s390_last_sched_state; + + if (s390_sched_state == 0) + starts_group = true; + /* fallthrough */ case 1: case 2: case S390_SCHED_STATE_NORMAL: - if (s390_sched_state == 0) - starts_group = true; if (s390_sched_state == S390_SCHED_STATE_NORMAL) { starts_group = true; @@ -14768,6 +14805,7 @@ s390_sched_init (FILE *file ATTRIBUTE_UNUSED, { last_scheduled_insn = NULL; memset (last_scheduled_unit_distance, 0, MAX_SCHED_UNITS * sizeof (int)); + s390_last_sched_state = s390_sched_state; s390_sched_state = 0; }