From patchwork Wed Mar 8 16:20:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andre Vieira (lists)" X-Patchwork-Id: 66347 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp429416wrd; Wed, 8 Mar 2023 08:20:53 -0800 (PST) X-Google-Smtp-Source: AK7set8CeiJAgL66nIguS0rADhQ/tRrEbGVatk/M3NMTjx9qPywrNsc+1rDuKQVuRDr8HhXdrBtQ X-Received: by 2002:a17:906:d208:b0:8de:502e:2061 with SMTP id w8-20020a170906d20800b008de502e2061mr16180568ejz.3.1678292453498; Wed, 08 Mar 2023 08:20:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678292453; cv=none; d=google.com; s=arc-20160816; b=kX7s+SWtzgRRH1pH2I/0k5sTz3GLx9xtaPWGcitZql0NzYG6WTDm8Z4b3XCQvBsmeG h5YPjuixmO4W6bryoHni1HrJs97iK8BqkEq67dLmuHbLvH5fR55uUz31d+dgjFjhEecx kuP4bvW2bzJmhgJVtmYclZ9AV1Er9+C+h+DdZENA2kwy/+1AQ/DiQQN4wQO2akwsMtkF nKUvRnl8iWdwGStXlqYxVans2EQl6K7tzKLjzVaF1u2+kmPiRTHXoOW7Vd7qDKw9XIKM rakZK2LPcEPI4PjC6WxKdDOzWOs0NYXyDVSaIpbbKA395XPf8Nqch+fHX8EBK8ffLElt iZKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:in-reply-to :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=LOWZSAXbKI5rLFaQSmz/cDWZvwutCJG9SY6LpItSNsU=; b=CwiUapaswaHgDo9fasTkSG2tBV0tZ8cOLW90Bb/sJS+gF88LtmAbLXSmNics6UB13O bpz+Ob5uNV8PW1yWKGVWY7+b3NCeoufhqlaU0Sw7WFQW06QhojAMFRSEXJ1cWqsqnOQR G6OvFMvoleWIg5Wd6s8gIYCUldCvs+/DRmg/OFiFPS0OfFbh1Bfm9oMohPk4P0wB9f/Z WlvyjaZ7YzlH32Rpj0ox8mwL3TsfvCW6ttuiOHxfv5+aDjjN/RhVYOzuKqa+gFWCn+nJ mG0qXaXD0CzcvKYsIpA88ScQjwBb5Zszxjc5P33Y2qkgVPgd4dCdSwP6PSJsuX91RdCI 8Y2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=pmzyUXIS; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id dm5-20020a170907948500b008b1e792860dsi5925050ejc.339.2023.03.08.08.20.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 08:20:53 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=pmzyUXIS; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4CF613858D33 for ; Wed, 8 Mar 2023 16:20:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CF613858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678292452; bh=LOWZSAXbKI5rLFaQSmz/cDWZvwutCJG9SY6LpItSNsU=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=pmzyUXISIqBhesDgHq7cSrosDQO1+KxNqQREn5ImjnJeo8htG1qlQl7ddRm22qold te7UnavjydYJdIyIBT1fnMY553VGE3WuL7QvH6lX0nomckTOM0W2yDAq5ONLWnRoTP vAxCzqQXhvfZouYz80rL8jM0WBPWRE3jOhuY7VHw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 6F99C385B53B for ; Wed, 8 Mar 2023 16:20:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F99C385B53B Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A08E21063; Wed, 8 Mar 2023 08:20:51 -0800 (PST) Received: from [10.57.79.24] (unknown [10.57.79.24]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 72D483F71A; Wed, 8 Mar 2023 08:20:07 -0800 (PST) Message-ID: <98e8127c-ecb0-2977-3c6c-29151edfcb15@arm.com> Date: Wed, 8 Mar 2023 16:20:02 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Subject: [PATCH 1/X] omp: Replace simd_clone_subparts with TYPE_VECTOR_SUBPARTS Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Cc: "jakub@redhat.com" , Richard Sandiford , Richard Biener References: In-Reply-To: X-Spam-Status: No, score=-15.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: "Andre Vieira \(lists\) via Gcc-patches" From: "Andre Vieira (lists)" Reply-To: "Andre Vieira \(lists\)" Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759817188087907781?= X-GMAIL-MSGID: =?utf-8?q?1759817188087907781?= Hi, This patch replaces the uses of simd_clone_subparts with TYPE_VECTOR_SUBPARTS and removes the definition of the first. gcc/ChangeLog: * omp-sind-clone.cc (simd_clone_subparts): Remove. (simd_clone_init_simd_arrays): Replace simd_clone_subparts with TYPE_VECTOR_SUBPARTS. (ipa_simd_modify_function_body): Likewise. * tree-vect-stmts.cc (simd_clone_subparts): Remove. (vectorizable_simd_clone_call): Replace simd_clone_subparts with TYPE_VECTOR_SUBPARTS. diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc index 0949b8ba288dfc7e7692403bfc600983faddf5dd..48b480e7556d9ad8e5502e10e513ec36b17b9cbb 100644 --- a/gcc/omp-simd-clone.cc +++ b/gcc/omp-simd-clone.cc @@ -255,16 +255,6 @@ ok_for_auto_simd_clone (struct cgraph_node *node) return true; } - -/* Return the number of elements in vector type VECTYPE, which is associated - with a SIMD clone. At present these always have a constant length. */ - -static unsigned HOST_WIDE_INT -simd_clone_subparts (tree vectype) -{ - return TYPE_VECTOR_SUBPARTS (vectype).to_constant (); -} - /* Allocate a fresh `simd_clone' and return it. NARGS is the number of arguments to reserve space for. */ @@ -1027,7 +1017,7 @@ simd_clone_init_simd_arrays (struct cgraph_node *node, } continue; } - if (known_eq (simd_clone_subparts (TREE_TYPE (arg)), + if (known_eq (TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg)), node->simdclone->simdlen)) { tree ptype = build_pointer_type (TREE_TYPE (TREE_TYPE (array))); @@ -1039,7 +1029,7 @@ simd_clone_init_simd_arrays (struct cgraph_node *node, } else { - unsigned int simdlen = simd_clone_subparts (TREE_TYPE (arg)); + poly_uint64 simdlen = TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg)); unsigned int times = vector_unroll_factor (node->simdclone->simdlen, simdlen); tree ptype = build_pointer_type (TREE_TYPE (TREE_TYPE (array))); @@ -1225,9 +1215,9 @@ ipa_simd_modify_function_body (struct cgraph_node *node, iter, NULL_TREE, NULL_TREE); adjustments->register_replacement (&(*adjustments->m_adj_params)[j], r); - if (multiple_p (node->simdclone->simdlen, simd_clone_subparts (vectype))) + if (multiple_p (node->simdclone->simdlen, TYPE_VECTOR_SUBPARTS (vectype))) j += vector_unroll_factor (node->simdclone->simdlen, - simd_clone_subparts (vectype)) - 1; + TYPE_VECTOR_SUBPARTS (vectype)) - 1; } adjustments->sort_replacements (); diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index df6239a1c61c7213ad3c1468723bc1adf70bc02c..c85b6babc4bc5bc3111ef326dcc8f32bb25333f6 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -3964,16 +3964,6 @@ vect_simd_lane_linear (tree op, class loop *loop, } } -/* Return the number of elements in vector type VECTYPE, which is associated - with a SIMD clone. At present these vectors always have a constant - length. */ - -static unsigned HOST_WIDE_INT -simd_clone_subparts (tree vectype) -{ - return TYPE_VECTOR_SUBPARTS (vectype).to_constant (); -} - /* Function vectorizable_simd_clone_call. Check if STMT_INFO performs a function call that can be vectorized @@ -4251,7 +4241,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, slp_node); if (arginfo[i].vectype == NULL || !constant_multiple_p (bestn->simdclone->simdlen, - simd_clone_subparts (arginfo[i].vectype))) + TYPE_VECTOR_SUBPARTS (arginfo[i].vectype))) return false; } @@ -4349,15 +4339,19 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, case SIMD_CLONE_ARG_TYPE_VECTOR: atype = bestn->simdclone->args[i].vector_type; o = vector_unroll_factor (nunits, - simd_clone_subparts (atype)); + TYPE_VECTOR_SUBPARTS (atype)); for (m = j * o; m < (j + 1) * o; m++) { - if (simd_clone_subparts (atype) - < simd_clone_subparts (arginfo[i].vectype)) + poly_uint64 atype_subparts = TYPE_VECTOR_SUBPARTS (atype); + poly_uint64 arginfo_subparts + = TYPE_VECTOR_SUBPARTS (arginfo[i].vectype); + if (known_lt (atype_subparts, arginfo_subparts)) { poly_uint64 prec = GET_MODE_BITSIZE (TYPE_MODE (atype)); - k = (simd_clone_subparts (arginfo[i].vectype) - / simd_clone_subparts (atype)); + if (!constant_multiple_p (atype_subparts, + arginfo_subparts, &k)) + gcc_unreachable (); + gcc_assert ((k & (k - 1)) == 0); if (m == 0) { @@ -4387,8 +4381,9 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, } else { - k = (simd_clone_subparts (atype) - / simd_clone_subparts (arginfo[i].vectype)); + if (!constant_multiple_p (arginfo_subparts, + atype_subparts, &k)) + gcc_unreachable (); gcc_assert ((k & (k - 1)) == 0); vec *ctor_elts; if (k != 1) @@ -4522,7 +4517,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, if (vec_dest) { gcc_assert (ratype - || known_eq (simd_clone_subparts (rtype), nunits)); + || known_eq (TYPE_VECTOR_SUBPARTS (rtype), nunits)); if (ratype) new_temp = create_tmp_var (ratype); else if (useless_type_conversion_p (vectype, rtype)) @@ -4536,13 +4531,13 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, if (vec_dest) { - if (!multiple_p (simd_clone_subparts (vectype), nunits)) + if (!multiple_p (TYPE_VECTOR_SUBPARTS (vectype), nunits)) { unsigned int k, l; poly_uint64 prec = GET_MODE_BITSIZE (TYPE_MODE (vectype)); poly_uint64 bytes = GET_MODE_SIZE (TYPE_MODE (vectype)); k = vector_unroll_factor (nunits, - simd_clone_subparts (vectype)); + TYPE_VECTOR_SUBPARTS (vectype)); gcc_assert ((k & (k - 1)) == 0); for (l = 0; l < k; l++) { @@ -4568,10 +4563,12 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, vect_clobber_variable (vinfo, stmt_info, gsi, new_temp); continue; } - else if (!multiple_p (nunits, simd_clone_subparts (vectype))) + else if (!multiple_p (nunits, TYPE_VECTOR_SUBPARTS (vectype))) { - unsigned int k = (simd_clone_subparts (vectype) - / simd_clone_subparts (rtype)); + unsigned int k; + if (!constant_multiple_p (TYPE_VECTOR_SUBPARTS (vectype), + TYPE_VECTOR_SUBPARTS (rtype), &k)) + gcc_unreachable (); gcc_assert ((k & (k - 1)) == 0); if ((j & (k - 1)) == 0) vec_alloc (ret_ctor_elts, k); @@ -4579,7 +4576,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, { unsigned int m, o; o = vector_unroll_factor (nunits, - simd_clone_subparts (rtype)); + TYPE_VECTOR_SUBPARTS (rtype)); for (m = 0; m < o; m++) { tree tem = build4 (ARRAY_REF, rtype, new_temp,