On Fri, Apr 28, 2017 at 1:35 PM, Marc Glisse <marc.gli...@inria.fr> wrote: > Hello, > > surprisingly, this did not cause any Wstrict-overflow failure. Some of it > sounds more like reassoc's job, but it is convenient to handle simple cases > in match.pd. I think we could wait until there are reports of regressions > related to register pressure before adding single_use tests. > > For a std::vector<long> v, we now simplify v.size()==v.capacity() to a > single comparison (long)finish==(long)end_storage (I guess I could still try > to drop the casts to consider it really done). Handling > v.size()<v.capacity() seems much harder, because of C++'s questionable > choice to use unsigned types. I may still be able to remove the divisions, > I'll see if I can sprinkle some 'convert' in recent transformations. > > Bootstrap+regtest on powerpc64le-unknown-linux-gnu.
+(for cmp (eq ne minus) Fat fingered 'minus' (in all places) or did you want to get fancy? (the transforms look valid even for cmp == minus) Maybe adjust comments to reflect this. There are a few related cases in fold-const.c, namely X +- Y CMP X -> Y CMP 0, some of them also handling POINTER_PLUS_EXPR. So I wonder if you can handle pointer_plus like plus and maybe move those fold-const.c patterns. Can be done as followup of course. Ok with minus removed or comments adjusted. Thanks, Richard. > 2017-04-28 Marc Glisse <marc.gli...@inria.fr> > > gcc/ > * match.pd (X+Z CMP Y+Z, X-Z CMP Y-Z, Z-X CMP Z-Y): New > transformations. > > gcc/testsuite/ > * gcc.dg/tree-ssa/cmpexactdiv-2.c: Update for X-Z CMP Y-Z. > > -- > Marc Glisse