From patchwork Wed Dec 13 12:31:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 82053 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 50DEB382F914 for ; Wed, 13 Dec 2023 12:32:58 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 86031385DC0C for ; Wed, 13 Dec 2023 12:32:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 86031385DC0C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 86031385DC0C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702470736; cv=none; b=eU19Xprv6qE7MTgvuAHszhokIP0jeoIrTGZVQcfAHp0h07xnD7HuIpBKdlOx/qHODfJ3IPlX7peG7KItuFKk9Cs02dR50ge4ktvlK971IIUikhxyNptq0wr+rMmCSrzw4nHeP4iUyct1UPCZ642qmKKw3QC09AvBgLDtQHEUVSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702470736; c=relaxed/simple; bh=9AoLUVakKT9MoJY2SO6oIUmTGVWy+UdS9k6hQaoUBTs=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=SAF0syDqLpcHP6cAQsAuVFc5CQ2hWQtWDokHyDoOfkYIRvY8KxOIoIUnao7KqYOaP1P3JOOCUJqQLSlN0QRbBkBRy/3dUHzI3dhDK9PIeLtcg6EhQA1e/FFjNQePp3ggIskRTstK1/KEUCCXovKKEOuIzjuhUjBdqomP/pM3//4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [10.168.4.150] (unknown [10.168.4.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7D59E1F394 for ; Wed, 13 Dec 2023 12:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702470729; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=mfXlIng+8FgI0E2tngmvDv1pQx+ENORQ55TmFs5hFP0=; b=vr4LiQp4M6BjeEXALl5rc3FxbEHFBkzOcXzZeKFNoPF4ZJJ00M9N0eEtNjixnNH4hKGCLK PNaFePrv3ZjC+95+QSCpsEY5SlkfumB4UIIici+D0vfds01KCNxeGDqgtP2vlBM9pkRPcw xm0RBT3BP4mo6wMQc1ZCBcXxZ+aYbRo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702470729; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=mfXlIng+8FgI0E2tngmvDv1pQx+ENORQ55TmFs5hFP0=; b=FcsFUZpA79giVhPs/7BSc2QLXYPfpvt1QoYvAP/5gKEfMOdlE+3/JgZ7nXuW818yhXSU4L +UYdDCnKFE30oSBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1702470729; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=mfXlIng+8FgI0E2tngmvDv1pQx+ENORQ55TmFs5hFP0=; b=vr4LiQp4M6BjeEXALl5rc3FxbEHFBkzOcXzZeKFNoPF4ZJJ00M9N0eEtNjixnNH4hKGCLK PNaFePrv3ZjC+95+QSCpsEY5SlkfumB4UIIici+D0vfds01KCNxeGDqgtP2vlBM9pkRPcw xm0RBT3BP4mo6wMQc1ZCBcXxZ+aYbRo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1702470729; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=mfXlIng+8FgI0E2tngmvDv1pQx+ENORQ55TmFs5hFP0=; b=FcsFUZpA79giVhPs/7BSc2QLXYPfpvt1QoYvAP/5gKEfMOdlE+3/JgZ7nXuW818yhXSU4L +UYdDCnKFE30oSBQ== Date: Wed, 13 Dec 2023 13:31:05 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/6] Query an appropriate offset vector type in vect_gather_scatter_fn_p MIME-Version: 1.0 X-Spam-Score: 1.88 Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: 4.17 X-Spamd-Result: default: False [4.17 / 50.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(2.88)[0.961]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; MISSING_MID(2.50)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-1.11)[88.32%] X-Spam-Flag: NO X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, SPF_PASS, 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 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+patchwork=sourceware.org@gcc.gnu.org Message-Id: <20231213123258.50DEB382F914@sourceware.org> The gather_load optab and friends require the offset vector mode to have the same number of lanes as the data vector mode. Restrict the vector type query to that when searching for a proper offset type. * tree-vect-data-refs.cc (vect_gather_scatter_fn_p): Use get_related_vectype_for_scalar_type to get at the offset vector type. --- gcc/tree-vect-data-refs.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index 107dffe0a64..59e296e7976 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -3913,7 +3913,7 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo) *IFN_OUT and the vector type for the offset in *OFFSET_VECTYPE_OUT. */ bool -vect_gather_scatter_fn_p (vec_info *vinfo, bool read_p, bool masked_p, +vect_gather_scatter_fn_p (vec_info *, bool read_p, bool masked_p, tree vectype, tree memory_type, tree offset_type, int scale, internal_fn *ifn_out, tree *offset_vectype_out) @@ -3948,13 +3948,18 @@ vect_gather_scatter_fn_p (vec_info *vinfo, bool read_p, bool masked_p, for (;;) { - tree offset_vectype = get_vectype_for_scalar_type (vinfo, offset_type); - if (!offset_vectype) - return false; + /* The optabs require the same number of elements in the offset + vector as in the data vector. */ + tree offset_vectype + = get_related_vectype_for_scalar_type (TYPE_MODE (vectype), offset_type, + TYPE_VECTOR_SUBPARTS (vectype)); /* Test whether the target supports this combination. */ - if (internal_gather_scatter_fn_supported_p (ifn, vectype, memory_type, - offset_vectype, scale)) + if (!offset_vectype) + ; + else if (internal_gather_scatter_fn_supported_p (ifn, vectype, + memory_type, + offset_vectype, scale)) { *ifn_out = ifn; *offset_vectype_out = offset_vectype;