From: Palmer Dabbelt <palmer@dabbelt.com>
To: monk.chiang@sifive.com
Cc: jeffreyalaw@gmail.com, rguenther@suse.de,
gcc-patches@gcc.gnu.org, apinski@marvell.com
Subject: Re: [PATCH] match: Do not select to branchless expression when target has movcc pattern [PR113095]
Date: Wed, 17 Jan 2024 19:30:50 -0800 (PST) [thread overview]
Message-ID: <mhng-795d0cf1-61a5-416e-ba6f-43a45120b673@palmer-ri-x1c9> (raw)
In-Reply-To: <CAMpi97z2_kHfqagQ4wPDsxCQ=MhY0nx3tatC++xvgoEQHsvoQQ@mail.gmail.com>
On Wed, 17 Jan 2024 19:19:58 PST (-0800), monk.chiang@sifive.com wrote:
> Thanks for your advice!! I agree it should be fixed in the RISC-V backend
> when expansion.
>
>
> On Wed, Jan 17, 2024 at 10:37 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>>
>>
>> On 1/17/24 05:14, Richard Biener wrote:
>> > On Wed, 17 Jan 2024, Monk Chiang wrote:
>> >
>> >> This allows the backend to generate movcc instructions, if target
>> >> machine has movcc pattern.
>> >>
>> >> branchless-cond.c needs to be updated since some target machines have
>> >> conditional move instructions, and the experssion will not change to
>> >> branchless expression.
>> >
>> > While I agree this pattern should possibly be applied during RTL
>> > expansion or instruction selection on x86 which also has movcc
>> > the multiplication is cheaper. So I don't think this isn't the way to
>> go.
>> >
>> > I'd rather revert the change than trying to "fix" it this way?
>> WRT reverting -- the patch in question's sole purpose was to enable
>> branchless sequences for that very same code. Reverting would regress
>> performance on a variety of micro-architectures. IIUC, the issue is
>> that the SiFive part in question has a fusion which allows it to do the
>> branchy sequence cheaply.
>>
>> ISTM this really needs to be addressed during expansion and most likely
>> with a RISC-V target twiddle for the micro-archs which have
>> short-forward-branch optimizations.
IIRC I ran into some of these middle-end interactions a year or two ago
and determined that we'd need middle-end changes to get this working
smoothly -- essentially replacing the expander checks for a MOVCC insn
with some sort of costing.
Without that, we're just going to end up with some missed optimizations
that favor one way or the other.
>>
>> jeff
>>
prev parent reply other threads:[~2024-01-18 3:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 9:50 Monk Chiang
2024-01-17 12:14 ` Richard Biener
2024-01-17 14:37 ` Jeff Law
2024-01-18 3:19 ` Monk Chiang
2024-01-18 3:30 ` Palmer Dabbelt [this message]
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=mhng-795d0cf1-61a5-416e-ba6f-43a45120b673@palmer-ri-x1c9 \
--to=palmer@dabbelt.com \
--cc=apinski@marvell.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@gmail.com \
--cc=monk.chiang@sifive.com \
--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).