[PATCH V2] [x86] Optimize a < 0 ? -1 : 0 to (signed)a >> 31.

2024-06-23 Thread liuhongt
> I think the check for TYPE_UNSIGNED should be of TREE_TYPE (@0) rather > than type here. Changed > Or maybe you need `types_match (type, TREE_TYPE (@0))` too. And use tree_nop_conversion_p (type, TREE_TYPE (@0)) and add view_convert to rshift. Bootstrapped and regtested on x86_64-pc-linux-gnu

Re: [PATCH V2] [x86] Optimize a < 0 ? -1 : 0 to (signed)a >> 31.

2024-06-25 Thread Richard Biener
On Mon, Jun 24, 2024 at 1:28 AM liuhongt wrote: > > > I think the check for TYPE_UNSIGNED should be of TREE_TYPE (@0) rather > > than type here. > > Changed > > > Or maybe you need `types_match (type, TREE_TYPE (@0))` too. > And use tree_nop_conversion_p (type, TREE_TYPE (@0)) and add view_convert