From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109116 invoked by alias); 11 Mar 2019 12:53:49 -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 109044 invoked by uid 89); 11 Mar 2019 12:53:49 -0000 Authentication-Results: sourceware.org; auth=none 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,KHOP_DYNAMIC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Mar 2019 12:53:47 +0000 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2BCo3x5036787 for ; Mon, 11 Mar 2019 08:53:45 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2r5mt3s6cf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Mar 2019 08:53:42 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Mar 2019 12:53:38 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 11 Mar 2019 12:53:37 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x2BCrZAG24772770 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Mar 2019 12:53:35 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A235552050; Mon, 11 Mar 2019 12:53:35 +0000 (GMT) Received: from oc6142347168.ibm.com (unknown [9.152.222.26]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 69E675204E; Mon, 11 Mar 2019 12:53:35 +0000 (GMT) From: Robin Dapp To: gcc-patches@gcc.gnu.org Cc: krebbel@linux.ibm.com, iii@linux.ibm.com, rdapp@linux.ibm.com Subject: [PATCH 6/7] S/390: Add handling for group-of-two instructions. Date: Mon, 11 Mar 2019 12:53:00 -0000 In-Reply-To: <20190311125327.20093-1-rdapp@linux.ibm.com> References: <20190311125327.20093-1-rdapp@linux.ibm.com> x-cbid: 19031112-0012-0000-0000-0000030141F1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19031112-0013-0000-0000-000021385D62 Message-Id: <20190311125327.20093-7-rdapp@linux.ibm.com> X-SW-Source: 2019-03/txt/msg00493.txt.bz2 This patch adds handling of group-of-two instructions. --- gcc/config/s390/s390.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 4dcf1be4445..78a707267e8 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -14266,14 +14266,17 @@ struct s390_sched_state int group_state; /* Execution side of the group. */ int side; + /* Group can only hold two insns. */ + bool group_of_two; } s390_sched_state; -static struct s390_sched_state sched_state = {0, 1}; +static struct s390_sched_state sched_state = {0, 1, false}; #define S390_SCHED_ATTR_MASK_CRACKED 0x1 #define S390_SCHED_ATTR_MASK_EXPANDED 0x2 #define S390_SCHED_ATTR_MASK_ENDGROUP 0x4 #define S390_SCHED_ATTR_MASK_GROUPALONE 0x8 +#define S390_SCHED_ATTR_MASK_GROUPOFTWO 0x10 static unsigned int s390_get_sched_attrmask (rtx_insn *insn) @@ -14301,6 +14304,8 @@ s390_get_sched_attrmask (rtx_insn *insn) mask |= S390_SCHED_ATTR_MASK_ENDGROUP; if (get_attr_z13_groupalone (insn)) mask |= S390_SCHED_ATTR_MASK_GROUPALONE; + if (get_attr_z13_groupoftwo (insn)) + mask |= S390_SCHED_ATTR_MASK_GROUPOFTWO; break; case PROCESSOR_3906_Z14: if (get_attr_z14_cracked (insn)) @@ -14311,6 +14316,8 @@ s390_get_sched_attrmask (rtx_insn *insn) mask |= S390_SCHED_ATTR_MASK_ENDGROUP; if (get_attr_z14_groupalone (insn)) mask |= S390_SCHED_ATTR_MASK_GROUPALONE; + if (get_attr_z14_groupoftwo (insn)) + mask |= S390_SCHED_ATTR_MASK_GROUPOFTWO; break; default: gcc_unreachable (); @@ -14393,6 +14400,11 @@ s390_sched_score (rtx_insn *insn) score += 10; if ((mask & S390_SCHED_ATTR_MASK_ENDGROUP) == 0) score += 5; + /* If we are in a group of two already, try to schedule another + group-of-two insn to avoid shortening another group. */ + if (sched_state.group_of_two + && (mask & S390_SCHED_ATTR_MASK_GROUPOFTWO) != 0) + score += 15; break; case 2: /* Prefer not cracked insns while trying to put together a @@ -14404,6 +14416,10 @@ s390_sched_score (rtx_insn *insn) /* Prefer endgroup insns in the last slot. */ if ((mask & S390_SCHED_ATTR_MASK_ENDGROUP) != 0) score += 10; + /* Try to avoid group-of-two insns in the last slot as they will + shorten this group as well as the next one. */ + if ((mask & S390_SCHED_ATTR_MASK_GROUPOFTWO) != 0) + score = MAX (0, score - 15); break; } @@ -14595,6 +14611,17 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more) { unsigned int mask = s390_get_sched_attrmask (insn); + if ((mask & S390_SCHED_ATTR_MASK_GROUPOFTWO) != 0) + sched_state.group_of_two = true; + + /* If this is a group-of-two insn, we actually ended the last group + and this insn is the first one of the new group. */ + if (sched_state.group_state == 2 && sched_state.group_of_two) + { + sched_state.side = sched_state.side ? 0 : 1; + sched_state.group_state = 0; + } + /* Longrunning and side bookkeeping. */ for (int i = 0; i < 2; i++) { @@ -14645,6 +14672,11 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more) break; case 1: sched_state.group_state++; + if (sched_state.group_of_two) + { + sched_state.group_state = 0; + ends_group = true; + } break; case 2: sched_state.group_state++; @@ -14700,6 +14732,7 @@ s390_sched_variable_issue (FILE *file, int verbose, rtx_insn *insn, int more) { sched_state.group_state = 0; sched_state.side = sched_state.side ? 0 : 1; + sched_state.group_of_two = false; } } @@ -14733,6 +14766,7 @@ s390_sched_init (FILE *file ATTRIBUTE_UNUSED, memset (last_scheduled_unit_distance, 0, MAX_SCHED_UNITS * NUM_SIDES * sizeof (int)); sched_state.group_state = 0; + sched_state.group_of_two = false; } } -- 2.17.0