From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lug-owl.de (lug-owl.de [188.68.32.151]) by sourceware.org (Postfix) with ESMTPS id AF83B3858C52 for ; Thu, 19 Jan 2023 09:19:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AF83B3858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lug-owl.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lug-owl.de Received: by lug-owl.de (Postfix, from userid 1001) id 384EB4207C; Thu, 19 Jan 2023 10:19:12 +0100 (CET) Date: Thu, 19 Jan 2023 10:19:12 +0100 From: Jan-Benedict Glaw To: Andrew Carlotti Cc: Richard Biener , gcc-patches@gcc.gnu.org Subject: Re: [PATCH 5/8 v2] middle-end: Add cltz_complement idiom recognition Message-ID: <20230119091912.4qrqkw3fjmh5xlgk@lug-owl.de> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xv2dxbys2o5ulhrg" Content-Disposition: inline In-Reply-To: X-Operating-System: Linux chamaeleon 5.14.0-0.bpo.2-amd64 X-gpg-fingerprint: 250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB X-gpg-key: wwwkeys.de.pgp.net X-Echelon-Enable: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-TKUeV: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-message-flag: Please send plain text messages only. Do not send HTML emails. Thank you. User-Agent: NeoMutt/20170113 (1.7.2) X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,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 List-Id: --xv2dxbys2o5ulhrg Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, 2022-12-22 17:42:16 +0000, Andrew Carlotti via Gcc-patches wrote: > New patch below, bootstrapped and regression tested on > aarch64-unknown-linux-gnu and x86_64-pc-linux-gnu - ok to merge? > diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc > index fece876099c1687569d6351e7d2416ea6acae5b5..ce2441f2a6dbdf2d8fe42755d= 5d1abd8a631bb5c 100644 > --- a/gcc/tree-ssa-loop-niter.cc > +++ b/gcc/tree-ssa-loop-niter.cc > @@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see > #include "tree-chrec.h" > #include "tree-scalar-evolution.h" > #include "tree-dfa.h" > +#include "internal-fn.h" > #include "gimple-range.h" > =20 > =20 > @@ -2198,6 +2199,224 @@ number_of_iterations_popcount (loop_p loop, edge = exit, > return true; > } > =20 > +/* Return an expression that counts the leading/trailing zeroes of src. > + > + If define_at_zero is true, then the built expression will be defined = to > + return the precision of src when src =3D=3D 0 (using either a conditi= onal > + expression or a suitable internal function). > + Otherwise, we can elide the conditional expression and let src =3D 0 = invoke > + undefined behaviour. */ > + > +static tree > +build_cltz_expr (tree src, bool leading, bool define_at_zero) > +{ [...] > + > + tree call; > + if (use_ifn) > + { > + call =3D build_call_expr_internal_loc (UNKNOWN_LOCATION, ifn, > + integer_type_node, 1, src); > + int val; > + scalar_int_mode mode =3D SCALAR_INT_TYPE_MODE (utype); ^^^^^^^^^^^^^^^^^^^^ This will give us a new unused variable warning. > + int optab_defined_at_zero > + =3D leading ? CLZ_DEFINED_VALUE_AT_ZERO (mode, val) > + : CTZ_DEFINED_VALUE_AT_ZERO (mode, val); > + if (define_at_zero && !(optab_defined_at_zero =3D=3D 2 && val =3D= =3D prec)) > + { > + tree is_zero =3D fold_build2 (NE_EXPR, boolean_type_node, src, > + build_zero_cst (TREE_TYPE (src))); > + call =3D fold_build3(COND_EXPR, integer_type_node, is_zero, call, > + build_int_cst (integer_type_node, prec)); > + } > + } MfG, JBG --=20 --xv2dxbys2o5ulhrg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQQlDTvPcScNjKREqWEdvV51g5nhuwUCY8kLDQAKCRAdvV51g5nh ux1iAJ4+9daXMB1a7nlhzdn7Lc8KbWfnZACfZlt/0tvvPcVFHA1Ft6hWqW+a2jI= =eKZs -----END PGP SIGNATURE----- --xv2dxbys2o5ulhrg--