From: Jeff Law <jeffreyalaw@gmail.com>
To: "juzhe.zhong@rivai.ai" <juzhe.zhong@rivai.ai>,
gcc-patches <gcc-patches@gcc.gnu.org>
Cc: "kito.cheng" <kito.cheng@gmail.com>, palmer <palmer@dabbelt.com>,
wangfeng <wangfeng@eswincomputing.com>
Subject: Re: [PATCH] RISC-V: Optimize zbb ins sext.b and sext.h in rv64
Date: Sat, 25 Mar 2023 12:18:21 -0600 [thread overview]
Message-ID: <5f830f90-f31a-6687-f337-e8c3c3c8bb8f@gmail.com> (raw)
In-Reply-To: <D8CDCA89C9C276DA+20230324104549469046125@rivai.ai>
On 3/23/23 20:45, juzhe.zhong@rivai.ai wrote:
> Sounds like you are looking at redundant extension problem in RISC-V port.
> This is the issue I want to fix but I don't find the time to do that.
> My first impression is that we need to fix redundant extension in "ree"
> PASS.
> I am not sure.
It's actually quite a bit more complicated.
Some extension elimination can and probably should be happening in
gimple. In gimple you have access to type information as well as range
information. So you have the opportunity to do things like rewrite the
IL to use different types when it's safe to do so, or to use range
information to identify when an object is already properly extended and
thus eliminate the extension before we expand gimple into RTL.
Once in RTL, you can use forward propagation to eliminate extensions, or
at least fold them into existing operations. combine can eliminate
extensions and it has the ability to track (for example) if the upper
bits are copies of the sign bit, if they're known zero, etc. combine is
also capable of recognizing that a load implicitly extends and using
that knowledge to eliminate extensions or to discover that a pair of
shifts are just zero or sign extending a value, etc etc. combine also
interacts with simplify-rtx which is used by other passes, so there's a
chance that work in simplify-rtx can eliminate extensions not just in
combine, but in other passes as well.
REE is a post-register allocation pass and kind of the last chance to
eliminate extensions.
So for any given redundant extension, the way to go (IMHO) is to walk
through the optimizer pipeline to see where it can potentially be
eliminated. In general, the earlier in the optimizer pipeline the
extension can be eliminated, the better.
Jeff
next prev parent reply other threads:[~2023-03-25 18:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-24 2:45 juzhe.zhong
2023-03-24 6:13 ` Feng Wang
2023-03-25 18:18 ` Jeff Law [this message]
2023-03-27 1:32 ` Feng Wang
2023-03-27 2:05 ` Jeff Law
-- strict thread matches above, loose matches on Subject: below --
2023-03-24 1:53 Feng Wang
2023-04-22 0:08 ` Jeff Law
2023-04-22 0:13 ` Jeff Law
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=5f830f90-f31a-6687-f337-e8c3c3c8bb8f@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=juzhe.zhong@rivai.ai \
--cc=kito.cheng@gmail.com \
--cc=palmer@dabbelt.com \
--cc=wangfeng@eswincomputing.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).