[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    Re: [PATCH] convert (xor (and (xor A B) C) A) to (ior (and A ~C) (and B C)) [PR90323]
From:       Segher Boessenkool <segher () kernel ! crashing ! org>
Date:       2021-12-30 18:56:32
Message-ID: 20211230185632.GN614 () gate ! crashing ! org
[Download RAW message or body]

Hi!

On Tue, Dec 28, 2021 at 07:27:06PM -0600, Xionghu Luo wrote:
> Bootstrapped and regtested on powerpc64le-linux-gnu {P10,P9}
> powerpc64-linux-gnu {P8, P7} and X86.  OK for master?
> 
> gcc/ChangeLog:
> 
> 	PR 90323
> 	* simplify-rtx.c (simplify_context::simplify_binary_operation_1): Relax
> 	C from constant to constant or reg.

So, this doesn't even do the right thing for PowerPC, for scalar
operations that is: we only have rl[wd]imi for this, and nothing that
uses a register for the mask instead.  Not that it will hurt much at all
(if anything) in practice, but :-)

OTOH for vectors we have vsel/xxsel, which always uses a register for
the mask.

On yet another hand, the formulation with two XORs is just obfuscation,
for RTL.  RTL very much does not have the rule that fewer ops is better.

So, ideally we will never get this nonsense in RTL at all.  Probably the
simplest / best way to get there is to not have it in Gimple either, and
instead just use some "select" operation there, which can be optimised
much better anyway?

And yeah that will be GCC 13 stuff :-(


Segher
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic