From patchwork Fri Oct 4 10:40:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1992694 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XKlVB2f45z1xt7 for ; Fri, 4 Oct 2024 20:42:10 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DF4603844764 for ; Fri, 4 Oct 2024 10:42:07 +0000 (GMT) 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 91CF5385DDFC for ; Fri, 4 Oct 2024 10:41:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 91CF5385DDFC 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 91CF5385DDFC 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=1728038497; cv=none; b=UfNQsGzGS1wBrUuWnK0yhiNRowLdPSWBK1vt3soqQ2kYIQuy9BtAIDxcu3GVUb//NfrEIStOPktGdh7WjFjfIZPSEwaDVaZIeMkK73gjdeiymuiC+vnntdfED0an6lh9QXmHdJE7FvvnZnwA2lL9cEWjbWsXqSpADD2xhShtFlw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728038497; c=relaxed/simple; bh=clvvjOI878QY8m5DULswV2kdeMNWmTddDh1Xjx4/Kxg=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=SgABxjCZ7OhKT84vOIfa2Tcw8S1Ai7STd2FxY5tOu2DbJv8Jo0phvv/iQVX4EuWWK4dJifigQ/Cste+aGJ/WaY2zW2NuFGTnoIcV6SXu9TPQD1fp4BdzFTVYMShYqEIHQ3hAZssXBsQgWIy4d2/UtEQ3ItNFdyb/sYLehQDPweI= 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 D8FFC497; Fri, 4 Oct 2024 03:42:05 -0700 (PDT) Received: from e121540-lin.manchester.arm.com (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8C80E3F640; Fri, 4 Oct 2024 03:41:35 -0700 (PDT) From: Richard Sandiford To: rguenther@suse.de, tamar.christina@arm.com, gcc-patches@gcc.gnu.org Cc: Richard Sandiford Subject: [PATCH 1/4] vect: Variable lane indices in vectorizable_slp_permutation_1 Date: Fri, 4 Oct 2024 11:40:51 +0100 Message-Id: <20241004104054.2653382-2-richard.sandiford@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241004104054.2653382-1-richard.sandiford@arm.com> References: <20241004104054.2653382-1-richard.sandiford@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-18.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org The main patch for PR116583 needs to create variable indices into an input vector. This pre-patch changes the types to allow that. There is no pretty-print format for poly_uint64 because of issues with passing C++ objects through "...". gcc/ PR tree-optimization/116583 * tree-vect-slp.cc (vectorizable_slp_permutation_1): Using poly_uint64 for scalar lane indices. --- gcc/tree-vect-slp.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 482b9d50496..7aeda69f447 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -10296,8 +10296,8 @@ vectorizable_slp_permutation_1 (vec_info *vinfo, gimple_stmt_iterator *gsi, from the { SLP operand, scalar lane } permutation as recorded in the SLP node as intermediate step. This part should already work with SLP children with arbitrary number of lanes. */ - auto_vec, unsigned> > vperm; - auto_vec active_lane; + auto_vec, poly_uint64>> vperm; + auto_vec active_lane; vperm.create (olanes); active_lane.safe_grow_cleared (children.length (), true); for (unsigned i = 0; i < ncopies; ++i) @@ -10312,8 +10312,9 @@ vectorizable_slp_permutation_1 (vec_info *vinfo, gimple_stmt_iterator *gsi, { /* We checked above that the vectors are constant-length. */ unsigned vnunits = TYPE_VECTOR_SUBPARTS (vtype).to_constant (); - unsigned vi = (active_lane[p.first] + p.second) / vnunits; - unsigned vl = (active_lane[p.first] + p.second) % vnunits; + unsigned lane = active_lane[p.first].to_constant (); + unsigned vi = (lane + p.second) / vnunits; + unsigned vl = (lane + p.second) % vnunits; vperm.quick_push ({{p.first, vi}, vl}); } } @@ -10339,9 +10340,10 @@ vectorizable_slp_permutation_1 (vec_info *vinfo, gimple_stmt_iterator *gsi, ? multiple_p (i, npatterns) : multiple_p (i, TYPE_VECTOR_SUBPARTS (vectype)))) dump_printf (MSG_NOTE, ","); - dump_printf (MSG_NOTE, " vops%u[%u][%u]", - vperm[i].first.first, vperm[i].first.second, - vperm[i].second); + dump_printf (MSG_NOTE, " vops%u[%u][", + vperm[i].first.first, vperm[i].first.second); + dump_dec (MSG_NOTE, vperm[i].second); + dump_printf (MSG_NOTE, "]"); } dump_printf (MSG_NOTE, "\n"); }