From patchwork Thu May 25 11:00:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 98962 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp273496vqr; Thu, 25 May 2023 04:01:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7SW3ZfkVZaH9uXwmjVcgmzNQ9BuFht+lunJzs48Siz6FJpeDjFMAaV/iuwA7U5Ylxo9WV5 X-Received: by 2002:a17:906:db02:b0:96f:9a90:c924 with SMTP id xj2-20020a170906db0200b0096f9a90c924mr1015156ejb.74.1685012497832; Thu, 25 May 2023 04:01:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685012497; cv=none; d=google.com; s=arc-20160816; b=Z5AIYJR2NzbUGGNOb0j9+C+wi0rVNAGCzGhBfcJ0gUemRez2nwUTUVJaVBksgsP06e vpN2iL0Dmu3ZCTfBL2UtZEyU70R0R625JXaL4JzA5a4QpWf4R8zaet6xiOF+7Q61du0E DYY+A2mqQp9Q/RoIPLiAzAmvf8eNBzoR1HCD+99l7aaST6LN8kH6s3eySev1Y2rD0BUJ /g6WiiXwhMcc08IJpWTxrVEDdOPUJyLo9syXeVpHRVBAvghQSyUn4oYklBMbBZqVr52O b82iePEGdM/pQnJ0OSy92xlvPIarhuKZqeHPDEhd8bCUOBu9BEooACngNHtXE/F6JO1W TUYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:sender:errors-to:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:user-agent:subject:cc:to:date:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=LW+cF3J0DNmZGRFYh1yIKz7ij3Fs3r9clvp/VzpLUMY=; b=aUejXmK1W1zTrHjcj9id5DU6JKCH6+qXOcc/qmXJrtpD/Pkq9GcMGIM/BWdn2eCf+E JdIwF53HsCISU+mgmKRUk01a/nBmLEqHzXE3U6GmvJvQ9sgZk8ti+qdVRWOHQ1P3DVKd lS5K3BwBZqgbXhdwZ+m9WaKWVN4M11EiqoUWeTC6g0u1RP8+mBss9kiIvlUIomyQ+BZ5 diqFAM8FjFWobt3+GSzF9PyTpT4yARIG3dsnaSNc4cZgMLvcPU7Fj8F5O8h7BVSlLQew Es95LanAwjsYxGGkN0fFbVvquV4vs9j+nUIFWMqPENXxCvzR6K8h9g2gtTcJDUn8QGwd zEfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=d+QfEVrc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id go31-20020a1709070d9f00b009660ae02532si1160693ejc.157.2023.05.25.04.01.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 04:01:37 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=d+QfEVrc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 7DE8D3857717 for ; Thu, 25 May 2023 11:01:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7DE8D3857717 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685012496; bh=LW+cF3J0DNmZGRFYh1yIKz7ij3Fs3r9clvp/VzpLUMY=; h=Date:To:cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=d+QfEVrcxa18KA2dKUF9ERgxUixpt4GOQsWHZ5bnMp9Y8cA4fJwShkI3+BGdvppOz HBUwoe5cdNVYbghR6c7dLmAadnEGqU4IZPd2snU560IufXvgdg/pjFKlOj36otSmfB F5cD2x60ubvCd551jDFTHqOvBSBGHCcvsc0lCPlM= 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.220.29]) by sourceware.org (Postfix) with ESMTPS id AE61F3858D37 for ; Thu, 25 May 2023 11:00:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE61F3858D37 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id BDD111FDF9; Thu, 25 May 2023 11:00:52 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id A666B2C141; Thu, 25 May 2023 11:00:52 +0000 (UTC) Date: Thu, 25 May 2023 11:00:52 +0000 (UTC) To: gcc-patches@gcc.gnu.org cc: richard.sandiford@arm.com Subject: [PATCH] target/109955 - handle pattern generated COND_EXPR without vcond User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" Message-Id: <20230525110136.7DE8D3857717@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766863664861138760?= X-GMAIL-MSGID: =?utf-8?q?1766863664861138760?= The following properly handles pattern matching generated COND_EXPRs which can still have embedded compares in vectorizable_condition which will always code generate the masked vector variant. We were requiring vcond with embedded comparisons instead of also allowing (as code generated) split compare and VEC_COND_EXPR. This fixes some of the fallout when removing vcond{,u,eq} expanders from the x86 backend. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR target/109955 * tree-vect-stmts.cc (vectorizable_condition): For embedded comparisons also handle the case when the target only provides vec_cmp and vcond_mask. --- gcc/tree-vect-stmts.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 127b987cd62..bd3b07a3aa1 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -10836,7 +10836,12 @@ vectorizable_condition (vec_info *vinfo, if (reduction_type == EXTRACT_LAST_REDUCTION) /* Count one reduction-like operation per vector. */ kind = vec_to_scalar; - else if (!expand_vec_cond_expr_p (vectype, comp_vectype, cond_code)) + else if (!expand_vec_cond_expr_p (vectype, comp_vectype, cond_code) + && (masked + || (!expand_vec_cmp_expr_p (comp_vectype, vec_cmp_type, + cond_code) + || !expand_vec_cond_expr_p (vectype, vec_cmp_type, + ERROR_MARK)))) return false; if (slp_node