From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 1A63A38582A0 for ; Tue, 30 Jan 2024 14:32:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1A63A38582A0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1A63A38582A0 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706625146; cv=none; b=fcSGQ/SoNJXbUfQTuhpGgUfmbe4SJNj878QPpYC5rcowt/StRP89JVTrAcQTSsSKXRsd+CJD0k6Ugp8XAWCRLJucj17PQDgVR/79X+o2uwLft80oVDRwp+2WamDX2aPfvSEGI3ZveTlYh7uhwcELPklSojhCpfOBMT7XiCP9gUY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706625146; c=relaxed/simple; bh=ynQfSAYX193yoWWaRm3cd6lqPEHB2y881+sB6dpqVfE=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=FvtF6a/RSlo03ECxGauXCH+54fhW9lbMNd5TiXEPtWSrWx6FgAG3NUaCSVGvzJhh0dJwmOlrGrif1hB55s52y7azZIIW8yEYW/7C/5Arh4rdMFSsjOe9qu69is5bkHd5UlsE2HYHUMiIa24v0mVzgz7k1WQ/X/gILLIJuik+wRk= ARC-Authentication-Results: i=1; server2.sourceware.org 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 C4C11139F; Tue, 30 Jan 2024 06:33:05 -0800 (PST) Received: from e107157-lin.cambridge.arm.com (e107157-lin.cambridge.arm.com [10.2.78.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D01E63F762; Tue, 30 Jan 2024 06:32:20 -0800 (PST) From: Andre Vieira To: gcc-patches@gcc.gnu.org Cc: Richard.Sandiford@arm.com, rguenther@suse.de, Andre Vieira Subject: [PATCH 1/3] vect: Pass stmt_vec_info to TARGET_SIMD_CLONE_USABLE Date: Tue, 30 Jan 2024 14:31:30 +0000 Message-Id: <20240130143132.9575-2-andre.simoesdiasvieira@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240130143132.9575-1-andre.simoesdiasvieira@arm.com> References: <20240130143132.9575-1-andre.simoesdiasvieira@arm.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.17.1" X-Spam-Status: No, score=-13.1 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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is a multi-part message in MIME format. --------------2.17.1 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit This patch adds stmt_vec_info to TARGET_SIMD_CLONE_USABLE to make sure the target can reject a simd_clone based on the vector mode it is using. This is needed because for VLS SVE vectorization the vectorizer accepts Advanced SIMD simd clones when vectorizing using SVE types because the simdlens might match. This will cause type errors later on. Other targets do not currently need to use this argument. gcc/ChangeLog: * target.def (TARGET_SIMD_CLONE_USABLE): Add argument. * tree-vect-stmts.cc (vectorizable_simd_clone_call): Pass stmt_info to call TARGET_SIMD_CLONE_USABLE. * config/aarch64/aarch64.cc (aarch64_simd_clone_usable): Add argument and use it to reject the use of SVE simd clones with Advanced SIMD modes. * config/gcn/gcn.cc (gcn_simd_clone_usable): Add unused argument. * config/i386/i386.cc (ix86_simd_clone_usable): Likewise. --------------2.17.1 Content-Type: text/x-patch; name="0001-vect-Pass-stmt_vec_info-to-TARGET_SIMD_CLONE_USABLE.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0001-vect-Pass-stmt_vec_info-to-TARGET_SIMD_CLONE_USABLE.patch" diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index a37d47b243e..31617510160 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -28694,13 +28694,16 @@ aarch64_simd_clone_adjust (struct cgraph_node *node) /* Implement TARGET_SIMD_CLONE_USABLE. */ static int -aarch64_simd_clone_usable (struct cgraph_node *node) +aarch64_simd_clone_usable (struct cgraph_node *node, stmt_vec_info stmt_vinfo) { switch (node->simdclone->vecsize_mangle) { case 'n': if (!TARGET_SIMD) return -1; + if (STMT_VINFO_VECTYPE (stmt_vinfo) + && aarch64_sve_mode_p (TYPE_MODE (STMT_VINFO_VECTYPE (stmt_vinfo)))) + return -1; return 0; default: gcc_unreachable (); diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc index e80de2ce056..c48b212d9e6 100644 --- a/gcc/config/gcn/gcn.cc +++ b/gcc/config/gcn/gcn.cc @@ -5658,7 +5658,8 @@ gcn_simd_clone_adjust (struct cgraph_node *ARG_UNUSED (node)) /* Implement TARGET_SIMD_CLONE_USABLE. */ static int -gcn_simd_clone_usable (struct cgraph_node *ARG_UNUSED (node)) +gcn_simd_clone_usable (struct cgraph_node *ARG_UNUSED (node), + stmt_vec_info ARG_UNUSED (stmt_vinfo)) { /* We don't need to do anything here because gcn_simd_clone_compute_vecsize_and_simdlen currently only returns one diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index b3e7c74846e..63e6b9d2643 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -25193,7 +25193,8 @@ ix86_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node, slightly less desirable, etc.). */ static int -ix86_simd_clone_usable (struct cgraph_node *node) +ix86_simd_clone_usable (struct cgraph_node *node, + stmt_vec_info ARG_UNUSED (stmt_vinfo)) { switch (node->simdclone->vecsize_mangle) { diff --git a/gcc/target.def b/gcc/target.def index fdad7bbc93e..4fade9c4eec 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -1648,7 +1648,7 @@ DEFHOOK in vectorized loops in current function, or non-negative number if it is\n\ usable. In that case, the smaller the number is, the more desirable it is\n\ to use it.", -int, (struct cgraph_node *), NULL) +int, (struct cgraph_node *, _stmt_vec_info *), NULL) HOOK_VECTOR_END (simd_clone) diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 1dbe1115da4..da02082c034 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -4074,7 +4074,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, this_badness += floor_log2 (num_calls) * 4096; if (n->simdclone->inbranch) this_badness += 8192; - int target_badness = targetm.simd_clone.usable (n); + int target_badness = targetm.simd_clone.usable (n, stmt_info); if (target_badness < 0) continue; this_badness += target_badness * 512; --------------2.17.1--