Re: [PATCH 2/3] Simplify wrapped binops

2017-07-15 Thread Marc Glisse
On Wed, 5 Jul 2017, Robin Dapp wrote: While the initialization value doesn't matter (wi::add will overwrite it) better initialize both to false ;) Ah, you mean because we want to transform only if get_range_info returned VR_RANGE. Indeed somewhat unintuitive (but still the best variant for

Re: [PATCH 2/3] Simplify wrapped binops

2017-07-05 Thread Robin Dapp
[3/3] Tests -- gcc/testsuite/ChangeLog: 2017-07-05 Robin Dapp * gcc.dg/wrapped-binop-simplify-signed-1.c: New test. * gcc.dg/wrapped-binop-simplify-signed-2.c: New test. * gcc.dg/wrapped-binop-simplify-unsigned-1.c: New test. *

Re: [PATCH 2/3] Simplify wrapped binops

2017-07-05 Thread Robin Dapp
> While the initialization value doesn't matter (wi::add will overwrite it) > better initialize both to false ;) Ah, you mean because we want to > transform only if get_range_info returned VR_RANGE. Indeed somewhat > unintuitive (but still the best variant for now). > so I'm still missing a

Re: [PATCH 2/3] Simplify wrapped binops

2017-07-03 Thread Richard Biener
On Wed, Jun 28, 2017 at 4:34 PM, Robin Dapp wrote >> ideally you'd use a wide-int here and defer the tree allocation to the result > > Did that in the attached version. > >> So I guess we never run into the outer_op == minus case as the above is >> clearly wrong for

Re: [PATCH 2/3] Simplify wrapped binops

2017-06-28 Thread Robin Dapp
> ideally you'd use a wide-int here and defer the tree allocation to the result Did that in the attached version. > So I guess we never run into the outer_op == minus case as the above is > clearly wrong for that? Right, damn, not only was the treatment for this missing but it was bogus in the

Re: [PATCH 2/3] Simplify wrapped binops

2017-06-27 Thread Richard Biener
On Wed, Jun 21, 2017 at 1:44 PM, Robin Dapp wrote: >> use INTEGRAL_TYPE_P. > > Done. > >> but you do not actually _use_ vr_outer. Do you think that if >> vr_outer is a VR_RANGE then the outer operation may not >> possibly have wrapped? That's a false conclusion. > >

Re: [PATCH 2/3] Simplify wrapped binops

2017-06-27 Thread Robin Dapp
Ping.

Re: [PATCH 2/3] Simplify wrapped binops

2017-06-21 Thread Robin Dapp
> use INTEGRAL_TYPE_P. Done. > but you do not actually _use_ vr_outer. Do you think that if > vr_outer is a VR_RANGE then the outer operation may not > possibly have wrapped? That's a false conclusion. These were remains of a previous version. vr_outer is indeed not needed anymore; removed.

Re: [PATCH 2/3] Simplify wrapped binops

2017-06-20 Thread Richard Biener
On Tue, Jun 20, 2017 at 3:08 PM, Robin Dapp wrote: >>> Currently, extract_... () does that all that for me, is it really too >>> expensive to call? I guess, using get_range_info first and calling >>> extract when get_range_info returns a VR_RANGE is not really a

Re: [PATCH 2/3] Simplify wrapped binops

2017-06-20 Thread Robin Dapp
>> Currently, extract_... () does that all that for me, is it really too >> expensive to call? I guess, using get_range_info first and calling >> extract when get_range_info returns a VR_RANGE is not really a favorable >> thing to do either? :) > Not only the cost, we should avoid introducing more

Re: [PATCH 2/3] Simplify wrapped binops

2017-05-19 Thread Richard Biener
On Fri, May 19, 2017 at 12:13 PM, Bin.Cheng wrote: > On Fri, May 19, 2017 at 11:09 AM, Robin Dapp wrote: >>> I can guess what is happening here. It's a 40 bits unsigned long long >>> field, (s.b-8) will be like: >>> _1 = s.b >>> _2 = _1 +

Re: [PATCH 2/3] Simplify wrapped binops

2017-05-19 Thread Bin.Cheng
On Fri, May 19, 2017 at 11:09 AM, Robin Dapp wrote: >> I can guess what is happening here. It's a 40 bits unsigned long long >> field, (s.b-8) will be like: >> _1 = s.b >> _2 = _1 + 0xf8 >> Also get_range_info returns value range [0, 0xFF] for _1. >>

Re: [PATCH 2/3] Simplify wrapped binops

2017-05-19 Thread Robin Dapp
> I can guess what is happening here. It's a 40 bits unsigned long long > field, (s.b-8) will be like: > _1 = s.b > _2 = _1 + 0xf8 > Also get_range_info returns value range [0, 0xFF] for _1. > You'd need to check if _1(with range [0, 0xFF]) + 0xf8 > overflows

Re: [PATCH 2/3] Simplify wrapped binops

2017-05-18 Thread Bin.Cheng
On Thu, May 18, 2017 at 5:08 PM, Robin Dapp wrote: >> Any reason to expose tree-vrp.c internal interface here? The function >> looks quite expensive. Overflow check can be done by get_range_info >> and simple wi::cmp calls. Existing code like in >>

Re: [PATCH 2/3] Simplify wrapped binops

2017-05-18 Thread Robin Dapp
> Any reason to expose tree-vrp.c internal interface here? The function > looks quite expensive. Overflow check can be done by get_range_info > and simple wi::cmp calls. Existing code like in > tree-ssa-loop-niters.c already does that. Also could you avoid using > comma expressions in

Re: [PATCH 2/3] Simplify wrapped binops

2017-05-18 Thread Bin.Cheng
On Thu, May 18, 2017 at 3:47 PM, Robin Dapp wrote: > match.pd part of the patch. > > gcc/ChangeLog: > > 2017-05-18 Robin Dapp > > * match.pd: Simplify wrapped binary operations. > * tree-vrp.c

[PATCH 2/3] Simplify wrapped binops

2017-05-18 Thread Robin Dapp
match.pd part of the patch. gcc/ChangeLog: 2017-05-18 Robin Dapp * match.pd: Simplify wrapped binary operations. * tree-vrp.c (extract_range_from_binary_expr_1): Add overflow parameter. (extract_range_from_binary_expr): Likewise.