From: Jakub Jelinek <jakub@redhat.com>
To: Tamar Christina <Tamar.Christina@arm.com>
Cc: Richard Biener <rguenther@suse.de>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] match.pd: Fix up the recent bitmask_inv_cst_vector_p simplification [PR103417]
Date: Thu, 25 Nov 2021 09:39:28 +0100 [thread overview]
Message-ID: <20211125083928.GY2646553@tucnak> (raw)
In-Reply-To: <VI1PR08MB5325E2ED480689C706881C49FF629@VI1PR08MB5325.eurprd08.prod.outlook.com>
On Thu, Nov 25, 2021 at 08:23:50AM +0000, Tamar Christina wrote:
> > But, IMNSHO while it isn't incorrect to handle le and gt there, it is
> > unnecessary. Because (x & cst) <= 0U and (x & cst) > 0U should never appear,
> > again in
> > /* Non-equality compare simplifications from fold_binary */ we have a
> > simplification for it:
> > (if (cmp == LE_EXPR)
> > (eq @2 @1))
> > (if (cmp == GT_EXPR)
> > (ne @2 @1))))
> > This is done for
> > (cmp (convert?@2 @0) uniform_integer_cst_p@1) and so should be done
> > for both integers and vectors.
> > As the bitmask_inv_cst_vector_p simplification only handles eq and ne for
> > signed types, I think it can be simplified to just following patch.
>
> As I mentioned on the PR I don't think LE and GT should be removed, the patch
> Is attempting to simplify the bitmask used because most vector ISAs can create
> the simpler mask much easier than the complex mask.
>
> It. 0xFFFFFF00 is harder to create than 0xFF. So while for scalar it doesn't matter
> as much, it does for vector code.
What I'm trying to explain is that you should never see those le or gt cases
with TYPE_UNSIGNED (especially when the simplification is moved after those
/* Non-equality compare simplifications from fold_binary */
I've mentioned), because if you try:
typedef unsigned V __attribute__((vector_size (4)));
unsigned f1 (unsigned x) { unsigned z = 0; return x > z; }
unsigned f2 (unsigned x) { unsigned z = 0; return x <= z; }
V f3 (V x) { V z = (V) {}; return x > z; }
V f4 (V x) { V z = (V) {}; return x <= z; }
you'll see that this is at ccp1 when the constants propagate simplified
using the rules I mentioned into x != 0U, x == 0U, x != (V) {} and x == (V) {}.
The important rule of match.pd is composability, the simplifications should
rely on other simplifications and not repeating all their decisions because
that makes the *match.c larger and more expensive (and a source of extra
possible bugs).
Jakub
next prev parent reply other threads:[~2021-11-25 8:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-25 8:18 Jakub Jelinek
2021-11-25 8:23 ` Tamar Christina
2021-11-25 8:31 ` Richard Biener
2021-11-25 8:39 ` Jakub Jelinek [this message]
2021-11-25 8:54 ` Tamar Christina
2021-11-25 9:17 ` Richard Biener
2021-11-25 9:52 ` Jakub Jelinek
2021-11-25 10:58 ` Richard Biener
2021-11-25 15:28 ` Tamar Christina
2021-11-25 9:07 ` Tamar Christina
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=20211125083928.GY2646553@tucnak \
--to=jakub@redhat.com \
--cc=Tamar.Christina@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/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).