> Do we have evidence that targets properly cost XOR vs SUB RTXen?
>
> It might actually be a reload optimization - when the constant is
> available in a register use 'sub', when it needs to be reloaded
> use 'xor'?
>
> That said, I wonder if the fallout of changing some SUB to XOR
> is bigger th
On 9/7/2022 6:45 AM, Richard Biener via Gcc-patches wrote:
On Wed, Sep 7, 2022 at 2:20 PM Robin Dapp wrote:
The question is really whether xor or sub is "better" statically. I can't
think of any reasons. On s390, why does xor end up "better"?
There is an xor with immediate (as opposed to
On Wed, Sep 7, 2022 at 2:20 PM Robin Dapp wrote:
>
> > The question is really whether xor or sub is "better" statically. I can't
> > think of any reasons. On s390, why does xor end up "better"?
>
> There is an xor with immediate (as opposed to no "subtract from
> immediate") which saves an instr
> The question is really whether xor or sub is "better" statically. I can't
> think of any reasons. On s390, why does xor end up "better"?
There is an xor with immediate (as opposed to no "subtract from
immediate") which saves an instruction, usually. On x86, I think the
usual argument for xor
On Tue, Sep 6, 2022 at 4:01 PM Robin Dapp wrote:
>
> > cost might also depend on the context in case flag setting
> > behavior differs for xor vs sub (on x86 sub looks strictly more
> > powerful here). The same is probably true when looking for
> > a combination with another bitwise operation.
>
> cost might also depend on the context in case flag setting
> behavior differs for xor vs sub (on x86 sub looks strictly more
> powerful here). The same is probably true when looking for
> a combination with another bitwise operation.
>
> Btw, why not perform the optimization in expand_binop? T
On Tue, Sep 6, 2022 at 11:42 AM Robin Dapp wrote:
>
> Hi,
>
> posting this separately from PR91213 now. I wrote an s390 test and most
> likely it could also be done for x86 which will give it broader coverage.
>
> Depending on the backend it might be better to convert
> cst - x
> into
> cst x
Hi,
posting this separately from PR91213 now. I wrote an s390 test and most
likely it could also be done for x86 which will give it broader coverage.
Depending on the backend it might be better to convert
cst - x
into
cst xor x
if cst + 1 is a power of two and 0 <= x <= cst. This patch comp