Re: [PATCH 1/2] Match: zero_one_valued_p should match 0 constants too

2023-06-07 Thread Jeff Law via Gcc-patches
On 6/7/23 01:12, Jakub Jelinek via Gcc-patches wrote: +/* zero_one_valued_p will match when a value is known to be either + 0 or 1 including the constant 0. */ (match zero_one_valued_p @0 (if (INTEGRAL_TYPE_P (type) && tree_nonzero_bits (@0) == 1))) So perhaps instead change

Re: [PATCH 1/2] Match: zero_one_valued_p should match 0 constants too

2023-06-07 Thread Jakub Jelinek via Gcc-patches
On Tue, Jun 06, 2023 at 05:17:05PM -0700, Andrew Pinski via Gcc-patches wrote: > While working on `bool0 ? bool1 : bool2` I noticed that > zero_one_valued_p does not match on the constant zero > as in that case tree_nonzero_bits will return 0 and > that is different from 1. > > OK? Bootstrapped

Re: [PATCH 1/2] Match: zero_one_valued_p should match 0 constants too

2023-06-06 Thread Jeff Law via Gcc-patches
On 6/6/23 18:17, Andrew Pinski via Gcc-patches wrote: While working on `bool0 ? bool1 : bool2` I noticed that zero_one_valued_p does not match on the constant zero as in that case tree_nonzero_bits will return 0 and that is different from 1. OK? Bootstrapped and tested on x86_64-linux-gnu

[PATCH 1/2] Match: zero_one_valued_p should match 0 constants too

2023-06-06 Thread Andrew Pinski via Gcc-patches
While working on `bool0 ? bool1 : bool2` I noticed that zero_one_valued_p does not match on the constant zero as in that case tree_nonzero_bits will return 0 and that is different from 1. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * match.pd