From: Oluwatamilore Adebayo <oluwatamilore.adebayo@arm.com>
To: <richard.sandiford@arm.com>
Cc: <gcc-patches@gcc.gnu.org>, <oluwatamilore.adebayo@arm.com>,
<richard.guenther@gmail.com>
Subject: Re: [PATCH] vect: Missed opportunity to use [SU]ABD
Date: Tue, 6 Jun 2023 10:50:44 +0100 [thread overview]
Message-ID: <20230606095044.24470-1-oluwatamilore.adebayo@arm.com> (raw)
In-Reply-To: <mptcz2qkqk7.fsf@arm.com>
> > + if (TYPE_PRECISION (unprom_diff.type) != TYPE_PRECISION (abs_type)
> > + && TYPE_UNSIGNED (unprom_diff.type)
> > + && TYPE_UNSIGNED (abs_type))
>
> The last line is now redundant, since TYPE_UNSIGNED was checked above.
Done.
> > + // Failed to find a widen operation so we check for a regular MINUS_EXPR
>
> Nit: please use /* ... */ for files that currently use that style.
Done.
> > + if (diff_oprnds && diff
> > + && gimple_assign_rhs_code (diff) == MINUS_EXPR)
>
> We also need to check TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (abs_oprnd)),
> since this case exploits undefined behaviour for signed subtraction.
Done.
> > + UABD expressions are used when the input types are
> > + narrower than the output types or the output type is narrower
> > + than 32 bits
>
> Isn't it only the first (input types narrower than the output types)?
> I guess the second part is referring to the fact that, in C, an operation
> on sub-32-bit values will happen in int and then be narrowed back down.
> But in gimple that's all explicit, and it's the widening to int that
> allows UABD to be used. (And UABD can then be used regardless of whether
> the result is narrowed back down.)
Dropped this block as it is no longer applicable. Must've been from a much
earlier version of this patch.
> Might as well drop signed_out_vectype and use vectype directly.
Done.
> > + if (!SAME_TYPE (TREE_TYPE (diff_oprnds[0]), TREE_TYPE (abd_oprnds[0])))
> > + return NULL;
>
> This shouldn't be necesary. The transformation would be correct
> even if the subtraction is widened before the ABS, since we already
> checked for signed promotion, and since we're only trying SABD.
Done.
Patch is in the next response.
next prev parent reply other threads:[~2023-06-06 9:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-09 16:07 Oluwatamilore Adebayo
2023-05-10 9:01 ` Richard Sandiford
2023-05-10 9:49 ` Richard Biener
2023-05-10 9:51 ` Richard Biener
2023-05-10 15:27 ` Richard Sandiford
2023-05-17 12:21 ` oluwatamilore.adebayo
2023-05-18 8:39 ` [PATCH 1/4] " Oluwatamilore.Adebayo
2023-05-18 17:59 ` Richard Sandiford
2023-05-22 13:32 ` Richard Biener
2023-05-23 14:27 ` [PATCH] vect: " Oluwatamilore Adebayo
2023-05-23 14:34 ` [PATCH 1/2] " Oluwatamilore Adebayo
2023-05-24 9:48 ` Richard Sandiford
2023-06-06 9:50 ` Oluwatamilore Adebayo [this message]
2023-06-06 9:53 ` Oluwatamilore Adebayo
2023-06-06 12:56 ` Richard Sandiford
2023-06-06 14:34 ` Oluwatamilore Adebayo
2023-06-08 10:28 ` [PATCH] vect: " Oluwatamilore Adebayo
2023-06-08 10:31 ` [PATCH 1/2] " Oluwatamilore Adebayo
2023-06-13 8:26 ` Oluwatamilore Adebayo
2023-06-14 11:15 ` Richard Sandiford
2023-06-14 15:26 ` Oluwatamilore Adebayo
2023-06-15 6:38 ` Richard Sandiford
2023-05-10 13:29 ` [PATCH] vect: " Oluwatamilore Adebayo
2023-05-15 12:35 ` Oluwatamilore Adebayo
-- strict thread matches above, loose matches on Subject: below --
2023-05-09 16:00 Oluwatamilore Adebayo
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=20230606095044.24470-1-oluwatamilore.adebayo@arm.com \
--to=oluwatamilore.adebayo@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.guenther@gmail.com \
--cc=richard.sandiford@arm.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).