From patchwork Wed Jun 19 09:41:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1949601 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=l3qUeUS+; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=e3P33bpU; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=l3qUeUS+; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=e3P33bpU; 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 4W3zCf5LKsz20Wb for ; Wed, 19 Jun 2024 19:41:34 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B6BE838845A6 for ; Wed, 19 Jun 2024 09:41:32 +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 90F77388450F for ; Wed, 19 Jun 2024 09:41:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 90F77388450F 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 90F77388450F 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=1718790068; cv=none; b=de5TLak5WXrPCS19FGUSmOCIWb9XgcUGyoy1kMMThHciyY2E/mo7O1hlDgL2VqPQfky96fHCPc/mjCJN/a0vOR2AxBpfsca3W4FVvhZvGPxVuDNwRsLkCTOcI+u8KgRcSSPex9iwehJ58FdpDl7yt52wnhsZxFoCFI2MgqOweNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718790068; c=relaxed/simple; bh=SMc5HTsmWq5ZkUOnD9wH0iELgKhOsqCvDlojoTp0kxs=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=psSX1lEENGlHyY/UjfTTqvYiX/VZYq/VeJbF1DXDwJHMpOb1soy9CfjZzAyOoi/4UeEOEuQHe1DQpJ4IB8VXH7MhbD22ew1QNW/JuFpx9jcoJ05+L7ACpJnQq2Rk8NUuLCIMKF5ArWfAIP2XK9GFqUW+4dWPlx0sq6DwAZTCgtc= 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-out2.suse.de (Postfix) with ESMTPS id A13551F803 for ; Wed, 19 Jun 2024 09:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718790062; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=mtrKryWpkgHas7sSI9vlsr7hECfEvDNmDTgHIaKFmRA=; b=l3qUeUS+lVlt2O4KD8UlgsSc2bCDhGCD49Lv3bMf+vmBb3NFJQUkveUYAe/OBm2at4B+op 8qOCJLLVxC1HLvcN49LsEiXrIXF26/n9tfzMI/YWAI9QTK2FxKYRjQ937XDXkdGqN+NFVR +dkM7GIZMjfamnMqHlUbadMEkozQdDw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718790062; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=mtrKryWpkgHas7sSI9vlsr7hECfEvDNmDTgHIaKFmRA=; b=e3P33bpUpuAkZawrOtqb2i83Ir+rJ31jLh5oycBJVGWUpbMVg0l4XuMDWi/+lxLyVx/nwQ jev86J5cOvgXYmAg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718790062; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=mtrKryWpkgHas7sSI9vlsr7hECfEvDNmDTgHIaKFmRA=; b=l3qUeUS+lVlt2O4KD8UlgsSc2bCDhGCD49Lv3bMf+vmBb3NFJQUkveUYAe/OBm2at4B+op 8qOCJLLVxC1HLvcN49LsEiXrIXF26/n9tfzMI/YWAI9QTK2FxKYRjQ937XDXkdGqN+NFVR +dkM7GIZMjfamnMqHlUbadMEkozQdDw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718790062; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=mtrKryWpkgHas7sSI9vlsr7hECfEvDNmDTgHIaKFmRA=; b=e3P33bpUpuAkZawrOtqb2i83Ir+rJ31jLh5oycBJVGWUpbMVg0l4XuMDWi/+lxLyVx/nwQ jev86J5cOvgXYmAg== Date: Wed, 19 Jun 2024 11:41:02 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Improve gcc.dg/vect/bb-slp-32.c testcase MIME-Version: 1.0 X-Spamd-Result: default: False [1.00 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MISSING_MID(2.50)[]; NEURAL_SPAM_SHORT(2.46)[0.819]; NEURAL_HAM_LONG(-0.86)[-0.856]; 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-Score: 1.00 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, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Message-Id: <20240619094132.B6BE838845A6@sourceware.org> The following adds a correctness check to the combined store/reduce vectorization. Tested on x86_64-unknown-linux-gnu, pushed. * gcc.dg/vect/bb-slp-32.c: Add check for correctness. --- gcc/testsuite/gcc.dg/vect/bb-slp-32.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-32.c b/gcc/testsuite/gcc.dg/vect/bb-slp-32.c index f10442e6d56..4f72727b694 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-32.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-32.c @@ -1,14 +1,15 @@ -/* { dg-do compile } */ /* { dg-require-effective-target vect_int } */ /* { dg-additional-options "-fvect-cost-model=dynamic" } */ -void bar (int *); -int foo (int *p, int a, int b) +#include "tree-vect.h" + +int __attribute__((noipa)) +foo (int * __restrict__ x, int *p, int a, int b) { - int x[4]; + p = __builtin_assume_aligned (p, __BIGGEST_ALIGNMENT__); + x = __builtin_assume_aligned (x, __BIGGEST_ALIGNMENT__); int tem0, tem1, tem2, tem3; int sum = 0; - p = __builtin_assume_aligned (p, __BIGGEST_ALIGNMENT__); tem0 = p[0] + 1 + a; sum += tem0; x[0] = tem0; @@ -21,6 +22,19 @@ int foo (int *p, int a, int b) tem3 = p[3] + 4 + a; sum += tem3; x[3] = tem3; - bar (x); return sum; } + +int x[4] __attribute__((aligned(__BIGGEST_ALIGNMENT__))); +int p[4] __attribute__((aligned(__BIGGEST_ALIGNMENT__))) = { 0, 1, 2, 3 }; + +int main() +{ + check_vect (); + + if (foo (x, p, 7, 13) != 56) + abort (); + if (x[0] != 8 || x[1] != 16 || x[2] != 18 || x[3] != 14) + abort (); + return 0; +}