public inbox for
 help / color / mirror / Atom feed
From: Jeff Law <>
To: Andrew Pinski <>,
	Michael Collison <>
Cc:, Jeff Law <>,
	" >> Jakub Jelinek" <>
Subject: Re: [PATCH] match.pd: rewrite select to branchless expression
Date: Thu, 17 Nov 2022 14:59:30 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On 11/8/22 13:15, Andrew Pinski via Gcc-patches wrote:
> On Tue, Nov 8, 2022 at 12:02 PM Michael Collison <> 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
> .
> 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.


  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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \

* 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).