From patchwork Wed Aug 7 12:43:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1970024 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=FqxKanGn; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=OcguZAkN; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=npkRkDJl; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Cyp5qJxK; 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 4Wf8xK4S9qz1ybS for ; Wed, 7 Aug 2024 22:43:49 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 34545385AC29 for ; Wed, 7 Aug 2024 12:43:47 +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 [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 0CBE43858428 for ; Wed, 7 Aug 2024 12:43:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0CBE43858428 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 0CBE43858428 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723034605; cv=none; b=EnqCnXkv2BCD9Meozf5iF1enXyseJJpfLMD8leXTH+ae7dkUPobkllFrnxPq6m5D+oxLCPd4GbUItbhHofIf3x8uoEUND5T3KAlX/MuQP416KJiT9WVC4pcJAC/yd/3AwJ+s8lsGKZBWy8AfAp0wB9UtcctOuTmNhbc1dREpnwM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723034605; c=relaxed/simple; bh=sGwWK7stqaynh+1aOTlKaPXwmxDpBZn3zcxISPr2Coc=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=dWhpP/kMexlKH+yyWhc5n2BO9N+JWiVwnszbKrFuNJR5jmVWQrW2/s5E3RgnE1oLWKjULJ8rnQ7calA3T4/SFRK376iD7u4eX1pXMcc27+PUjwbdARaPDxfY7+GCWz7QUYNtJUtE1ELBhe8cqolFA8d5EkzBCPf6WdgQasYnv28= 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 E50341FB8D for ; Wed, 7 Aug 2024 12:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1723034603; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=omwvzSV0frFzugIO6KyCITpwiQ2bYOGpaDC333RfeSs=; b=FqxKanGne5O1K1vdddQNuRWeHPNti/J++wmrQssAd88ULqT2By+jgyT9biqQYkXdNRhlPH IRXZLP2HaXrPreRFMwQAi3cduSH/ejf/N6l4QH3iGincUT0Vlv/5JQ67EZJz52X4LtLx3p awIOJg72CrJR0CUjLrL7/Cz6h+u2UVU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1723034603; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=omwvzSV0frFzugIO6KyCITpwiQ2bYOGpaDC333RfeSs=; b=OcguZAkNAKrmoCetsvLG62Cuz6/p22+XCKALCNdNqlZpdQiPv1di/9bzEx11Xxp8mG7Fku UYIphUOvqWVfxODQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1723034602; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=omwvzSV0frFzugIO6KyCITpwiQ2bYOGpaDC333RfeSs=; b=npkRkDJl80/ajZpelYr0YCGK70LEu2YaD3B2r4HhnhgTduHSLXhixYKoubZ089RiMrV039 fPgj0zrhUDRU8xIbPT5hv/IvRaGCQU2OFyCj5WWkiztuJhtgVH23rG8dgPaO0SAEtzcViR HMRM/cb3Yn51YWiLwZFQyxzFZqnC+aw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1723034602; h=from:from:reply-to:date:date:to:to:cc:mime-version:mime-version: content-type:content-type; bh=omwvzSV0frFzugIO6KyCITpwiQ2bYOGpaDC333RfeSs=; b=Cyp5qJxKhcz6WzhSYhEBgVDy3PGxi9RF7HAkAjrBy8UBBritcO5Wt6YWyQGOMjRtPXC/KP wNbq/GU6JHs2zTCw== Date: Wed, 7 Aug 2024 14:43:22 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/116258 - do not lower PAREN_EXPR of vectors MIME-Version: 1.0 X-Spamd-Result: default: False [-0.14 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MISSING_MID(2.50)[]; NEURAL_SPAM_LONG(0.61)[0.175]; NEURAL_HAM_SHORT(-0.15)[-0.752]; MIME_GOOD(-0.10)[text/plain]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_ZERO(0.00)[0]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_DN_NONE(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[gcc.target:url] X-Spam-Score: -0.14 X-Spam-Level: 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, KAM_SHORT, 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: <20240807124347.34545385AC29@sourceware.org> The following avoids lowering of PAREN_EXPR of vectors as unsupported to scalars. Instead PAREN_EXPR is like a plain move or a VIEW_CONVERT. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. I plan to push to branches, __builtin_assoc_barrier is new in GCC 12. PR tree-optimization/116258 * tree-vect-generic.cc (expand_vector_operations_1): Do not lower PAREN_EXPR. * gcc.target/i386/pr116258.c: New testcase. --- gcc/testsuite/gcc.target/i386/pr116258.c | 14 ++++++++++++++ gcc/tree-vect-generic.cc | 9 +++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr116258.c diff --git a/gcc/testsuite/gcc.target/i386/pr116258.c b/gcc/testsuite/gcc.target/i386/pr116258.c new file mode 100644 index 00000000000..bd7d3a97b2c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr116258.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +#define vect16 __attribute__((vector_size(16))) +#define h(a) __builtin_assoc_barrier((a)) + + vect16 float f( vect16 float x, vect16 float vconstants0) +{ + vect16 float t = (x * (vconstants0[0])); + return (x + h(t)); +} + +/* { dg-final { scan-assembler-times "shufps" 1 } } */ +/* { dg-final { scan-assembler-not "unpck" } } */ diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc index 8336cbb8c73..4bcab71c168 100644 --- a/gcc/tree-vect-generic.cc +++ b/gcc/tree-vect-generic.cc @@ -2206,10 +2206,15 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi, } } + /* Plain moves do not need lowering. */ + if (code == SSA_NAME + || code == VIEW_CONVERT_EXPR + || code == PAREN_EXPR) + return; + if (CONVERT_EXPR_CODE_P (code) || code == FLOAT_EXPR - || code == FIX_TRUNC_EXPR - || code == VIEW_CONVERT_EXPR) + || code == FIX_TRUNC_EXPR) return; /* The signedness is determined from input argument. */