[Bug tree-optimization/66278] Missed auto-vectorization of an array subtraction

2017-04-21 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66278

Martin Liška  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Martin Liška  ---
Test has been added, closing as resolved.

[Bug tree-optimization/66278] Missed auto-vectorization of an array subtraction

2017-04-21 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66278

--- Comment #8 from Martin Liška  ---
Author: marxin
Date: Fri Apr 21 08:50:19 2017
New Revision: 247051

URL: https://gcc.gnu.org/viewcvs?rev=247051=gcc=rev
Log:
Add test-case (PR tree-optimization/66278).

2017-04-21  Martin Liska  

PR tree-optimization/66278
* gcc.dg/vect/pr66278.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/vect/pr66278.c
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug tree-optimization/66278] Missed auto-vectorization of an array subtraction

2017-04-19 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66278

--- Comment #7 from amker at gcc dot gnu.org ---
(In reply to Martin Liška from comment #6)
> (In reply to amker from comment #5)
> > (In reply to Martin Liška from comment #4)
> > > Greating, starting from r238586 the test-case is vectorized. Bin should I
> > > create a test-case from this, or do you have a similar one. I'll then 
> > > close
> > > the PR.
> > 
> > Yes, please add a test for it.  Thanks.
> 
> Great, one last thing is how to identify that the vectorization happened. A
> dump file output?

Add test in gcc.dg/vect, and something like
/* { dg-final { scan-tree-dump-times "LOOP VECTORIZED" 1 "vect" } } */
You may also need
/* { dg-require-effective-target vect_int } */

Thanks.

[Bug tree-optimization/66278] Missed auto-vectorization of an array subtraction

2017-04-19 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66278

--- Comment #6 from Martin Liška  ---
(In reply to amker from comment #5)
> (In reply to Martin Liška from comment #4)
> > Greating, starting from r238586 the test-case is vectorized. Bin should I
> > create a test-case from this, or do you have a similar one. I'll then close
> > the PR.
> 
> Yes, please add a test for it.  Thanks.

Great, one last thing is how to identify that the vectorization happened. A
dump file output?

[Bug tree-optimization/66278] Missed auto-vectorization of an array subtraction

2017-04-19 Thread amker at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66278

amker at gcc dot gnu.org changed:

   What|Removed |Added

 CC||amker at gcc dot gnu.org

--- Comment #5 from amker at gcc dot gnu.org ---
(In reply to Martin Liška from comment #4)
> Greating, starting from r238586 the test-case is vectorized. Bin should I
> create a test-case from this, or do you have a similar one. I'll then close
> the PR.

Yes, please add a test for it.  Thanks.

[Bug tree-optimization/66278] Missed auto-vectorization of an array subtraction

2017-04-19 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66278

Martin Liška  changed:

   What|Removed |Added

 CC||amker.cheng at gmail dot com
  Known to work||7.0.1

--- Comment #4 from Martin Liška  ---
Greating, starting from r238586 the test-case is vectorized. Bin should I
create a test-case from this, or do you have a similar one. I'll then close the
PR.

[Bug tree-optimization/66278] Missed auto-vectorization of an array subtraction

2016-08-03 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66278

Andrew Pinski  changed:

   What|Removed |Added

  Known to fail||6.1.0

--- Comment #3 from Andrew Pinski  ---
I know there has been some improvements to tree-chrec on the trunk but I have
not tried there yet.

[Bug tree-optimization/66278] Missed auto-vectorization of an array subtraction

2015-12-23 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66278

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-12-24
 Ever confirmed|0   |1
   Severity|normal  |enhancement

--- Comment #2 from Andrew Pinski  ---
Confirmed.

[Bug tree-optimization/66278] Missed auto-vectorization of an array subtraction

2015-05-25 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66278

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek jakub at gcc dot gnu.org ---
Seems to be overly conservative tree-chrec.c code.
chrec_fold_plus is called on
(sizetype) {i_5, +, 1}_1 and 30906
where loop-nb_iterations_upper_bound is 100 and
loop-nb_iterations is (unsigned int) _4 + 1 = 101 ? 100 - (unsigned int) _4 :
0
It is a pitty we don't use range info on _4 when simplifying
loop-nb_iterations, here it is [0, 1], so we could at least easily find out
that (unsigned int) _4 + 1 = 101 is always true.
Anyway, chrec_fold_plus just gives up on:
CASE_CONVERT:
  if (tree_contains_chrecs (op0, NULL))
return chrec_dont_know;
eventhough from the loop bounds in this case it could prove that for all loop
iterations the chrec always fits into the narrower type, including the addition
and thus it can safely move the addition into the chrec's op0.
If I change [3][3] to [0][0], then the problem is in chrec_fold_multiply
instead (again, we have (sizetype) i_16 * 4 and give up because of the cast).

If the testcase is modified, so that it uses unsigned long as i and next type,
then it is vectorized fine.