From: Jeff Law <jeffreyalaw@gmail.com>
To: Vineet Gupta <vineetg@rivosinc.com>,
Robin Dapp <rdapp.gcc@gmail.com>,
gcc-patches@gcc.gnu.org
Cc: gnu-toolchain@rivosinc.com
Subject: Re: [RFC] RISC-V: elide sign extend when expanding cmp_and_jump
Date: Wed, 25 Oct 2023 10:30:04 -0600 [thread overview]
Message-ID: <b662e905-6be8-4491-aede-6fcfc54964a8@gmail.com> (raw)
In-Reply-To: <04f85309-4b40-4797-a424-ff207dd0724d@rivosinc.com>
On 10/25/23 10:25, Vineet Gupta wrote:
> Hey Robin,
>
> On 10/25/23 00:12, Robin Dapp wrote:
>> Hi Vineet,
>>
>> I was thinking of two things while skimming the code:
>>
>> - Couldn't we do this in the expanders directly? Or is the
>> subreg-promoted info gone until we reach that?
>
> Following is the call stack involved:
>
> expand_gimple_cond
> do_compare_and_jump
> emit_cmp_and_jump_insns
> gen_cbranchqi4
> riscv_expand_conditional_branch
> riscv_emit_int_compare
> riscv_extend_comparands
>
>
> Last function is what introduces the extraneous sign extends, w/o taking
> subreg-promoted into consideration and what my patch attempts to address.
>
>> - Should some common-code part be more suited to handle that?
>> We already elide redundant sign-zero extensions for other
>> reasons. Maybe we could add subreg promoted handling there?
>
> Not in the context of this specific issue.
Robin's point (IIUC) is that if we put this logic into a zero/sign
extend expander, then it'll get used for *any* attempt to zero/sign
extend that goes through the target expander.
It doesn't work for your case because we use gen_rtx_{ZERO,SIGN}_EXTEND
directly. But if those were adjusted to use the expander, then Robin's
idea would be applicable to this case too.
Jeff
next prev parent reply other threads:[~2023-10-25 16:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 5:01 Vineet Gupta
2023-10-25 7:12 ` Robin Dapp
2023-10-25 13:32 ` Jeff Law
2023-10-25 13:47 ` Robin Dapp
2023-10-25 13:52 ` Jeff Law
2023-10-25 16:37 ` Vineet Gupta
2023-10-25 16:25 ` Vineet Gupta
2023-10-25 16:30 ` Jeff Law [this message]
2023-10-25 16:31 ` Vineet Gupta
2023-10-25 23:28 ` Vineet Gupta
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=b662e905-6be8-4491-aede-6fcfc54964a8@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gnu-toolchain@rivosinc.com \
--cc=rdapp.gcc@gmail.com \
--cc=vineetg@rivosinc.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).