Re: [PATCH] recognize implied ranges for modulo.

2020-11-18 Thread Andrew MacLeod via Gcc-patches
On 11/18/20 3:35 AM, Aldy Hernandez wrote: On 11/17/20 11:01 PM, Andrew MacLeod wrote: PR 91029 observes when   a % b > 0 && b >= 0, then a has an implied range of  a >=0.  likewise Shouldn't that be && b > 0?  b == 0 is undefined. If you were folding, sure, but  I think its OK for equat

Re: [PATCH] recognize implied ranges for modulo.

2020-11-18 Thread Aldy Hernandez via Gcc-patches
On 11/17/20 11:01 PM, Andrew MacLeod wrote: PR 91029 observes when  a % b > 0 && b >= 0, then a has an implied range of  a >=0.  likewise Shouldn't that be && b > 0? b == 0 is undefined. a % b < 0 implies a range of a <= 0. This patch is a good example of how range-ops can be leverag

[PATCH] recognize implied ranges for modulo.

2020-11-17 Thread Andrew MacLeod via Gcc-patches
PR 91029 observes when  a % b > 0 && b >= 0, then a has an implied range of  a >=0.  likewise a % b < 0 implies a range of a <= 0. This patch is a good example of how range-ops can be leveraged to solve problems. It simply implements operator_trunc_mod::op1_range()  to solve for 'A' when the