From patchwork Fri Nov 12 17:37:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 47543 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 85D343858410 for ; Fri, 12 Nov 2021 17:39:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 85D343858410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1636738750; bh=dNfdVcAVvCjeAzT2H8MlVIPXM7HXHEF/yKsAeLUTeDI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=nULgwWdL3uJ3l0HEVWFxJAF08oKozCYo+v/6RkMqduDJ9I632F/wqa0khZCAaeFwV XYJ+yiU5A6Wec9LM0o1elfUWwXXXYBmo0di4BwYhsoXJVSxAbJOtUkiSvF8ya450iV fL3xWJOXWyebX/AistiCSyrADcZ5mM7ELHZ8amvs= 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 293FA3858022 for ; Fri, 12 Nov 2021 17:37:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 293FA3858022 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 D7377D6E for ; Fri, 12 Nov 2021 09:37:50 -0800 (PST) Received: from localhost (unknown [10.32.98.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7C7483F718 for ; Fri, 12 Nov 2021 09:37:50 -0800 (PST) To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [committed] aarch64: Get floatness from stmt_info Date: Fri, 12 Nov 2021 17:37:49 +0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Richard Sandiford via Gcc-patches From: Richard Sandiford Reply-To: Richard Sandiford Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This patch gets the floatness of a memory access from the data reference rather than the vectype. This makes it more suitable for use in scalar costing code. Tested on aarch64-linux-gnu & applied. Richard gcc/ * config/aarch64/aarch64.c (aarch64_dr_type): New function. (aarch64_vector_costs::count_ops): Use it rather than the vectype to determine floatness. --- gcc/config/aarch64/aarch64.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 416362beefd..d8bbc66c226 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -14920,6 +14920,16 @@ aarch64_simd_vec_costs_for_flags (unsigned int flags) return costs->advsimd; } +/* If STMT_INFO is a memory reference, return the scalar memory type, + otherwise return null. */ +static tree +aarch64_dr_type (stmt_vec_info stmt_info) +{ + if (auto dr = STMT_VINFO_DATA_REF (stmt_info)) + return TREE_TYPE (DR_REF (dr)); + return NULL_TREE; +} + /* Decide whether to use the unrolling heuristic described above m_unrolled_advsimd_niters, updating that field if so. LOOP_VINFO describes the loop that we're vectorizing. */ @@ -15649,7 +15659,7 @@ aarch64_vector_costs::count_ops (unsigned int count, vect_cost_for_stmt kind, prev_count = num_copies; } ops->loads += num_copies; - if (vec_flags || FLOAT_TYPE_P (vectype)) + if (vec_flags || FLOAT_TYPE_P (aarch64_dr_type (stmt_info))) ops->general_ops += base_issue->fp_simd_load_general_ops * num_copies; break; @@ -15657,7 +15667,7 @@ aarch64_vector_costs::count_ops (unsigned int count, vect_cost_for_stmt kind, case unaligned_store: case scalar_store: ops->stores += num_copies; - if (vec_flags || FLOAT_TYPE_P (vectype)) + if (vec_flags || FLOAT_TYPE_P (aarch64_dr_type (stmt_info))) ops->general_ops += base_issue->fp_simd_store_general_ops * num_copies; break; }