Commit e569db5f by Venkataramanan Kumar Committed by Venkataramanan Kumar

re PR tree-optimization/58135 ([x86] Missed opportunities for partial SLP)

Fix PR58135.

2016-05-23  Venkataramanan Kumar  <venkataramanan.kumar@amd.com>

	PR tree-optimization/58135
	* tree-vect-slp.c: When group size is not multiple
	of vector size, allow splitting of store group at
	vector boundary.

2016-05-23  Venkataramanan Kumar  <venkataramanan.kumar@amd.com>

	* gcc.dg/vect/bb-slp-19.c:  Remove XFAIL.
	* gcc.dg/vect/pr58135.c:  Add new.
	* gfortran.dg/pr46519-1.f: Adjust test case.

From-SVN: r236582
parent e4b71114
2016-05-23 Venkataramanan Kumar <venkataramanan.kumar@amd.com>
PR tree-optimization/58135
* tree-vect-slp.c: When group size is not multiple
of vector size, allow splitting of store group at
vector boundary.
2016-05-23 Christophe Lyon <christophe.lyon@linaro.org> 2016-05-23 Christophe Lyon <christophe.lyon@linaro.org>
* config/arm/arm_neon.h (vtst_p16, vtstq_p16): New. * config/arm/arm_neon.h (vtst_p16, vtstq_p16): New.
......
2016-05-23 Venkataramanan Kumar <venkataramanan.kumar@amd.com>
* gcc.dg/vect/bb-slp-19.c: Remove XFAIL.
* gcc.dg/vect/pr58135.c: Add new.
* gfortran.dg/pr46519-1.f: Adjust test case.
2016-05-23 Paolo Carlini <paolo.carlini@oracle.com> 2016-05-23 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53401 PR c++/53401
......
...@@ -53,5 +53,5 @@ int main (void) ...@@ -53,5 +53,5 @@ int main (void)
return 0; return 0;
} }
/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
int a[100];
void foo ()
{
a[0] = a[1] = a[2] = a[3] = a[4]= 0;
}
/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */
! { dg-do compile { target i?86-*-* x86_64-*-* } } ! { dg-do compile { target i?86-*-* x86_64-*-* } }
! { dg-options "-O3 -mavx -mvzeroupper -mtune=generic -dp" } ! { dg-options "-O3 -mavx -mvzeroupper -fno-tree-slp-vectorize -mtune=generic -dp" }
PROGRAM MG3XDEMO PROGRAM MG3XDEMO
INTEGER LM, NM, NV, NR, NIT INTEGER LM, NM, NV, NR, NIT
......
...@@ -1757,18 +1757,6 @@ vect_analyze_slp_instance (vec_info *vinfo, ...@@ -1757,18 +1757,6 @@ vect_analyze_slp_instance (vec_info *vinfo,
} }
nunits = TYPE_VECTOR_SUBPARTS (vectype); nunits = TYPE_VECTOR_SUBPARTS (vectype);
/* Calculate the unrolling factor. */
unrolling_factor = least_common_multiple (nunits, group_size) / group_size;
if (unrolling_factor != 1 && is_a <bb_vec_info> (vinfo))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unrolling required in basic"
" block SLP\n");
return false;
}
/* Create a node (a root of the SLP tree) for the packed grouped stores. */ /* Create a node (a root of the SLP tree) for the packed grouped stores. */
scalar_stmts.create (group_size); scalar_stmts.create (group_size);
next = stmt; next = stmt;
...@@ -1804,26 +1792,36 @@ vect_analyze_slp_instance (vec_info *vinfo, ...@@ -1804,26 +1792,36 @@ vect_analyze_slp_instance (vec_info *vinfo,
/* Build the tree for the SLP instance. */ /* Build the tree for the SLP instance. */
bool *matches = XALLOCAVEC (bool, group_size); bool *matches = XALLOCAVEC (bool, group_size);
unsigned npermutes = 0; unsigned npermutes = 0;
if ((node = vect_build_slp_tree (vinfo, scalar_stmts, group_size, node = vect_build_slp_tree (vinfo, scalar_stmts, group_size,
&max_nunits, &loads, matches, &npermutes, &max_nunits, &loads, matches, &npermutes,
NULL, max_tree_size)) != NULL) NULL, max_tree_size);
if (node != NULL)
{ {
/* Calculate the unrolling factor based on the smallest type. */ /* Calculate the unrolling factor based on the smallest type. */
if (max_nunits > nunits) unrolling_factor
unrolling_factor = least_common_multiple (max_nunits, group_size) = least_common_multiple (max_nunits, group_size) / group_size;
/ group_size;
if (unrolling_factor != 1
&& is_a <bb_vec_info> (vinfo))
{
if (unrolling_factor != 1 && is_a <bb_vec_info> (vinfo)) if (max_nunits > group_size)
{ {
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unrolling required in basic" "Build SLP failed: store group "
" block SLP\n"); "size not a multiple of the vector size "
"in basic block SLP\n");
vect_free_slp_tree (node); vect_free_slp_tree (node);
loads.release (); loads.release ();
return false; return false;
} }
/* Fatal mismatch. */
matches[group_size/max_nunits * max_nunits] = false;
vect_free_slp_tree (node);
loads.release ();
}
else
{
/* Create a new SLP instance. */ /* Create a new SLP instance. */
new_instance = XNEW (struct _slp_instance); new_instance = XNEW (struct _slp_instance);
SLP_INSTANCE_TREE (new_instance) = node; SLP_INSTANCE_TREE (new_instance) = node;
...@@ -1845,8 +1843,8 @@ vect_analyze_slp_instance (vec_info *vinfo, ...@@ -1845,8 +1843,8 @@ vect_analyze_slp_instance (vec_info *vinfo,
(vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (load_node)[0])); (vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (load_node)[0]));
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (load_node), j, load) FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (load_node), j, load)
{ {
int load_place int load_place = vect_get_place_in_interleaving_chain
= vect_get_place_in_interleaving_chain (load, first_stmt); (load, first_stmt);
gcc_assert (load_place != -1); gcc_assert (load_place != -1);
if (load_place != j) if (load_place != j)
this_load_permuted = true; this_load_permuted = true;
...@@ -1876,7 +1874,8 @@ vect_analyze_slp_instance (vec_info *vinfo, ...@@ -1876,7 +1874,8 @@ vect_analyze_slp_instance (vec_info *vinfo,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unsupported load " "Build SLP failed: unsupported load "
"permutation "); "permutation ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); dump_gimple_stmt (MSG_MISSED_OPTIMIZATION,
TDF_SLIM, stmt, 0);
dump_printf (MSG_MISSED_OPTIMIZATION, "\n"); dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
} }
vect_free_slp_instance (new_instance); vect_free_slp_instance (new_instance);
...@@ -1884,7 +1883,7 @@ vect_analyze_slp_instance (vec_info *vinfo, ...@@ -1884,7 +1883,7 @@ vect_analyze_slp_instance (vec_info *vinfo,
} }
} }
/* If the loads and stores can be handled with load/store-lane /* If the loads and stores can be handled with load/store-lan
instructions do not generate this SLP instance. */ instructions do not generate this SLP instance. */
if (is_a <loop_vec_info> (vinfo) if (is_a <loop_vec_info> (vinfo)
&& loads_permuted && loads_permuted
...@@ -1896,7 +1895,8 @@ vect_analyze_slp_instance (vec_info *vinfo, ...@@ -1896,7 +1895,8 @@ vect_analyze_slp_instance (vec_info *vinfo,
gimple *first_stmt = GROUP_FIRST_ELEMENT gimple *first_stmt = GROUP_FIRST_ELEMENT
(vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (load_node)[0])); (vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (load_node)[0]));
stmt_vec_info stmt_vinfo = vinfo_for_stmt (first_stmt); stmt_vec_info stmt_vinfo = vinfo_for_stmt (first_stmt);
/* Use SLP for strided accesses (or if we can't load-lanes). */ /* Use SLP for strided accesses (or if we
can't load-lanes). */
if (STMT_VINFO_STRIDED_P (stmt_vinfo) if (STMT_VINFO_STRIDED_P (stmt_vinfo)
|| ! vect_load_lanes_supported || ! vect_load_lanes_supported
(STMT_VINFO_VECTYPE (stmt_vinfo), (STMT_VINFO_VECTYPE (stmt_vinfo),
...@@ -1925,11 +1925,14 @@ vect_analyze_slp_instance (vec_info *vinfo, ...@@ -1925,11 +1925,14 @@ vect_analyze_slp_instance (vec_info *vinfo,
return true; return true;
} }
}
else
{
/* Failed to SLP. */ /* Failed to SLP. */
/* Free the allocated memory. */ /* Free the allocated memory. */
scalar_stmts.release (); scalar_stmts.release ();
loads.release (); loads.release ();
}
/* For basic block SLP, try to break the group up into multiples of the /* For basic block SLP, try to break the group up into multiples of the
vector size. */ vector size. */
......
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