aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIra Rosen <irar@il.ibm.com>2007-09-12 05:09:17 +0000
committerIra Rosen <irar@gcc.gnu.org>2007-09-12 05:09:17 +0000
commitf8f8fee8a29c116bf8fe29a93cc555b37835c8bd (patch)
treecceeec2db32edf030f4b94d2c08cf835f0377a36 /gcc
parent8d888559bbdd85403d3b8d2a2885d75aacc8b8af (diff)
downloadgcc-f8f8fee8a29c116bf8fe29a93cc555b37835c8bd.zip
gcc-f8f8fee8a29c116bf8fe29a93cc555b37835c8bd.tar.gz
gcc-f8f8fee8a29c116bf8fe29a93cc555b37835c8bd.tar.bz2
tree-vect-transform.c (vect_get_slp_defs): Don't build a vector for oprnd1 if not required.
* tree-vect-transform.c (vect_get_slp_defs): Don't build a vector for oprnd1 if not required. (vectorizable_operation): Use scalar operand in SLP in case of shift with scalar argument. From-SVN: r128412
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/tree-vect-transform.c22
2 files changed, 19 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2a045d1..6d8433d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2007-09-12 Ira Rosen <irar@il.ibm.com>
+ * tree-vect-transform.c (vect_get_slp_defs): Don't build a vector
+ for oprnd1 if not required.
+ (vectorizable_operation): Use scalar operand in SLP in case of
+ shift with scalar argument.
+
+2007-09-12 Ira Rosen <irar@il.ibm.com>
+
* params.def (PARAM_MIN_VECT_LOOP_BOUND): Change default and minimum
to 1.
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index e2ee92b..5331fcd 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -1392,7 +1392,9 @@ vect_get_slp_vect_defs (slp_tree slp_node, VEC (tree,heap) **vec_oprnds)
call vect_get_constant_vectors() to create vector stmts.
Otherwise, the def-stmts must be already vectorized and the vectorized stmts
must be stored in the LEFT/RIGHT node of SLP_NODE, and we call
- vect_get_slp_vect_defs() to retrieve them. */
+ vect_get_slp_vect_defs() to retrieve them.
+ If VEC_OPRNDS1 is NULL, don't get vector defs for the second operand (from
+ the right node. This is used when the second operand must remain scalar. */
static void
vect_get_slp_defs (slp_tree slp_node, VEC (tree,heap) **vec_oprnds0,
@@ -1420,7 +1422,7 @@ vect_get_slp_defs (slp_tree slp_node, VEC (tree,heap) **vec_oprnds0,
return;
operation = GIMPLE_STMT_OPERAND (first_stmt, 1);
- if (TREE_OPERAND_LENGTH (operation) == unary_op)
+ if (TREE_OPERAND_LENGTH (operation) == unary_op || !vec_oprnds1)
return;
*vec_oprnds1 = VEC_alloc (tree, heap,
@@ -3891,11 +3893,9 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
vec_dest = vect_create_destination_var (scalar_dest, vectype);
if (!slp_node)
- {
- vec_oprnds0 = VEC_alloc (tree, heap, 1);
- if (op_type == binary_op)
- vec_oprnds1 = VEC_alloc (tree, heap, 1);
- }
+ vec_oprnds0 = VEC_alloc (tree, heap, 1);
+ if (op_type == binary_op)
+ vec_oprnds1 = VEC_alloc (tree, heap, 1);
/* In case the vectorization factor (VF) is bigger than the number
of elements that we can fit in a vectype (nunits), we have to generate
@@ -3957,8 +3957,7 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
if (j == 0)
{
if (op_type == binary_op
- && (code == LSHIFT_EXPR || code == RSHIFT_EXPR)
- && !slp_node)
+ && (code == LSHIFT_EXPR || code == RSHIFT_EXPR))
{
/* Vector shl and shr insn patterns can be defined with scalar
operand 2 (shift operand). In this case, use constant or loop
@@ -3974,11 +3973,14 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
}
}
+ /* vec_oprnd is available if operand 1 should be of a scalar-type
+ (a special case for certain kind of vector shifts); otherwise,
+ operand 1 should be of a vector type (the usual case). */
if (op_type == binary_op && !vec_oprnd1)
vect_get_vec_defs (op0, op1, stmt, &vec_oprnds0, &vec_oprnds1,
slp_node);
else
- vect_get_vec_defs (op0, NULL_TREE, stmt, &vec_oprnds0, &vec_oprnds1,
+ vect_get_vec_defs (op0, NULL_TREE, stmt, &vec_oprnds0, NULL,
slp_node);
}
else