public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Andrew Pinski <quic_apinski@quicinc.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 1/3] MATCH: Fix zero_one_valued_p's convert pattern
Date: Mon, 4 Dec 2023 15:21:57 +0100	[thread overview]
Message-ID: <CAFiYyc1HQUM=mv-5jsamwsnYTEhk-hfkFjKunnc_5WX29_faxA@mail.gmail.com> (raw)
In-Reply-To: <20231202063725.3405094-2-quic_apinski@quicinc.com>

On Sat, Dec 2, 2023 at 7:38 AM Andrew Pinski <quic_apinski@quicinc.com> wrote:
>
> While working on PR 111972, I was getting a regression
> due to zero_one_valued_p matching a signed 1 bit integer
> when it came to convert. This patch fixes that by checking
> the outer type too.
>
> Bootstrapped and tested on x86_64-linux-gnu with no regressions.

OK

> gcc/ChangeLog:
>
>         * match.pd (zero_one_valued_p): For convert
>         make sure type is not a signed 1-bit integer.
>
> Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> ---
>  gcc/match.pd | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/gcc/match.pd b/gcc/match.pd
> index 26383e55767..4d554ba4721 100644
> --- a/gcc/match.pd
> +++ b/gcc/match.pd
> @@ -2247,6 +2247,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>   (if (INTEGRAL_TYPE_P (TREE_TYPE (@1))
>        && (TYPE_UNSIGNED (TREE_TYPE (@1))
>           || TYPE_PRECISION (TREE_TYPE (@1)) > 1)
> +      && INTEGRAL_TYPE_P (type)
> +      && (TYPE_UNSIGNED (type)
> +         || TYPE_PRECISION (type) > 1)
>        && wi::leu_p (tree_nonzero_bits (@1), 1))))
>
>  /* Transform { 0 or 1 } * { 0 or 1 } into { 0 or 1 } & { 0 or 1 }.  */
> --
> 2.39.3
>

  reply	other threads:[~2023-12-04 14:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-02  6:37 [PATCH 0/3] Fix PR 111972 Andrew Pinski
2023-12-02  6:37 ` [PATCH 1/3] MATCH: Fix zero_one_valued_p's convert pattern Andrew Pinski
2023-12-04 14:21   ` Richard Biener [this message]
2023-12-02  6:37 ` [PATCH 2/3] Remove check of unsigned_char in maybe_undo_optimize_bit_field_compare Andrew Pinski
2023-12-02  6:37 ` [PATCH 3/3] MATCH: (convert)(zero_one !=/== 0/1) for outer type and zero_one type are the same Andrew Pinski
2023-12-04 14:21   ` Richard Biener
2023-12-04 21:14     ` Andrew Pinski (QUIC)

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='CAFiYyc1HQUM=mv-5jsamwsnYTEhk-hfkFjKunnc_5WX29_faxA@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=quic_apinski@quicinc.com \
    /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: link
Be 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).