From patchwork Tue May 26 05:55:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1297706 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org 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=sMoVOcXn; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 49WNVh3wXKz9sRY for ; Tue, 26 May 2020 15:55:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 811603894426; Tue, 26 May 2020 05:55:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 811603894426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1590472553; bh=dY6sYyTnyCknSSOgU3oSbhonn58I1RGhoCDxM78oehE=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=sMoVOcXnmgjLx7Cyas+b92WvVJuXqzDGqkTQGm5flG6G67DdIuFORrTMv5efeqOtt 9jDSS2wmdcKgfnAnGNaHaWDIC/BENHk1a6QIvmp/HNqpZB0mGlfj9wEz5+E8mk753J 95eAEdpsn4dreEBrX0WAvs+a4UNU/VPrC6+eUSog= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id D6A19387086E for ; Tue, 26 May 2020 05:55:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D6A19387086E Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04Q5Vpcg191978; Tue, 26 May 2020 01:55:48 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 316ywmgjwk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 May 2020 01:55:47 -0400 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 04Q5kHLL062414; Tue, 26 May 2020 01:55:47 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 316ywmgjvu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 May 2020 01:55:47 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 04Q5tj1j005614; Tue, 26 May 2020 05:55:45 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04fra.de.ibm.com with ESMTP id 316uf8a48w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 May 2020 05:55:44 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 04Q5tgod31195294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 May 2020 05:55:42 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D75B42056; Tue, 26 May 2020 05:55:42 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3647D42042; Tue, 26 May 2020 05:55:40 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.200.50.147]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 26 May 2020 05:55:39 +0000 (GMT) Subject: [PATCH 4/7] hook/rs6000: Add vectorize length mode for vector with length To: GCC Patches References: <30906c0d-3b9f-e1e6-156f-c01fcf229cb9@linux.ibm.com> Message-ID: <9a4a4b25-6b41-bbb3-d1b7-146de95693c0@linux.ibm.com> Date: Tue, 26 May 2020 13:55:38 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <30906c0d-3b9f-e1e6-156f-c01fcf229cb9@linux.ibm.com> Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-05-25_10:2020-05-25, 2020-05-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=9 mlxlogscore=999 phishscore=0 malwarescore=0 impostorscore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 mlxscore=0 adultscore=0 clxscore=1015 priorityscore=1501 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005260038 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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 , Richard Guenther , Segher Boessenkool , dje.gcc@gmail.com Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog: 2020-MM-DD Kewen Lin * config/rs6000/rs6000.c (TARGET_VECTORIZE_LENGTH_MODE): New macro. * doc/tm.texi: Regenerate. * doc/tm.texi.in: New hook. * target.def: Likewise. --- gcc/config/rs6000/rs6000.c | 3 +++ gcc/doc/tm.texi | 6 ++++++ gcc/doc/tm.texi.in | 2 ++ gcc/target.def | 7 +++++++ 4 files changed, 18 insertions(+) -- diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 8435bc15d72..c4d9d558b2f 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1659,6 +1659,9 @@ static const struct attribute_spec rs6000_attribute_table[] = #undef TARGET_HAVE_COUNT_REG_DECR_P #define TARGET_HAVE_COUNT_REG_DECR_P true +#undef TARGET_VECTORIZE_LENGTH_MODE +#define TARGET_VECTORIZE_LENGTH_MODE DImode + /* 1000000000 is infinite cost in IVOPTs. */ #undef TARGET_DOLOOP_COST_FOR_GENERIC #define TARGET_DOLOOP_COST_FOR_GENERIC 1000000000 diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 6e7d9dc54a9..5ea8734a191 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -6084,6 +6084,12 @@ The default implementation returns a @code{MODE_VECTOR_INT} with the same size and number of elements as @var{mode}, if such a mode exists. @end deftypefn +@deftypevr {Target Hook} scalar_int_mode TARGET_VECTORIZE_LENGTH_MODE +For the targets which support vector memory access with length, return +the scalar int mode to use for the length in bytes. +The default is to use @code{word_mode}. +@end deftypevr + @deftypefn {Target Hook} bool TARGET_VECTORIZE_EMPTY_MASK_IS_EXPENSIVE (unsigned @var{ifn}) This hook returns true if masked internal function @var{ifn} (really of type @code{internal_fn}) should be considered expensive when the mask is diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 3be984bbd5c..83034176b56 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -4181,6 +4181,8 @@ address; but often a machine-dependent strategy can generate better code. @hook TARGET_VECTORIZE_GET_MASK_MODE +@hook TARGET_VECTORIZE_LENGTH_MODE + @hook TARGET_VECTORIZE_EMPTY_MASK_IS_EXPENSIVE @hook TARGET_VECTORIZE_INIT_COST diff --git a/gcc/target.def b/gcc/target.def index 07059a87caf..b58d87e1496 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -1969,6 +1969,13 @@ same size and number of elements as @var{mode}, if such a mode exists.", (machine_mode mode), default_get_mask_mode) +DEFHOOKPOD +(length_mode, + "For the targets which support vector memory access with length, return\n\ +the scalar int mode to use for the length in bytes.\n\ +The default is to use @code{word_mode}.", + scalar_int_mode, word_mode) + /* Function to say whether a masked operation is expensive when the mask is all zeros. */ DEFHOOK