From patchwork Fri Apr 29 11:07:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 53348 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C77423857367 for ; Fri, 29 Apr 2022 11:08:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C77423857367 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1651230480; bh=5PhYSKJHHKl9QQz5ljs5pXGm0AshZVVO6oYXS7oGerc=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=D7YGvvvgD5sjl2/bp3F1ynIcNjGK33+gsksPzRMuWnT0Ty0PNWwDFbXSE/Nh2x7hp VI1NKBx/bbul3MMaYBkgseWHfTR5IoQlHihlwgQDvR7SBhPirw+fkAMa00XpqqumxW aL0oBJJcC6/3Yd1T1tGETj/IDG250ydM4O2BGF7A= 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 C69A9385780C for ; Fri, 29 Apr 2022 11:07:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C69A9385780C Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id AB0721F892; Fri, 29 Apr 2022 11:07:30 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 95EA913446; Fri, 29 Apr 2022 11:07:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4VCFI/LGa2JINQAAMHmgww (envelope-from ); Fri, 29 Apr 2022 11:07:30 +0000 Date: Fri, 29 Apr 2022 13:07:30 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/105394 - vector lowering of compares MIME-Version: 1.0 Message-Id: <20220429110730.95EA913446@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" The following fixes missing handling of non-integer mode but masked (SVE or MVE) compares in vector lowering by using the appropriate mask element width to extract the components and adjust the index. Bootstrapped and tested on x86_64-unknown-linux-gnu. Alex is testing this on ARM - if that goes OK can you push this to trunk, preferably with the testcase added to gcc.target/arm? Thanks, Richard. 2022-04-29 Richard Biener PR tree-optimization/105394 * tree-vect-generic.cc (expand_vector_condition): Adjust comp_width for non-integer mode masks as well. --- gcc/tree-vect-generic.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc index 8b7227e8b58..e5bd9dc7c76 100644 --- a/gcc/tree-vect-generic.cc +++ b/gcc/tree-vect-generic.cc @@ -1122,6 +1122,9 @@ expand_vector_condition (gimple_stmt_iterator *gsi, bitmap dce_ssa_names) tree atype = build_nonstandard_integer_type (prec, 1); a = gimplify_build1 (gsi, VIEW_CONVERT_EXPR, atype, a); } + else if (!a_is_comparison + && VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (a))) + comp_width = vector_element_bits_tree (TREE_TYPE (a)); int nunits = nunits_for_known_piecewise_op (type); vec_alloc (v, nunits); @@ -1148,7 +1151,7 @@ expand_vector_condition (gimple_stmt_iterator *gsi, bitmap dce_ssa_names) build_zero_cst (TREE_TYPE (a))); } else - aa = tree_vec_extract (gsi, cond_type, a, width, index); + aa = tree_vec_extract (gsi, cond_type, a, comp_width, comp_index); result = gimplify_build3 (gsi, COND_EXPR, inner_type, aa, bb, cc); if (!CONSTANT_CLASS_P (result)) constant_p = false;