mirror of git://gcc.gnu.org/git/gcc.git
fold-const.c (build_zero_vector): Use build_vector_from_val.
* fold-const.c (build_zero_vector): Use build_vector_from_val. * tree-vect-loop.c (get_initial_def_for_induction): Likewise. (get_initial_def_for_reduction): Likewise. * tree-vect-slp.c (vect_get_constant_vectors): Likewise. * tree-vect-stmts.c (vect_get_vec_def_for_operand): Likewise. * tree.c (build_one_cst): Likewise. (build_vector_from_val): Use types_compatible_p for assert. From-SVN: r166102
This commit is contained in:
parent
76369a821b
commit
b9acc9f1de
|
@ -1,3 +1,13 @@
|
||||||
|
2010-10-30 Nathan Froyd <froydnj@codesourcery.com>
|
||||||
|
|
||||||
|
* fold-const.c (build_zero_vector): Use build_vector_from_val.
|
||||||
|
* tree-vect-loop.c (get_initial_def_for_induction): Likewise.
|
||||||
|
(get_initial_def_for_reduction): Likewise.
|
||||||
|
* tree-vect-slp.c (vect_get_constant_vectors): Likewise.
|
||||||
|
* tree-vect-stmts.c (vect_get_vec_def_for_operand): Likewise.
|
||||||
|
* tree.c (build_one_cst): Likewise.
|
||||||
|
(build_vector_from_val): Use types_compatible_p for assert.
|
||||||
|
|
||||||
2010-10-30 Nathan Froyd <froydnj@codesourcery.com>
|
2010-10-30 Nathan Froyd <froydnj@codesourcery.com>
|
||||||
|
|
||||||
* emit-rtl.c (mark_used_flags): New function.
|
* emit-rtl.c (mark_used_flags): New function.
|
||||||
|
|
|
@ -1796,16 +1796,10 @@ fold_convert_const (enum tree_code code, tree type, tree arg1)
|
||||||
static tree
|
static tree
|
||||||
build_zero_vector (tree type)
|
build_zero_vector (tree type)
|
||||||
{
|
{
|
||||||
tree elem, list;
|
tree t;
|
||||||
int i, units;
|
|
||||||
|
|
||||||
elem = fold_convert_const (NOP_EXPR, TREE_TYPE (type), integer_zero_node);
|
t = fold_convert_const (NOP_EXPR, TREE_TYPE (type), integer_zero_node);
|
||||||
units = TYPE_VECTOR_SUBPARTS (type);
|
return build_vector_from_val (type, t);
|
||||||
|
|
||||||
list = NULL_TREE;
|
|
||||||
for (i = 0; i < units; i++)
|
|
||||||
list = tree_cons (NULL_TREE, elem, list);
|
|
||||||
return build_vector (type, list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns true, if ARG is convertible to TYPE using a NOP_EXPR. */
|
/* Returns true, if ARG is convertible to TYPE using a NOP_EXPR. */
|
||||||
|
|
|
@ -2725,13 +2725,11 @@ get_initial_def_for_induction (gimple iv_phi)
|
||||||
expr, step_expr);
|
expr, step_expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
t = NULL_TREE;
|
t = unshare_expr (new_name);
|
||||||
for (i = 0; i < nunits; i++)
|
|
||||||
t = tree_cons (NULL_TREE, unshare_expr (new_name), t);
|
|
||||||
gcc_assert (CONSTANT_CLASS_P (new_name));
|
gcc_assert (CONSTANT_CLASS_P (new_name));
|
||||||
stepvectype = get_vectype_for_scalar_type (TREE_TYPE (new_name));
|
stepvectype = get_vectype_for_scalar_type (TREE_TYPE (new_name));
|
||||||
gcc_assert (stepvectype);
|
gcc_assert (stepvectype);
|
||||||
vec = build_vector (stepvectype, t);
|
vec = build_vector_from_val (stepvectype, t);
|
||||||
vec_step = vect_init_vector (iv_phi, vec, stepvectype, NULL);
|
vec_step = vect_init_vector (iv_phi, vec, stepvectype, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
@ -2785,11 +2783,9 @@ get_initial_def_for_induction (gimple iv_phi)
|
||||||
expr = build_int_cst (TREE_TYPE (step_expr), nunits);
|
expr = build_int_cst (TREE_TYPE (step_expr), nunits);
|
||||||
new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr),
|
new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr),
|
||||||
expr, step_expr);
|
expr, step_expr);
|
||||||
t = NULL_TREE;
|
t = unshare_expr (new_name);
|
||||||
for (i = 0; i < nunits; i++)
|
|
||||||
t = tree_cons (NULL_TREE, unshare_expr (new_name), t);
|
|
||||||
gcc_assert (CONSTANT_CLASS_P (new_name));
|
gcc_assert (CONSTANT_CLASS_P (new_name));
|
||||||
vec = build_vector (stepvectype, t);
|
vec = build_vector_from_val (stepvectype, t);
|
||||||
vec_step = vect_init_vector (iv_phi, vec, stepvectype, NULL);
|
vec_step = vect_init_vector (iv_phi, vec, stepvectype, NULL);
|
||||||
|
|
||||||
vec_def = induc_def;
|
vec_def = induc_def;
|
||||||
|
@ -3021,14 +3017,7 @@ get_initial_def_for_reduction (gimple stmt, tree init_val,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = nunits - 1; i >= 0; --i)
|
init_def = build_vector_from_val (vectype, init_value);
|
||||||
t = tree_cons (NULL_TREE, init_value, t);
|
|
||||||
|
|
||||||
if (TREE_CONSTANT (init_val))
|
|
||||||
init_def = build_vector (vectype, t);
|
|
||||||
else
|
|
||||||
init_def = build_constructor_from_list (vectype, t);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1986,12 +1986,7 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
|
||||||
if (neutral_op)
|
if (neutral_op)
|
||||||
{
|
{
|
||||||
if (!neutral_vec)
|
if (!neutral_vec)
|
||||||
{
|
neutral_vec = build_vector_from_val (vector_type, neutral_op);
|
||||||
t = NULL;
|
|
||||||
for (i = 0; i < (unsigned) nunits; i++)
|
|
||||||
t = tree_cons (NULL_TREE, neutral_op, t);
|
|
||||||
neutral_vec = build_vector (vector_type, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
VEC_quick_push (tree, *vec_oprnds, neutral_vec);
|
VEC_quick_push (tree, *vec_oprnds, neutral_vec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -987,9 +987,7 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def)
|
||||||
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
|
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
|
||||||
tree vec_inv;
|
tree vec_inv;
|
||||||
tree vec_cst;
|
tree vec_cst;
|
||||||
tree t = NULL_TREE;
|
|
||||||
tree def;
|
tree def;
|
||||||
int i;
|
|
||||||
enum vect_def_type dt;
|
enum vect_def_type dt;
|
||||||
bool is_simple_use;
|
bool is_simple_use;
|
||||||
tree vector_type;
|
tree vector_type;
|
||||||
|
@ -1033,11 +1031,7 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def)
|
||||||
if (vect_print_dump_info (REPORT_DETAILS))
|
if (vect_print_dump_info (REPORT_DETAILS))
|
||||||
fprintf (vect_dump, "Create vector_cst. nunits = %d", nunits);
|
fprintf (vect_dump, "Create vector_cst. nunits = %d", nunits);
|
||||||
|
|
||||||
for (i = nunits - 1; i >= 0; --i)
|
vec_cst = build_vector_from_val (vector_type, op);
|
||||||
{
|
|
||||||
t = tree_cons (NULL_TREE, op, t);
|
|
||||||
}
|
|
||||||
vec_cst = build_vector (vector_type, t);
|
|
||||||
return vect_init_vector (stmt, vec_cst, vector_type, NULL);
|
return vect_init_vector (stmt, vec_cst, vector_type, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1055,13 +1049,7 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def)
|
||||||
if (vect_print_dump_info (REPORT_DETAILS))
|
if (vect_print_dump_info (REPORT_DETAILS))
|
||||||
fprintf (vect_dump, "Create vector_inv.");
|
fprintf (vect_dump, "Create vector_inv.");
|
||||||
|
|
||||||
for (i = nunits - 1; i >= 0; --i)
|
vec_inv = build_vector_from_val (vector_type, def);
|
||||||
{
|
|
||||||
t = tree_cons (NULL_TREE, def, t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: use build_constructor directly. */
|
|
||||||
vec_inv = build_constructor_from_list (vector_type, t);
|
|
||||||
return vect_init_vector (stmt, vec_inv, vector_type, NULL);
|
return vect_init_vector (stmt, vec_inv, vector_type, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
gcc/tree.c
15
gcc/tree.c
|
@ -1376,7 +1376,8 @@ build_vector_from_val (tree vectype, tree sc)
|
||||||
if (sc == error_mark_node)
|
if (sc == error_mark_node)
|
||||||
return sc;
|
return sc;
|
||||||
|
|
||||||
gcc_assert (TREE_TYPE (sc) == TREE_TYPE (vectype));
|
gcc_assert (lang_hooks.types_compatible_p (TREE_TYPE (sc),
|
||||||
|
TREE_TYPE (vectype)));
|
||||||
|
|
||||||
v = VEC_alloc (constructor_elt, gc, nunits);
|
v = VEC_alloc (constructor_elt, gc, nunits);
|
||||||
for (i = 0; i < nunits; ++i)
|
for (i = 0; i < nunits; ++i)
|
||||||
|
@ -1590,17 +1591,9 @@ build_one_cst (tree type)
|
||||||
|
|
||||||
case VECTOR_TYPE:
|
case VECTOR_TYPE:
|
||||||
{
|
{
|
||||||
tree scalar, cst;
|
tree scalar = build_one_cst (TREE_TYPE (type));
|
||||||
int i;
|
|
||||||
|
|
||||||
scalar = build_one_cst (TREE_TYPE (type));
|
return build_vector_from_val (type, scalar);
|
||||||
|
|
||||||
/* Create 'vect_cst_ = {cst,cst,...,cst}' */
|
|
||||||
cst = NULL_TREE;
|
|
||||||
for (i = TYPE_VECTOR_SUBPARTS (type); --i >= 0; )
|
|
||||||
cst = tree_cons (NULL_TREE, scalar, cst);
|
|
||||||
|
|
||||||
return build_vector (type, cst);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case COMPLEX_TYPE:
|
case COMPLEX_TYPE:
|
||||||
|
|
Loading…
Reference in New Issue