From: Jeff Law <jeffreyalaw@gmail.com>
To: Andrew Pinski <pinskia@gmail.com>,
Michael Collison <collison@rivosinc.com>
Cc: gcc-patches@gcc.gnu.org, Jeff Law <jlaw@ventanamicro.com>,
"jakub@redhat.com >> Jakub Jelinek" <jakub@redhat.com>
Subject: Re: [PATCH] match.pd: rewrite select to branchless expression
Date: Thu, 17 Nov 2022 14:59:30 -0700 [thread overview]
Message-ID: <17cfa5ef-511e-5d74-157f-498a9757e87d@gmail.com> (raw)
In-Reply-To: <CA+=Sn1=hdi-iP2xxj5O1CguBN_X9iS97UPSEJZ_vSX_tNeoJgg@mail.gmail.com>
On 11/8/22 13:15, Andrew Pinski via Gcc-patches wrote:
> On Tue, Nov 8, 2022 at 12:02 PM Michael Collison <collison@rivosinc.com> wrote:
>> This patches transforms (cond (and (x , 0x1) == 0), y, (z op y)) into
>> (-(and (x , 0x1)) & z ) op y, where op is a '^' or a '|'. It also
>> transforms (cond (and (x , 0x1) != 0), (z op y), y ) into (-(and (x ,
>> 0x1)) & z ) op y.
>>
>> Matching this patterns allows GCC to generate branchless code for one of
>> the functions in coremark.
>>
>> Bootstrapped and tested on x86 and RISC-V. Okay?
> This seems like a (much) reduced (simplified?) version of
> https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584411.html .
> I have not had time for the last year to go through the comments on
> that patch and resubmit it though.
> It seems like you are aiming for one specific case in coremarks rather
> than a more generic fix too.
I'm fairly confident it was developed independently. Michael did this
transformation for LLVM and reached out to me a month or two ago for
suggestions on the GCC implementation.
My recollection is I suggested phi-opt or match.pd with a slight
preference for phi-opt as I wasn't offhand sure if we'd have a form
suitable for match.pd.
THe pattern is just a conditional xor/ior with all is said and done.
While the inspiration comes from coremark, I don't think it's supposed
to be specific to coremark.
jeff
next prev parent reply other threads:[~2022-11-17 21:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-08 20:02 Michael Collison
2022-11-08 20:15 ` Andrew Pinski
2022-11-17 21:59 ` Jeff Law [this message]
2022-11-09 7:41 ` Richard Biener
2022-11-09 21:06 ` Michael Collison
2022-11-10 9:03 ` Richard Biener
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=17cfa5ef-511e-5d74-157f-498a9757e87d@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=collison@rivosinc.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jlaw@ventanamicro.com \
--cc=pinskia@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).