public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gmail.com>
To: Hongtao Liu <crazylht@gmail.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Simplify (view_convert ~a) < 0 to (view_convert a) >= 0 [PR middle-end/100738]
Date: Mon, 31 May 2021 22:29:11 -0700	[thread overview]
Message-ID: <CA+=Sn1kdRshM-GGMAfL6Kyt0uGgS9wTa3RxsyEremtQ+uRVzSQ@mail.gmail.com> (raw)
In-Reply-To: <CAMZc-byf4rYBdOtgC2enpVymG6iRcrdyRPYHCUfn6J=F72jfCg@mail.gmail.com>

On Mon, May 31, 2021 at 10:21 PM Hongtao Liu via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi:
>   This patch is about to simplify (view_convert:type ~a) < 0 to
> (view_convert:type a) >= 0 when type is signed integer. Similar for
> (view_convert:type ~a) >= 0.
>   Bootstrapped and regtested on x86_64-linux-gnu{-m32,}.
>   Ok for the trunk?

Why not just do instead:

/* ((view_convert)~a) is just ~(view_convert)a .  */
(simplify
  (view_convert (bit_not @0))
  (if ((VECTOR_TYPE_P (type) && INTEGRAL_TYPE_P (TREE_TYPE (type)))
        || INTEGRAL_TYPE_P (type))
   (bit_not (view_convert @0))))

And then the other patterns for converting ~a < 0 to a >= 0 should
happen (if they don't add a few) (for wrapping types).

Thanks,
Andrew Pinski

>
> gcc/ChangeLog:
>
>         PR middle-end/100738
>         * match.pd ((view_convert ~a) < 0 --> (view_convert a) >= 0,
>         (view_convert ~a) >= 0 --> (view_convert a) < 0): New GIMPLE
>         simplification.
>
> gcc/testsuite/ChangeLog:
>
>         PR middle-end/100738
>         * g++.target/i386/avx2-pr100738-1.C: New test.
>         * g++.target/i386/sse4_1-pr100738-1.C: New test.
>
> --
> BR,
> Hongtao

  reply	other threads:[~2021-06-01  5:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01  5:22 Hongtao Liu
2021-06-01  5:29 ` Andrew Pinski [this message]
2021-06-01 11:52   ` Hongtao Liu
2021-06-01 10:17 ` Marc Glisse
2021-06-04  5:01   ` Hongtao Liu
2021-06-04  8:11     ` Hongtao Liu
2021-06-04  8:18     ` Marc Glisse
2021-06-07  6:22       ` Hongtao Liu
2021-06-07  7:06         ` Hongtao Liu
2021-06-07 13:19           ` Richard Biener

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='CA+=Sn1kdRshM-GGMAfL6Kyt0uGgS9wTa3RxsyEremtQ+uRVzSQ@mail.gmail.com' \
    --to=pinskia@gmail.com \
    --cc=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.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).