From patchwork Sat May 8 08:19:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1475813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@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.a=rsa-sha256 header.s=default header.b=VBmHiRKf; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FcgGb5WJQz9sWl for ; Sat, 8 May 2021 18:19:50 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5014C393F845; Sat, 8 May 2021 08:19:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5014C393F845 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1620461987; bh=I+WX4z38eKCSjVzAhbY2XZmmNbGngwxOkUkETJtERYQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=VBmHiRKf/obnAmtCCGtwuZ38wBKPlyieyXCVD70ry0fzPWmySOOOY+6QDhBVNArkv 3rmGMlLx/H6d4tpX3zOaXZQd6FCjYpF7GlS1cNfqwt5/F4hyt+nbc961oR5m6UqU3H wCY2l5FiX9j5g9Q8AmlsincWXdX8JSOSMmPNe+aQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id AE968385BF9C for ; Sat, 8 May 2021 08:19:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AE968385BF9C Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1488EW3m139220; Sat, 8 May 2021 04:19:44 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 38dpy102ev-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 08 May 2021 04:19:44 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 1488GKAX146601; Sat, 8 May 2021 04:19:43 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 38dpy102en-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 08 May 2021 04:19:43 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 1488IQPf024437; Sat, 8 May 2021 08:19:42 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03fra.de.ibm.com with ESMTP id 38dj9881ah-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 08 May 2021 08:19:41 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1488Jcj142402086 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 8 May 2021 08:19:38 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A12CC4C044; Sat, 8 May 2021 08:19:38 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C593A4C040; Sat, 8 May 2021 08:19:36 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.200.45.107]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sat, 8 May 2021 08:19:36 +0000 (GMT) To: GCC Patches Subject: [PATCH] rs6000: Move rs6000_vect_nonmem into target cost_data Message-ID: Date: Sat, 8 May 2021 16:19:34 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: rRDBaVbZhCgSZ2I4zIG-mLF0lV7bAErk X-Proofpoint-GUID: mp0SMhn398M7vSRMGT2-8BCW1u013tpb X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-08_05:2021-05-06, 2021-05-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 lowpriorityscore=0 mlxscore=0 phishscore=0 spamscore=0 malwarescore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105080060 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Cc: Bill Schmidt , David Edelsohn , Segher Boessenkool Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, This patch is to move rs6000_vect_nonmem (target cost_data related information) into target cost_data struct. Following Richi's comments in the thread[1], we can gather data from add_stmt_cost invocations. This is one pre-step to centralize target cost_data related stuffs. Is it ok for trunk? BR, Kewen [1] https://gcc.gnu.org/pipermail/gcc-patches/2021-May/569836.html ----- gcc/ChangeLog: * config/rs6000/rs6000.c (rs6000_vect_nonmem): Renamed to vect_nonmem and moved into... (struct rs6000_cost_data): ...here. (rs6000_init_cost): Use vect_nonmem of cost_data instead. (rs6000_add_stmt_cost): Likewise. (rs6000_finish_cost): Likewise. gcc/config/rs6000/rs6000.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 48b8efd732b..e2ff00145c5 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -5231,6 +5231,9 @@ typedef struct _rs6000_cost_data { struct loop *loop_info; unsigned cost[3]; + /* For each vectorized loop, this var holds TRUE iff a non-memory vector + instruction is needed by the vectorization. */ + bool vect_nonmem; } rs6000_cost_data; /* Test for likely overcommitment of vector hardware resources. If a @@ -5288,10 +5291,6 @@ rs6000_density_test (rs6000_cost_data *data) /* Implement targetm.vectorize.init_cost. */ -/* For each vectorized loop, this var holds TRUE iff a non-memory vector - instruction is needed by the vectorization. */ -static bool rs6000_vect_nonmem; - static void * rs6000_init_cost (struct loop *loop_info) { @@ -5300,7 +5299,7 @@ rs6000_init_cost (struct loop *loop_info) data->cost[vect_prologue] = 0; data->cost[vect_body] = 0; data->cost[vect_epilogue] = 0; - rs6000_vect_nonmem = false; + data->vect_nonmem = false; return data; } @@ -5360,7 +5359,7 @@ rs6000_add_stmt_cost (class vec_info *vinfo, void *data, int count, || kind == vec_promote_demote || kind == vec_construct || kind == scalar_to_vec) || (where == vect_body && kind == vector_stmt)) - rs6000_vect_nonmem = true; + cost_data->vect_nonmem = true; } return retval; @@ -5415,7 +5414,7 @@ rs6000_finish_cost (void *data, unsigned *prologue_cost, if (cost_data->loop_info) { loop_vec_info vec_info = loop_vec_info_for_loop (cost_data->loop_info); - if (!rs6000_vect_nonmem + if (!cost_data->vect_nonmem && LOOP_VINFO_VECT_FACTOR (vec_info) == 2 && LOOP_REQUIRES_VERSIONING (vec_info)) cost_data->cost[vect_body] += 10000;