From patchwork Fri Nov 17 09:17:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 119103 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp280044qgn; Fri, 17 Nov 2017 01:18:25 -0800 (PST) X-Google-Smtp-Source: AGs4zMZD4OgR4RKA7acZnYWcab4vQnjh1YKX9wbHVlunWn9QAqDiu02Jnb66fc7ZoDXqvRErVXrt X-Received: by 10.99.110.3 with SMTP id j3mr4531374pgc.70.1510910305530; Fri, 17 Nov 2017 01:18:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510910305; cv=none; d=google.com; s=arc-20160816; b=NAvfUnVdTyPDwL5GqZh7MUXaR7DQp1KXiBoDIcG9OT7oXAYH6wmsUG5VBFuU7nn+Y7 g/yVPswM22RowYjt3dqE2vWmSegTs7Bf2N7mbMS7ejgLHx6r8oWCarGZ9naZCHfFBRPY OZDeQ1KUbEnimDz2gjv4Atvmrpxi0AYqWRW5d7xCkqsWrx9C63nmBR4k7uIM6auXvrb0 xnFiuCgJxCzRld/+A7QiNW02zDp93aMCnJUZCaNB3qO3vmz5ovv1ryiXiRf2Io5g7Y+I Y1bzKO515UBfF25fiE1pxePVuFh2zP6i3uNxt4YkuVKXHR28sxVCpLAFqXqDo+zs3ys0 dldA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=5xpu6IBlTTFJbsxttIa2kxM8Sg3qBYFgikUI32h+eAM=; b=wAne46QFtSAbNX4y+gaQPevXfpZRYzLXMFEdCPz+VK/hgIQikRI1rlLn4a3oPX0Dy3 X0/UXbvQL1cLW9yVJjobIlqcBOPaqJnbuXxybK4Mzs55qh72FTGAzG0DaT3AMDiF91Gm RC9Cg0ubHZhCQtQletv3z8+YJ8CcdSe0Rn0QihU0Ex59pPAgBTvJoBO8cLUi9TltNrF3 eSoqjTBZTSFLt2djoRPRwkCtpAMnoIo4BNkJtnZOEjsAFMcaek6dOlFrrF/nfBvMa/80 L9GT4R0qt/yeMSK2j9k91X8XRgIGYQVtZntkMhYAqv8iNywhzWOpI+30/By3Ec8f3Onn p4wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=RWIRDARC; spf=pass (google.com: domain of gcc-patches-return-467094-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-467094-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id p189si2680231pfp.251.2017.11.17.01.18.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 01:18:25 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-467094-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=RWIRDARC; spf=pass (google.com: domain of gcc-patches-return-467094-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-467094-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=MqmvuXfTWse4z2BcFiEl+ckbUSFqI XJQR/sV27NkLLIyHR2Qc9f025g1bMQFKXZzdOaXNpfzP/W0UpkY3w/zxgo/QBKJb eib01uPK4aXgNZTCpBTHojueqRbOKnWgujL9aIfdTLy4pdAg9HTjQ9EKWQy10OWf gpwLdEaJJS/gjk= 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:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=8QQcWZmyZGTqGxCkI5n57wk5NLY=; b=RWI RDARCAcdBaexvXiAczXNf/GBI8NoCdzl/qGwWObgf10Kxrl8I0lE4AC6eO4qXx5X 2IOZyTLMpJi7Wu3dzj0+32MRznsbzZgqs43+89QFHz4RRceWUggS0388LoWEZkG/ c0AosLxs7eR1VZokRxJFsnHuZZb18l8ojuEtHcR8= Received: (qmail 113584 invoked by alias); 17 Nov 2017 09:17:46 -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 113516 invoked by uid 89); 17 Nov 2017 09:17:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=wash, 9077, 21697, 12207 X-HELO: mail-wr0-f177.google.com Received: from mail-wr0-f177.google.com (HELO mail-wr0-f177.google.com) (209.85.128.177) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Nov 2017 09:17:43 +0000 Received: by mail-wr0-f177.google.com with SMTP id z75so165957wrc.5 for ; Fri, 17 Nov 2017 01:17:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=5xpu6IBlTTFJbsxttIa2kxM8Sg3qBYFgikUI32h+eAM=; b=BesEGK3xg//HO9TUS5LEfsTkhCqKWKamMNU3D/Tls61SICZt/BJX1VMiHBQXpdO8Rm Tqo0BifsVbqHEBgm6/4N3sLFXrUmTv2YG6xUr3eEQy+Bmv/Rl84aVwf8VhlnEugCT3Yo oLxXABdj+fFwo9sQCHjWBhP/QVYo/dkjdFAgO8cfZUV9gWysr/QNxPeJaim4sV3qQB+f 4vs9cqCsRqS0B/5bJiuCR0IQkz6sGEngwgRv9I68KxlguvnckXe3BuePOkOLxpBD684B iaNh3uBKqyApdTG7uj/j32yJjzYAvca+1IHPULzrIiarxQEzOTnpLzcuAzQcxmPOG8EQ DoRA== X-Gm-Message-State: AJaThX7aTUNIwD1VZFovfa2zKxXJtWi5orpyefMXFjarg9cZAsrsJFyb 6NtBuOH46H2xKLeC/kdmFL4hRE0E2ew= X-Received: by 10.223.163.216 with SMTP id m24mr3709139wrb.107.1510910260970; Fri, 17 Nov 2017 01:17:40 -0800 (PST) Received: from localhost ([2.25.234.120]) by smtp.gmail.com with ESMTPSA id x63sm3330281wma.39.2017.11.17.01.17.40 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 Nov 2017 01:17:40 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [2/7] Make vect_model_store_cost take a vec_load_store_type References: <87375d2rkr.fsf@linaro.org> Date: Fri, 17 Nov 2017 09:17:38 +0000 In-Reply-To: <87375d2rkr.fsf@linaro.org> (Richard Sandiford's message of "Fri, 17 Nov 2017 09:16:20 +0000") Message-ID: <87tvxt1cy5.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 This patch makes vect_model_store_cost take a vec_load_store_type instead of a vect_def_type. It's a wash on its own, but it helps with later patches. Richard 2017-11-17 Richard Sandiford gcc/ * tree-vectorizer.h (vec_load_store_type): Moved from tree-vec-stmts.c (vect_model_store_cost): Take a vec_load_store_type instead of a vect_def_type. * tree-vect-stmts.c (vec_load_store_type): Move to tree-vectorizer.h. (vect_model_store_cost): Take a vec_load_store_type instead of a vect_def_type. (vectorizable_mask_load_store): Update accordingly. (vectorizable_store): Likewise. * tree-vect-slp.c (vect_analyze_slp_cost_1): Update accordingly. Index: gcc/tree-vectorizer.h =================================================================== --- gcc/tree-vectorizer.h 2017-11-17 09:06:36.818836579 +0000 +++ gcc/tree-vectorizer.h 2017-11-17 09:06:46.238323981 +0000 @@ -520,6 +520,14 @@ enum slp_vect_type { hybrid }; +/* Says whether a statement is a load, a store of a vectorized statement + result, or a store of an invariant value. */ +enum vec_load_store_type { + VLS_LOAD, + VLS_STORE, + VLS_STORE_INVARIANT +}; + /* Describes how we're going to vectorize an individual load or store, or a group of loads or stores. */ enum vect_memory_access_type { @@ -1220,7 +1228,7 @@ extern void vect_model_simple_cost (stmt int, stmt_vector_for_cost *, stmt_vector_for_cost *); extern void vect_model_store_cost (stmt_vec_info, int, vect_memory_access_type, - enum vect_def_type, slp_tree, + vec_load_store_type, slp_tree, stmt_vector_for_cost *, stmt_vector_for_cost *); extern void vect_model_load_cost (stmt_vec_info, int, vect_memory_access_type, Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c 2017-11-17 09:06:42.553230162 +0000 +++ gcc/tree-vect-stmts.c 2017-11-17 09:06:46.238323981 +0000 @@ -52,14 +52,6 @@ Software Foundation; either version 3, o /* For lang_hooks.types.type_for_mode. */ #include "langhooks.h" -/* Says whether a statement is a load, a store of a vectorized statement - result, or a store of an invariant value. */ -enum vec_load_store_type { - VLS_LOAD, - VLS_STORE, - VLS_STORE_INVARIANT -}; - /* Return the vectorized type for the given statement. */ tree @@ -906,7 +898,7 @@ vect_model_promotion_demotion_cost (stmt void vect_model_store_cost (stmt_vec_info stmt_info, int ncopies, vect_memory_access_type memory_access_type, - enum vect_def_type dt, slp_tree slp_node, + vec_load_store_type vls_type, slp_tree slp_node, stmt_vector_for_cost *prologue_cost_vec, stmt_vector_for_cost *body_cost_vec) { @@ -915,7 +907,7 @@ vect_model_store_cost (stmt_vec_info stm gimple *first_stmt = STMT_VINFO_STMT (stmt_info); bool grouped_access_p = STMT_VINFO_GROUPED_ACCESS (stmt_info); - if (dt == vect_constant_def || dt == vect_external_def) + if (vls_type == VLS_STORE_INVARIANT) prologue_cost += record_stmt_cost (prologue_cost_vec, 1, scalar_to_vec, stmt_info, 0, vect_prologue); @@ -2169,7 +2161,7 @@ vectorizable_mask_load_store (gimple *st NULL, NULL, NULL); else vect_model_store_cost (stmt_info, ncopies, memory_access_type, - dt, NULL, NULL, NULL); + vls_type, NULL, NULL, NULL); return true; } gcc_assert (memory_access_type == STMT_VINFO_MEMORY_ACCESS_TYPE (stmt_info)); @@ -5797,8 +5789,8 @@ vectorizable_store (gimple *stmt, gimple STMT_VINFO_TYPE (stmt_info) = store_vec_info_type; /* The SLP costs are calculated during SLP analysis. */ if (!PURE_SLP_STMT (stmt_info)) - vect_model_store_cost (stmt_info, ncopies, memory_access_type, dt, - NULL, NULL, NULL); + vect_model_store_cost (stmt_info, ncopies, memory_access_type, + vls_type, NULL, NULL, NULL); return true; } gcc_assert (memory_access_type == STMT_VINFO_MEMORY_ACCESS_TYPE (stmt_info)); Index: gcc/tree-vect-slp.c =================================================================== --- gcc/tree-vect-slp.c 2017-11-17 09:06:36.818836579 +0000 +++ gcc/tree-vect-slp.c 2017-11-17 09:06:46.237364571 +0000 @@ -1724,7 +1724,7 @@ vect_analyze_slp_cost_1 (slp_instance in : VMAT_CONTIGUOUS); if (DR_IS_WRITE (STMT_VINFO_DATA_REF (stmt_info))) vect_model_store_cost (stmt_info, ncopies_for_cost, - memory_access_type, vect_uninitialized_def, + memory_access_type, VLS_STORE, node, prologue_cost_vec, body_cost_vec); else {