re PR tree-optimization/60656 (x86 vectorization produces wrong code)
2014-04-04 Cong Hou <congh@google.com> PR tree-optimization/60656 * tree-vect-stmts.c (supportable_widening_operation): Fix a bug that elements in a vector with vect_used_by_reduction property are incorrectly reordered when the operation on it is not consistant with the one in reduction operation. 2014-04-04 Cong Hou <congh@google.com> PR tree-optimization/60656 * gcc.dg/vect/pr60656.c: New test. From-SVN: r209138
This commit is contained in:
parent
604fb57809
commit
ebc047a210
@ -1,3 +1,11 @@
|
||||
2014-04-04 Cong Hou <congh@google.com>
|
||||
|
||||
PR tree-optimization/60656
|
||||
* tree-vect-stmts.c (supportable_widening_operation):
|
||||
Fix a bug that elements in a vector with vect_used_by_reduction
|
||||
property are incorrectly reordered when the operation on it is not
|
||||
consistant with the one in reduction operation.
|
||||
|
||||
2014-04-04 John David Anglin <danglin@gcc.gnu.org>
|
||||
|
||||
PR rtl-optimization/60155
|
||||
|
@ -1,3 +1,8 @@
|
||||
2014-04-04 Cong Hou <congh@google.com>
|
||||
|
||||
PR tree-optimization/60656
|
||||
* gcc.dg/vect/pr60656.c: New test.
|
||||
|
||||
2014-04-04 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
|
||||
|
||||
* gcc.dg/builtin-bswap-6.c: Adjust return value to disable GCC
|
||||
|
45
gcc/testsuite/gcc.dg/vect/pr60656.c
Normal file
45
gcc/testsuite/gcc.dg/vect/pr60656.c
Normal file
@ -0,0 +1,45 @@
|
||||
/* { dg-require-effective-target vect_int } */
|
||||
|
||||
#include "tree-vect.h"
|
||||
|
||||
__attribute__ ((noinline)) long
|
||||
foo ()
|
||||
{
|
||||
int v[] = {5000, 5001, 5002, 5003};
|
||||
long s = 0;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 4; ++i)
|
||||
{
|
||||
long P = v[i];
|
||||
s += P*P*P;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
long
|
||||
bar ()
|
||||
{
|
||||
int v[] = {5000, 5001, 5002, 5003};
|
||||
long s = 0;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 4; ++i)
|
||||
{
|
||||
long P = v[i];
|
||||
s += P*P*P;
|
||||
__asm__ volatile ("");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
if (foo () != bar ())
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
|
||||
/* { dg-final { cleanup-tree-dump "vect" } } */
|
||||
|
@ -7848,7 +7848,21 @@ supportable_widening_operation (enum tree_code code, gimple stmt,
|
||||
stmt, vectype_out, vectype_in,
|
||||
code1, code2, multi_step_cvt,
|
||||
interm_types))
|
||||
return true;
|
||||
{
|
||||
/* Elements in a vector with vect_used_by_reduction property cannot
|
||||
be reordered if the use chain with this property does not have the
|
||||
same operation. One such an example is s += a * b, where elements
|
||||
in a and b cannot be reordered. Here we check if the vector defined
|
||||
by STMT is only directly used in the reduction statement. */
|
||||
tree lhs = gimple_assign_lhs (stmt);
|
||||
use_operand_p dummy;
|
||||
gimple use_stmt;
|
||||
stmt_vec_info use_stmt_info = NULL;
|
||||
if (single_imm_use (lhs, &dummy, &use_stmt)
|
||||
&& (use_stmt_info = vinfo_for_stmt (use_stmt))
|
||||
&& STMT_VINFO_DEF_TYPE (use_stmt_info) == vect_reduction_def)
|
||||
return true;
|
||||
}
|
||||
c1 = VEC_WIDEN_MULT_LO_EXPR;
|
||||
c2 = VEC_WIDEN_MULT_HI_EXPR;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user