Commit e33f43b9 by Richard Biener Committed by Richard Biener

re PR tree-optimization/61680 (vectorization gives wrong answer for sandybridge target)

2014-07-08  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/61680
	* tree-vect-data-refs.c (vect_analyze_data_ref_dependence):
	Handle properly all read-write dependences with group accesses.

	* gcc.dg/vect/pr61680.c: New testcase.

From-SVN: r212348
parent 0f6284d2
2014-07-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/61680
* tree-vect-data-refs.c (vect_analyze_data_ref_dependence):
Handle properly all read-write dependences with group accesses.
2014-07-08 Yuri Rumyantsev <ysrumyan@gmail.com>
PR tree-optimization/61576
......
2014-07-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/61680
* gcc.dg/vect/pr61680.c: New testcase.
2014-07-08 Yuri Rumyantsev <ysrumyan@gmail.com>
PR tree-optimization/61576
......
/* { dg-do run } */
#include "tree-vect.h"
double v[4096][4];
__attribute__((noinline, noclone)) void
bar (double p[][4])
{
int i;
double d = 172.0;
for (i = 0; i < 4096; i++)
{
if (p[i][0] != 6.0 || p[i][1] != 6.0 || p[i][2] != 10.0)
__builtin_abort ();
if (__builtin_fabs (p[i][3] - d) > 0.25)
__builtin_abort ();
}
}
__attribute__((noinline, noclone)) void
foo (void)
{
int i;
double w[4096][4], t;
for (i = 0; i < 4096; i++)
{
w[i][0] = v[i][0] + 2.0;
w[i][1] = v[i][1] + 1.0;
w[i][2] = v[i][2] + 4.0;
w[i][3] = (w[i][0] * w[i][0] + w[i][1] * w[i][1] + w[i][2] * w[i][2]);
}
bar (w);
}
int
main ()
{
int i;
check_vect ();
for (i = 0; i < 4096; i++)
{
v[i][0] = 4.0;
v[i][1] = 5.0;
v[i][2] = 6.0;
}
foo ();
return 0;
}
......@@ -375,11 +375,14 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
.. = a[i+1];
where we will end up loading { a[i], a[i+1] } once, make
sure that inserting group loads before the first load and
stores after the last store will do the right thing. */
if ((STMT_VINFO_GROUPED_ACCESS (stmtinfo_a)
&& GROUP_SAME_DR_STMT (stmtinfo_a))
|| (STMT_VINFO_GROUPED_ACCESS (stmtinfo_b)
&& GROUP_SAME_DR_STMT (stmtinfo_b)))
stores after the last store will do the right thing.
Similar for groups like
a[i] = ...;
... = a[i];
a[i+1] = ...;
where loads from the group interleave with the store. */
if (STMT_VINFO_GROUPED_ACCESS (stmtinfo_a)
|| STMT_VINFO_GROUPED_ACCESS (stmtinfo_b))
{
gimple earlier_stmt;
earlier_stmt = get_earlier_stmt (DR_STMT (dra), DR_STMT (drb));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment