public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-1618] match.pd: Improve zero_one_valued_p Date: Wed, 7 Jun 2023 17:21:17 +0000 (GMT) [thread overview] Message-ID: <20230607172117.479683858C54@sourceware.org> (raw) https://gcc.gnu.org/g:e2ebd22acac844ba74e69a34dbf064d41d102cc1 commit r14-1618-ge2ebd22acac844ba74e69a34dbf064d41d102cc1 Author: Jakub Jelinek <jakub@redhat.com> Date: Wed Jun 7 19:18:26 2023 +0200 match.pd: Improve zero_one_valued_p Recently zero_one_valued_p was changed to handle integer_zerop case specially, because tree_nonzero_bits (@0) == 1 only returns true for non-constant values with range [0, 1] or constant 1, constant 0 has tree_nonzero_bits (integer_zero_node) == 0. The following patch reverts that change and instead checks that tree_nonzero_bits is <= 1U. 2023-06-07 Jakub Jelinek <jakub@redhat.com> * match.pd (zero_one_valued_p): Don't handle integer_zerop specially, instead compare tree_nonzero_bits <= 1U rather than just == 1. Diff: --- gcc/match.pd | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index dc36927cd0f..fd32389decf 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1984,15 +1984,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) @0) /* zero_one_valued_p will match when a value is known to be either - 0 or 1 including the constant 0. */ + 0 or 1 including constants 0 or 1. */ (match zero_one_valued_p @0 - (if (INTEGRAL_TYPE_P (type) && tree_nonzero_bits (@0) == 1))) + (if (INTEGRAL_TYPE_P (type) && wi::leu_p (tree_nonzero_bits (@0), 1)))) (match zero_one_valued_p truth_valued_p@0) -(match zero_one_valued_p - integer_zerop@0 - (if (INTEGRAL_TYPE_P (type)))) /* Transform { 0 or 1 } * { 0 or 1 } into { 0 or 1 } & { 0 or 1 }. */ (simplify
reply other threads:[~2023-06-07 17:21 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230607172117.479683858C54@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).