From patchwork Wed Jun 26 12:36:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1952588 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=CiwXmgsE; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SO+D5Q//; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=CiwXmgsE; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=SO+D5Q//; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; 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 [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4W8Ln02dB4z20X1 for ; Wed, 26 Jun 2024 22:37:07 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A4301387086D for ; Wed, 26 Jun 2024 12:37:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 5BFE0387086D for ; Wed, 26 Jun 2024 12:36:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5BFE0387086D 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 5BFE0387086D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719405401; cv=none; b=ZSXON8j4i33pzRkS7FE/wRCg8yikkdIzPhiITLkHqyBVPnlCuulXG+bIZH7mss/rsg7SEFODv9QvUZ1hVDedJZp3WoXpOuL3EJ8kDVkDkx8+WR6cYDLRU2O405KTo1RaZlkhsXW4YeMl2bMLVYb89jdQBB6As56s0UnVM596YZ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719405401; c=relaxed/simple; bh=ryTfc2VjPgjoPccnp2tcOg86IAFeUJzFpL/9Zy+8OvM=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=vorCAfztMB/k8ZDl1Zy7Mg4Ca64gEVaZlOKIwx/BWbIjYhv8i0xzZMjzRrhZ7Km8fymcXdhoPPLtx/Utid5O58tMHTLS5NKN8e6lrvHJ6abVcQggBg7r+WK8WSDa7099IC/OzrOQC5HO3LgfZIm+9tzt8giCaZwR7ksZHLiM8Ys= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from murzim.nue2.suse.org (unknown [10.168.4.243]) (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-out1.suse.de (Postfix) with ESMTPS id 2FBDE21AB7 for ; Wed, 26 Jun 2024 12:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719405398; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=nj/D4pPS4YN8pajCtQc8zhP8D3eLEYPzMkHiJO3sgy4=; b=CiwXmgsEzZa1FvxiNCdalxUHezECTluU/Xmsk+zXbr3nU/tdLGJ4x/IDLfOCF3hFtFBOI5 RlAd8nHH2cRKUceLUzO0jOukAfbtbXPRvxKOl1wUz6dvSBxfL3Tc2rdrALXXTclGvpPY4l jbf9ygS6hLOG4YeGuKDL0o+Yw/GVBEo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719405398; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=nj/D4pPS4YN8pajCtQc8zhP8D3eLEYPzMkHiJO3sgy4=; b=SO+D5Q//ZFNfr4kBOV80A1K/r5P00RaSNweMhwzO997uxBt0HtTh74BzaJsa2ARiEirvLj p5ySx8O143emTGBg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1719405398; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=nj/D4pPS4YN8pajCtQc8zhP8D3eLEYPzMkHiJO3sgy4=; b=CiwXmgsEzZa1FvxiNCdalxUHezECTluU/Xmsk+zXbr3nU/tdLGJ4x/IDLfOCF3hFtFBOI5 RlAd8nHH2cRKUceLUzO0jOukAfbtbXPRvxKOl1wUz6dvSBxfL3Tc2rdrALXXTclGvpPY4l jbf9ygS6hLOG4YeGuKDL0o+Yw/GVBEo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1719405398; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=nj/D4pPS4YN8pajCtQc8zhP8D3eLEYPzMkHiJO3sgy4=; b=SO+D5Q//ZFNfr4kBOV80A1K/r5P00RaSNweMhwzO997uxBt0HtTh74BzaJsa2ARiEirvLj p5ySx8O143emTGBg== Date: Wed, 26 Jun 2024 14:36:38 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/115640 - outer loop vect with inner SLP permute MIME-Version: 1.0 X-Spam-Score: -1.11 X-Spam-Level: X-Spamd-Result: default: False [-1.11 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MISSING_MID(2.50)[]; NEURAL_HAM_LONG(-0.88)[-0.875]; NEURAL_SPAM_SHORT(0.36)[0.120]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; MISSING_XM_UA(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_NONE(0.00)[]; MIME_TRACE(0.00)[0:+] X-Spam-Status: No, score=-10.5 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 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 Message-Id: <20240626123705.A4301387086D@sourceware.org> The following fixes wrong-code when using outer loop vectorization and an inner loop SLP access with permutation. A wrong adjustment to the IV increment is then applied on GCN. Bootstrap and regtest running on x86_64-unknown-linux-gnu. PR tree-optimization/115640 * tree-vect-stmts.cc (vectorizable_load): With an inner loop SLP access to not apply a gap adjustment. --- gcc/tree-vect-stmts.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 1fa92a0dc13..9697b8ca39c 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -10597,9 +10597,14 @@ vectorizable_load (vec_info *vinfo, whole group, not only the number of vector stmts the permutation result fits in. */ unsigned scalar_lanes = SLP_TREE_LANES (slp_node); - if (slp_perm - && (group_size != scalar_lanes - || !multiple_p (nunits, group_size))) + if (nested_in_vect_loop) + /* We do not support grouped accesses in a nested loop, + instead the access is contiguous but it might be + permuted. No gap adjustment is needed though. */ + vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node); + else if (slp_perm + && (group_size != scalar_lanes + || !multiple_p (nunits, group_size))) { /* We don't yet generate such SLP_TREE_LOAD_PERMUTATIONs for variable VF; see vect_transform_slp_perm_load. */