From: Bin Cheng Date: Thu, 29 Jun 2017 10:41:28 +0000 (+0000) Subject: re PR tree-optimization/81196 (Number of iterations found for p!=q but not for p + + PR tree-optimization/81196 + * tree-ssa-loop-niter.c (number_of_iterations_cond): Handle loop + exit condition comparing two IVs. + 2017-06-29 Richard Earnshaw * config/arm/parsecpu.awk (gen_comm_data): Add initializer for diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cf4d7e618d5..c38422a7797 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-06-29 Bin Cheng + + PR tree-optimization/81196 + * gcc.dg/vect/pr81196.c: New. + 2017-06-29 Michael Collison Fix date on previous ChangeLog entry. diff --git a/gcc/testsuite/gcc.dg/vect/pr81196.c b/gcc/testsuite/gcc.dg/vect/pr81196.c new file mode 100644 index 00000000000..46d7a9ebc57 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr81196.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_perm_short } */ + +void f(short*p){ + p=(short*)__builtin_assume_aligned(p,64); + short*q=p+256; + for(;p!=q;++p,--q){ + short t=*p;*p=*q;*q=t; + } +} +void b(short*p){ + p=(short*)__builtin_assume_aligned(p,64); + short*q=p+256; + for(;pstep) && !integer_zerop (iv1->step)) { tree step_type = POINTER_TYPE_P (type) ? sizetype : type; - if (code != NE_EXPR) + tree step = fold_binary_to_constant (MINUS_EXPR, step_type, + iv0->step, iv1->step); + + /* No need to check sign of the new step since below code takes care + of this well. */ + if (code != NE_EXPR && TREE_CODE (step) != INTEGER_CST) return false; - iv0->step = fold_binary_to_constant (MINUS_EXPR, step_type, - iv0->step, iv1->step); - iv0->no_overflow = false; + iv0->step = step; + if (!POINTER_TYPE_P (type)) + iv0->no_overflow = false; + iv1->step = build_int_cst (step_type, 0); iv1->no_overflow = true; }