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: 177946 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp7740246dys; Wed, 13 Dec 2023 04:33:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEhXjAhZJbQCKFqHa1VWrkpjeqtUn5Ber/lGPv35r/E/qJWWm50Yqwo+3GAYS0JTvji+MWG X-Received: by 2002:a05:620a:2401:b0:77f:684:5b1 with SMTP id d1-20020a05620a240100b0077f068405b1mr12712533qkn.47.1702470829002; Wed, 13 Dec 2023 04:33:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702470828; cv=pass; d=google.com; s=arc-20160816; b=dLyIjHvBOKWDvlcxZUefVryU7xWZY7LPZgzLExPazw0DZ7Qkpn0xQuDWU5VsW+oEG0 SgOIkG+rtS0+9ESrEohWva9k9oQ8f4I1yxK4rknD8dyJbM6kchTPuQ2iu5xaNv9G7KAS Ew1VSPcE9CgsJA9qVV02JOuL0icb825b0e47DpHbk12AF4BSOm/WiO5fbwyqgwb1vSaK HH38BMOkpNNoMAprOJjibq7qQpijZRJxgN/PQ18K7OrfiEZ2GAFu5fkmEZ9DgdyxsvJa 6I/N8QX+oLCBTT6EEMr64+flEcI4bjIc/Rr61FUScwwZfMmr5uuQa2Awt6P4Pj5KKOkZ M15w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:errors-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :subject:to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=mfXlIng+8FgI0E2tngmvDv1pQx+ENORQ55TmFs5hFP0=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=ISoK6Wygz3hC8548dGA3bW9khUVCG5eL2Jv23dFEZx6jXr3WpbwsnQtF9mHXFmBO+D h98DimHjI3iTLNFEJje3PPCdWYoQD4zfUfmGxRqPhp4HprcBSOutMQEF4CgnUxtV0TVk QojJn5ddzgHS85EClbciI0YLEAUiC9lGs9Wfldvnxm7DM7u/LXffKbAjMKGyW7V1gP5H CNjnteLzL9P8ISVKeBDJRXtp0x97EoDTfZ0TEZ8HdDMmXQ56OArtXyfCZzpb66tL/yVi AZQtP1GaQTzv6XBEcV/wRpirdKGoYABKN1O/0+FhLB5QQSmuQn4x29dGh0uHoIuibtUt QE4A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=vr4LiQp4; dkim=neutral (no key) header.i=@suse.de header.b=FcsFUZpA; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=vr4LiQp4; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id m16-20020a05620a291000b0077892f61ac1si2414328qkp.616.2023.12.13.04.33.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 04:33:48 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=vr4LiQp4; dkim=neutral (no key) header.i=@suse.de header.b=FcsFUZpA; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=vr4LiQp4; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2BC39388300A for ; Wed, 13 Dec 2023 12:33:06 +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+ouuuleilei=gmail.com@gcc.gnu.org Message-Id: <20231213123306.2BC39388300A@sourceware.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785170051672612474 X-GMAIL-MSGID: 1785170051672612474 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;