From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 BCEFC3858C66 for ; Fri, 1 Mar 2024 12:11:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BCEFC3858C66 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 BCEFC3858C66 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=1709295081; cv=none; b=NQCj7ixBS4If66kStXfPiUS8bu4Im+J627h+ENE0ACXN0b6Zrt7uEaFaDH0+iVnCfMLOdHxAXWeanuM44wN2ssFbFA8sABx4gfdkmRBN76KY+fCvOc9VgGZNxwpG+CiAcqEZy9SdRyCz224lj89NRhUVpYSg3CSrlL9fetgKKrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709295081; c=relaxed/simple; bh=C/Ssozo+xZOHiPQIfofcT9Jv38qm4EVgUPgGmUQYTgE=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:Message-ID:MIME-Version; b=tnP7ENcg/51J5pPQrYvM3qiCj/+gtMqB2U7eotPKo1UUXnPnY31Axc9Ff0d4CyaweSWUHbrTdfIBHC9VOda1uABRi4mQCXUthmpxG/EkVH/tlM9moPHfl1A1uQBRBi/cswH/8hPFUaC9udDpKcQu5KCrK+kiB3YAWWXyeM5/Gt8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [10.168.4.150] (unknown [10.168.4.150]) (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 C818E2030A; Fri, 1 Mar 2024 12:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709295078; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tN36lwFJSENhK+9AceowrX0lkfKhmjgNFR9T6DeUdt4=; b=mw2MDL0QWWy9N9znDerrWCueLUV9FJmbzsUzsCeds1BYkTcUzxakdv43S763RLYaq8uR3Q 7fulK+pR3eVFdXXmsQW4y5UVoqaq8KahUD81KhexYnFZUSDPpbxAnvYOXcTMcyDwlFz+q7 ygL6YSx/leB8W+91AdvVt16tzXMFpZM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709295078; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tN36lwFJSENhK+9AceowrX0lkfKhmjgNFR9T6DeUdt4=; b=lO/u3K3rLVvJ6al747FxETbDLGLQ2E4SY7Z/VX3kOZtJ8wWuT3JG4JuzSFzA2+o65anCn7 nqpvSV3dueHAXPAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709295078; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tN36lwFJSENhK+9AceowrX0lkfKhmjgNFR9T6DeUdt4=; b=mw2MDL0QWWy9N9znDerrWCueLUV9FJmbzsUzsCeds1BYkTcUzxakdv43S763RLYaq8uR3Q 7fulK+pR3eVFdXXmsQW4y5UVoqaq8KahUD81KhexYnFZUSDPpbxAnvYOXcTMcyDwlFz+q7 ygL6YSx/leB8W+91AdvVt16tzXMFpZM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709295078; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tN36lwFJSENhK+9AceowrX0lkfKhmjgNFR9T6DeUdt4=; b=lO/u3K3rLVvJ6al747FxETbDLGLQ2E4SY7Z/VX3kOZtJ8wWuT3JG4JuzSFzA2+o65anCn7 nqpvSV3dueHAXPAw== Date: Fri, 1 Mar 2024 13:11:18 +0100 (CET) From: Richard Biener To: Jakub Jelinek cc: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Re: [PATCH] middle-end/114070 - VEC_COND_EXPR folding In-Reply-To: Message-ID: References: <66896q4p-r807-1865-s6q6-p74622o26040@fhfr.qr> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [-3.10 / 50.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-3.00)[100.00%] X-Spam-Level: X-Spam-Score: -3.10 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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 List-Id: On Thu, 29 Feb 2024, Jakub Jelinek wrote: > On Thu, Feb 29, 2024 at 11:16:54AM +0100, Richard Biener wrote: > > That said, the quick experiment shows this isn't anything for stage4. > > The earlier the vector lowering is moved in the pass list, the higher > are the possibilities that match.pd or some other optimization reintroduces > unsupportable vector operations into the IL. > > Guess your patch looks reasonable. Pushed. Thanks, Richard. > > > PR middle-end/114070 > > > * match.pd ((c ? a : b) op d --> c ? (a op d) : (b op d)): > > > Allow the folding if before lowering and the current IL > > > isn't supported with vcond_mask. > > > --- > > > gcc/match.pd | 18 +++++++++++++++--- > > > 1 file changed, 15 insertions(+), 3 deletions(-) > > > > > > diff --git a/gcc/match.pd b/gcc/match.pd > > > index f3fffd8dec2..4edba7c84fb 100644 > > > --- a/gcc/match.pd > > > +++ b/gcc/match.pd > > > @@ -5153,7 +5153,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > > > (op (vec_cond:s @0 @1 @2) (vec_cond:s @0 @3 @4)) > > > (if (TREE_CODE_CLASS (op) != tcc_comparison > > > || types_match (type, TREE_TYPE (@1)) > > > - || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK)) > > > + || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK) > > > + || (optimize_vectors_before_lowering_p () > > > + /* The following is optimistic on the side of non-support, we are > > > + missing the legacy vcond{,u,eq} cases. Do this only when > > > + lowering will be able to fixup.. */ > > > + && !expand_vec_cond_expr_p (TREE_TYPE (@1), > > > + TREE_TYPE (@0), ERROR_MARK))) > > > (vec_cond @0 (op! @1 @3) (op! @2 @4)))) > > > > > > /* (c ? a : b) op d --> c ? (a op d) : (b op d) */ > > > @@ -5161,13 +5167,19 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > > > (op (vec_cond:s @0 @1 @2) @3) > > > (if (TREE_CODE_CLASS (op) != tcc_comparison > > > || types_match (type, TREE_TYPE (@1)) > > > - || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK)) > > > + || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK) > > > + || (optimize_vectors_before_lowering_p () > > > + && !expand_vec_cond_expr_p (TREE_TYPE (@1), > > > + TREE_TYPE (@0), ERROR_MARK))) > > > (vec_cond @0 (op! @1 @3) (op! @2 @3)))) > > > (simplify > > > (op @3 (vec_cond:s @0 @1 @2)) > > > (if (TREE_CODE_CLASS (op) != tcc_comparison > > > || types_match (type, TREE_TYPE (@1)) > > > - || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK)) > > > + || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK) > > > + || (optimize_vectors_before_lowering_p () > > > + && !expand_vec_cond_expr_p (TREE_TYPE (@1), > > > + TREE_TYPE (@0), ERROR_MARK))) > > > (vec_cond @0 (op! @3 @1) (op! @3 @2))))) > > > > > > #if GIMPLE > > > > > Jakub > > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)