[PATCH] phiopt: Improve conditional_replacement for x ? 0 : -1 [PR796232]

2020-12-05 Thread Jakub Jelinek via Gcc-patches
Hi! As mentioned in the PR, for boolean x we currently optimize in phiopt x ? 0 : -1 into -(int)!x but it can be optimized as (int) x - 1 which is one less operation both in GIMPLE and in x86 assembly. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? And/or, shall we have a m

Re: [PATCH] phiopt: Improve conditional_replacement for x ? 0 : -1 [PR796232]

2020-12-05 Thread Richard Biener
On December 5, 2020 10:10:25 AM GMT+01:00, Jakub Jelinek wrote: >Hi! > >As mentioned in the PR, for boolean x we currently optimize >in phiopt x ? 0 : -1 into -(int)!x but it can be optimized as >(int) x - 1 which is one less operation both in GIMPLE and in x86 >assembly. > >Bootstrapped/regteste