From patchwork Thu Oct 20 12:48:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 6182 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp89749wrr; Thu, 20 Oct 2022 05:49:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7cNPFLDoEVxvZI6CXI8fLt+X6irZOtlGtmAx2hp3yYw3bPaT49Gr6R7o5co3aO3gufWPs/ X-Received: by 2002:a05:6402:1393:b0:457:ea9e:ba20 with SMTP id b19-20020a056402139300b00457ea9eba20mr12239640edv.109.1666270152243; Thu, 20 Oct 2022 05:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666270152; cv=none; d=google.com; s=arc-20160816; b=MZT6XGjJhcfgO8SK31w5I5qC8tOcD6WdbryJc6odAxlnCDqurC5WQAa/sMAxCViwHB qx4SssCwqhEGSU5tswNmkRBPj8vy5Zwfgffwp+BBOO3DNtnOOFAV4PMZC8oDiq9ymCz1 GdBgfTCysSAcJxV56wmanv6lg9bDKS5FE+PpUQktn4q7NR3mr9vxBjDvNPErr+WT2EaC Is0YoLpT49UsO8ezIGp61fI/rhg1E4NTt/XVjpeKlqDYm2GQmQrVNloAacODJnko4wCe B6w8+jyy7VUclo0d66KY2alBu8uCWYHcPX3XfS+5fdT3i6WxxdMuZUffrtvCky4ek6FL zfEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=Z3nR3J9SFLtXT8jut7Cjsxo+mDTeAZlqrk0IioVhwug=; b=uk3ZomufV0rzpUSW8JS5UlRuXyaN08OXLSdYETsngccMhb85qc8iT2BQpHXGvFY+Bx DAwCPL4ezaaB7ADQgDG7sXMDpSTTharlk6EiXtA72ARLIObvb/DFtlA/y7EP/Ps80Gfc RNA16d87uURIZjzbwbgn4CRlDJ284loPaWMm2sAJGq+b5q6a0mergQZ7XdPw+SNzNcih 4vOsuwlclqjyYfGgEOeJhWbgB8aYPUn4YUXJAWEQAL8203G+nbqaoLegDGZGgFHsTyOg VbnFZKSaFlf8BVsZFhhQ/CfEcELzG9GrdxcdFw+ZsvN2EWMALncgU1H1heOgdfEtihDc u1sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=jfQhKVIv; 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=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id oz41-20020a1709077da900b00782a33f2850si17058090ejc.736.2022.10.20.05.49.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 05:49:12 -0700 (PDT) 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=@gcc.gnu.org header.s=default header.b=jfQhKVIv; 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=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EB8853851145 for ; Thu, 20 Oct 2022 12:49:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB8853851145 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666270151; bh=Z3nR3J9SFLtXT8jut7Cjsxo+mDTeAZlqrk0IioVhwug=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=jfQhKVIveY9rfpxVeVe4TsoHzq6ZEK1l3sc9nTMKOeL22aeuda85SHXgzI/OojQWS BoVopQifnSnQ+CVkkh5cs0hp4W6R6bA0sbZMswYHMOth7ZqH0gwJKvMAF1t3I7BFeC E8MtbmIjcX2iTJm5/ORkv6zHT9Hd1hf36Uglzuxg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D98583860748 for ; Thu, 20 Oct 2022 12:48:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D98583860748 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-104-Ea7fxlVXM5qEjh3vVRNp8w-1; Thu, 20 Oct 2022 08:48:21 -0400 X-MC-Unique: Ea7fxlVXM5qEjh3vVRNp8w-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2DEEA1C06EC7; Thu, 20 Oct 2022 12:48:21 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.252]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DBE544047A7; Thu, 20 Oct 2022 12:48:20 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 29KCmIxg1621530 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 20 Oct 2022 14:48:18 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 29KCmH8c1621529; Thu, 20 Oct 2022 14:48:17 +0200 Date: Thu, 20 Oct 2022 14:48:17 +0200 To: Richard Biener Subject: [PATCH] match.pd: Fix up gcc.dg/pr54346.c on i686-linux [PR54346] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747210891478667877?= X-GMAIL-MSGID: =?utf-8?q?1747210891478667877?= Hi! 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. Lightly tested so far, ok for trunk if it passes full bootstrap/regtest on x86_64-linux and i686-linux? BTW, the testcase also needs to have executable permissions removed... 2022-10-20 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. Jakub --- gcc/match.pd.jj 2022-10-19 11:28:35.111654555 +0200 +++ gcc/match.pd 2022-10-20 13:45:57.489512189 +0200 @@ -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) --- gcc/testsuite/gcc.dg/pr54346.c.jj 2022-10-11 10:00:07.456124822 +0200 +++ gcc/testsuite/gcc.dg/pr54346.c 2022-10-20 13:46:10.933330119 +0200 @@ -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))));