From: Richard Sandiford <richard.sandiford@arm.com>
To: Robin Dapp <rdapp.gcc@gmail.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
Robin Dapp via Gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] gimple-match: Do not try UNCOND optimization with COND_LEN.
Date: Tue, 17 Oct 2023 17:05:13 +0100 [thread overview]
Message-ID: <mptedht2q12.fsf@arm.com> (raw)
In-Reply-To: <6b71858f-51d1-4e23-879c-d3cb19778ed9@gmail.com> (Robin Dapp's message of "Tue, 17 Oct 2023 17:42:11 +0200")
Robin Dapp <rdapp.gcc@gmail.com> writes:
> Thank you for the explanation.
>
> So, assuming I added an IFN_VCOND_MASK and IFN_VCOND_MASK_LEN along
> with the respective helper and expand functions, what would be the
> way forward?
IMO it'd be worth starting with the _LEN form only.
> Generate an IFN_VCOND_MASK(_LEN) here instead of a VEC_COND_EXPR?
> How would I make sure all of match.pd's vec_cond optimizations
> applied to it as well?
I think the most important ones are:
/* Simplify:
a = a1 op a2
r = c ? a : b;
to:
r = c ? a1 op a2 : b;
if the target can do it in one go. This makes the operation conditional
on c, so could drop potentially-trapping arithmetic, but that's a valid
simplification if the result of the operation isn't needed.
Avoid speculatively generating a stand-alone vector comparison
on targets that might not support them. Any target implementing
conditional internal functions must support the same comparisons
inside and outside a VEC_COND_EXPR. */
It would be nice if there was some match.pd syntax that automatically
extended these rules to IFN_VCOND_MASK_LEN, but I don't know how easy
that would be, due to the extra two parameters.
Perhaps that itself could be done in gimple-match-exports.cc, in a similar
way to the current conditional stuff. That is:
- for IFN_VCOND_MASK_LEN, try folding as a VEC_COND_EXPR and then "adding
the length back"
- for IFN_COND_LEN_FOO, try folding as an IFN_COND_FOO and then
"add the length back"
Not sure how important the second one is.
Thanks,
Richard
> Right now AFAIK IFN_VCOND_MASK only gets created in isel and
> everything is just a VEC_COND before. But that does not provide
> length masking so is not the way to go?
>
> Thanks.
>
> Regards
> Robin
next prev parent reply other threads:[~2023-10-17 16:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 9:01 Robin Dapp
2023-09-11 20:35 ` Robin Dapp
2023-09-18 10:22 ` Robin Dapp
2023-10-04 8:11 ` Robin Dapp
2023-10-12 13:53 ` Richard Sandiford
2023-10-12 14:19 ` Richard Sandiford
2023-10-13 15:50 ` Robin Dapp
2023-10-16 21:59 ` Richard Sandiford
2023-10-17 8:47 ` Richard Biener
2023-10-17 11:39 ` Robin Dapp
2023-10-17 13:35 ` Richard Sandiford
2023-10-17 15:42 ` Robin Dapp
2023-10-17 16:05 ` Richard Sandiford [this message]
[not found] ` <7e083b67-f283-4e9e-ba76-24e194fa1761@gmail.com>
[not found] ` <mptttqmny4u.fsf@arm.com>
2023-10-23 16:09 ` [PATCH] internal-fn: Add VCOND_MASK_LEN Robin Dapp
2023-10-24 21:50 ` Richard Sandiford
2023-10-25 19:59 ` Robin Dapp
2023-10-25 21:58 ` Richard Sandiford
2023-10-17 15:52 ` [PATCH] gimple-match: Do not try UNCOND optimization with COND_LEN Richard Sandiford
2023-10-17 0:47 juzhe.zhong
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=mptedht2q12.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rdapp.gcc@gmail.com \
--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).