On Fri, Nov 11, 2016 at 11:19 AM, Hurugalawadi, Naveen <naveen.hurugalaw...@cavium.com> wrote: > Hi, > > Sorry for a very late reply as the mail was missed or overlooked. > >>> could now move the test tree_expr_nonzero_p next to >>> tree_expr_nonnegative_p (it is redundant for the last case). > > Done. > >>> Often just a comment can really help here. > > Comments updated as per the suggestion > >>> when C is zero and verify this transformation doesn't fire on that case. > > Updated test to check with zero. > >>> verifying that the operand orders change appropriately when dealing >>> with a negative constant. > > Done. > >>> verify nothing happens with floating point or vector types. > > Done. > > Please review the patch and let me know if any modifications are required. > Regression tested on X86 and AArch64.
Ok with using wi::neg_p (@1, TYPE_SIGN (TREE_TYPE (@1))) instead of wi::lt_p. Thanks, Richard. > Thanks, > Naveen > > 2016-11-11 Naveen H.S <naveen.hurugalaw...@caviumnetworks.com> > gcc > * fold-const.c (tree_expr_nonzero_p) : Make non-static. > * fold-const.h (tree_expr_nonzero_p) : Declare. > * match.pd (cmp (mult:c @0 @1) (mult:c @2 @1) : New Pattern. > * match.pd (cmp (mult:c @0 @1) (mult:c @2 @1) : New Pattern. > gcc/testsuite > * gcc.dg/pr31096.c: New testcase. > * gcc.dg/pr31096-1.c: New testcase.