From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 6FFB83858C54; Fri, 21 Oct 2022 07:17:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6FFB83858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666336673; bh=yB3IOpsJbHSShMfx5Qz0CDRzJSFHQax31TX0K+gVjRM=; h=From:To:Subject:Date:From; b=us7lF6+lJS/s9nnhAeY9gbqmmcrjg70B1OwM8FlPcZLyEs+5+cwRxCyGhe3DOVlPq 9fqO95KiNf77x7HBOPS+HtiHSbmOSitInysA6WjtwJOCxSuNnQgfpINO26hry/2uOC 39QVdNRR2DG7mX9S+i3PgNzVwVULQT7OhQZEpQAA= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3430] match.pd: Fix up gcc.dg/pr54346.c on i686-linux [PR54346] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: 5f9fac6ca86458ef21ab91ca471429d63f954003 X-Git-Newrev: fa553ff26d96f6fecaa8f1b00649cfdc6cda5f5a Message-Id: <20221021071753.6FFB83858C54@sourceware.org> Date: Fri, 21 Oct 2022 07:17:53 +0000 (GMT) List-Id: https://gcc.gnu.org/g:fa553ff26d96f6fecaa8f1b00649cfdc6cda5f5a commit r13-3430-gfa553ff26d96f6fecaa8f1b00649cfdc6cda5f5a Author: Jakub Jelinek Date: Fri Oct 21 09:16:44 2022 +0200 match.pd: Fix up gcc.dg/pr54346.c on i686-linux [PR54346] The pr54346.c testcase FAILs on i686-linux (without -msse*) for multiple reasons. One is the trivial missing -Wno-psabi which the following patch adds, but that isn't enough. The thing is that without native vector support, we have VEC_PERM_EXPRs in the IL and are actually considering the nested VEC_PERM_EXPRs into one VEC_PERM_EXPR optimization, but punt because can_vec_perm_const_p (result_mode, op_mode, sel2, false) is false. Such a test makes sense to prevent "optimizing" two VEC_PERM_EXPRs that can be handled by the backend natively into one VEC_PERM_EXPR that can't be handled. But if both of the original VEC_PERM_EXPRs can't be handled natively either, having just one VEC_PERM_EXPR that will be lowered by generic vec lowering is IMHO still better than 2. Or even if we trade just one VEC_PERM_EXPR that can't be handled plus one that can to one that can't be handled. Also, removing the testcase's executable permissions... 2022-10-21 PR tree-optimization/54346 * match.pd ((vec_perm (vec_perm@0 @1 @2 VECTOR_CST) @0 VECTOR_CST)): Optimize nested VEC_PERM_EXPRs even if target can't handle the new one provided we don't increase number of VEC_PERM_EXPRs the target can't handle. * gcc.dg/pr54346.c: Add -Wno-psabi to dg-options. Diff: --- gcc/match.pd | 11 ++++++++++- gcc/testsuite/gcc.dg/pr54346.c | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index d07c0e4296e..194ba8f5188 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -8118,7 +8118,16 @@ and, vec_perm_indices sel2 (builder2, 2, nelts); tree op0 = NULL_TREE; - if (can_vec_perm_const_p (result_mode, op_mode, sel2, false)) + /* If the new VEC_PERM_EXPR can't be handled but both + original VEC_PERM_EXPRs can, punt. + If one or both of the original VEC_PERM_EXPRs can't be + handled and the new one can't be either, don't increase + number of VEC_PERM_EXPRs that can't be handled. */ + if (can_vec_perm_const_p (result_mode, op_mode, sel2, false) + || (single_use (@0) + ? (!can_vec_perm_const_p (result_mode, op_mode, sel0, false) + || !can_vec_perm_const_p (result_mode, op_mode, sel1, false)) + : !can_vec_perm_const_p (result_mode, op_mode, sel1, false))) op0 = vec_perm_indices_to_tree (TREE_TYPE (@4), sel2); } (if (op0) diff --git a/gcc/testsuite/gcc.dg/pr54346.c b/gcc/testsuite/gcc.dg/pr54346.c old mode 100755 new mode 100644 index 63611ab6c2f..5ec0609f1e5 --- a/gcc/testsuite/gcc.dg/pr54346.c +++ b/gcc/testsuite/gcc.dg/pr54346.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O -fdump-tree-dse1" } */ +/* { dg-options "-O -fdump-tree-dse1 -Wno-psabi" } */ typedef int veci __attribute__ ((vector_size (4 * sizeof (int))));