gimple.c (gimple_rhs_class_table): POLYNOMIAL_CHREC is not a valid RHS.

2011-03-22  Richard Guenther  <rguenther@suse.de>

	* gimple.c (gimple_rhs_class_table): POLYNOMIAL_CHREC is not
	a valid RHS.  Make DOT_PROD_EXPR and REALIGN_LOAD_EXPR ternary.
	* tree-cfg.c (verify_gimple_assign_ternary): Allow DOT_PROD_EXPR
	and REALIGN_LOAD_EXPR.
	(verify_gimple_assign_single): Do not allow POLYNOMIAL_CHREC,
	DOT_PROD_EXPR or REALIGN_LOAD_EXPR.
	* expr.c (expand_expr_real_1): Move REALIGN_LOAD_EXPR and
	DOT_PROD_EXPR case ...
	(expand_expr_real_2): ... here.
	* gimple-pretty-print.c (dump_ternary_rhs): Handle DOT_PROD_EXPR
	and REALIGN_LOAD_EXPR.
	* tree-data-ref.c (split_constant_offset): Bail out for all CHRECs.
	* tree-vect-loop.c (vect_model_reduction_cost): Handle ternaries.
	(vect_create_epilog_for_reduction): Likewise.
	(vectorizable_reduction): Likewise.
	* tree-vect-patterns.c (vect_recog_dot_prod_pattern): Adjust.
	* tree-vect-stmts.c (vectorizable_load): Likewise.

From-SVN: r171284
This commit is contained in:
Richard Guenther 2011-03-22 11:12:57 +00:00 committed by Richard Biener
parent d1d879b1f4
commit f471fe729f
9 changed files with 101 additions and 48 deletions

View File

@ -1,3 +1,23 @@
2011-03-22 Richard Guenther <rguenther@suse.de>
* gimple.c (gimple_rhs_class_table): POLYNOMIAL_CHREC is not
a valid RHS. Make DOT_PROD_EXPR and REALIGN_LOAD_EXPR ternary.
* tree-cfg.c (verify_gimple_assign_ternary): Allow DOT_PROD_EXPR
and REALIGN_LOAD_EXPR.
(verify_gimple_assign_single): Do not allow POLYNOMIAL_CHREC,
DOT_PROD_EXPR or REALIGN_LOAD_EXPR.
* expr.c (expand_expr_real_1): Move REALIGN_LOAD_EXPR and
DOT_PROD_EXPR case ...
(expand_expr_real_2): ... here.
* gimple-pretty-print.c (dump_ternary_rhs): Handle DOT_PROD_EXPR
and REALIGN_LOAD_EXPR.
* tree-data-ref.c (split_constant_offset): Bail out for all CHRECs.
* tree-vect-loop.c (vect_model_reduction_cost): Handle ternaries.
(vect_create_epilog_for_reduction): Likewise.
(vectorizable_reduction): Likewise.
* tree-vect-patterns.c (vect_recog_dot_prod_pattern): Adjust.
* tree-vect-stmts.c (vectorizable_load): Likewise.
2011-03-22 Eric Botcazou <ebotcazou@adacore.com>
* gimplify.c (gimplify_cond_expr): Gimplify COMPOUND_EXPR conditions.

View File

@ -8259,6 +8259,36 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
mode = TYPE_MODE (TREE_TYPE (treeop0));
goto binop;
case DOT_PROD_EXPR:
{
tree oprnd0 = treeop0;
tree oprnd1 = treeop1;
tree oprnd2 = treeop2;
rtx op2;
expand_operands (oprnd0, oprnd1, NULL_RTX, &op0, &op1, EXPAND_NORMAL);
op2 = expand_normal (oprnd2);
target = expand_widen_pattern_expr (ops, op0, op1, op2,
target, unsignedp);
return target;
}
case REALIGN_LOAD_EXPR:
{
tree oprnd0 = treeop0;
tree oprnd1 = treeop1;
tree oprnd2 = treeop2;
rtx op2;
this_optab = optab_for_tree_code (code, type, optab_default);
expand_operands (oprnd0, oprnd1, NULL_RTX, &op0, &op1, EXPAND_NORMAL);
op2 = expand_normal (oprnd2);
temp = expand_ternary_op (mode, this_optab, op0, op1, op2,
target, unsignedp);
gcc_assert (temp);
return temp;
}
default:
gcc_unreachable ();
}
@ -8288,7 +8318,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
int unsignedp;
enum machine_mode mode;
enum tree_code code = TREE_CODE (exp);
optab this_optab;
rtx subtarget, original_target;
int ignore;
tree context;
@ -9697,36 +9726,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
return expand_expr_real (treeop0, original_target, tmode,
modifier, alt_rtl);
case REALIGN_LOAD_EXPR:
{
tree oprnd0 = treeop0;
tree oprnd1 = treeop1;
tree oprnd2 = treeop2;
rtx op2;
this_optab = optab_for_tree_code (code, type, optab_default);
expand_operands (oprnd0, oprnd1, NULL_RTX, &op0, &op1, EXPAND_NORMAL);
op2 = expand_normal (oprnd2);
temp = expand_ternary_op (mode, this_optab, op0, op1, op2,
target, unsignedp);
gcc_assert (temp);
return temp;
}
case DOT_PROD_EXPR:
{
tree oprnd0 = treeop0;
tree oprnd1 = treeop1;
tree oprnd2 = treeop2;
rtx op2;
expand_operands (oprnd0, oprnd1, NULL_RTX, &op0, &op1, EXPAND_NORMAL);
op2 = expand_normal (oprnd2);
target = expand_widen_pattern_expr (&ops, op0, op1, op2,
target, unsignedp);
return target;
}
case COMPOUND_LITERAL_EXPR:
{
/* Initialize the anonymous variable declared in the compound

View File

@ -408,6 +408,26 @@ dump_ternary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
break;
case DOT_PROD_EXPR:
pp_string (buffer, "DOT_PROD_EXPR <");
dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
pp_string (buffer, ">");
break;
case REALIGN_LOAD_EXPR:
pp_string (buffer, "REALIGN_LOAD <");
dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
pp_string (buffer, ", ");
dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
pp_string (buffer, ">");
break;
default:
gcc_unreachable ();
}

View File

@ -2514,6 +2514,8 @@ get_gimple_rhs_num_ops (enum tree_code code)
: (SYM) == TRUTH_NOT_EXPR ? GIMPLE_UNARY_RHS \
: ((SYM) == WIDEN_MULT_PLUS_EXPR \
|| (SYM) == WIDEN_MULT_MINUS_EXPR \
|| (SYM) == DOT_PROD_EXPR \
|| (SYM) == REALIGN_LOAD_EXPR \
|| (SYM) == FMA_EXPR) ? GIMPLE_TERNARY_RHS \
: ((SYM) == COND_EXPR \
|| (SYM) == CONSTRUCTOR \
@ -2522,10 +2524,7 @@ get_gimple_rhs_num_ops (enum tree_code code)
|| (SYM) == ADDR_EXPR \
|| (SYM) == WITH_SIZE_EXPR \
|| (SYM) == SSA_NAME \
|| (SYM) == POLYNOMIAL_CHREC \
|| (SYM) == DOT_PROD_EXPR \
|| (SYM) == VEC_COND_EXPR \
|| (SYM) == REALIGN_LOAD_EXPR) ? GIMPLE_SINGLE_RHS \
|| (SYM) == VEC_COND_EXPR) ? GIMPLE_SINGLE_RHS \
: GIMPLE_INVALID_RHS),
#define END_OF_BASE_TREE_CODES (unsigned char) GIMPLE_INVALID_RHS,

View File

@ -3669,6 +3669,11 @@ verify_gimple_assign_ternary (gimple stmt)
}
break;
case DOT_PROD_EXPR:
case REALIGN_LOAD_EXPR:
/* FIXME. */
return false;
default:
gcc_unreachable ();
}
@ -3799,10 +3804,7 @@ verify_gimple_assign_single (gimple stmt)
case OBJ_TYPE_REF:
case ASSERT_EXPR:
case WITH_SIZE_EXPR:
case POLYNOMIAL_CHREC:
case DOT_PROD_EXPR:
case VEC_COND_EXPR:
case REALIGN_LOAD_EXPR:
/* FIXME. */
return res;

View File

@ -686,7 +686,7 @@ split_constant_offset (tree exp, tree *var, tree *off)
*off = ssize_int (0);
STRIP_NOPS (exp);
if (automatically_generated_chrec_p (exp))
if (tree_is_chrec (exp))
return;
otype = TREE_TYPE (exp);

View File

@ -2498,6 +2498,9 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
case GIMPLE_BINARY_RHS:
reduction_op = gimple_assign_rhs2 (stmt);
break;
case GIMPLE_TERNARY_RHS:
reduction_op = gimple_assign_rhs3 (stmt);
break;
default:
gcc_unreachable ();
}
@ -3191,7 +3194,7 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt,
{
case GIMPLE_SINGLE_RHS:
gcc_assert (TREE_OPERAND_LENGTH (gimple_assign_rhs1 (stmt))
== ternary_op);
== ternary_op);
reduction_op = TREE_OPERAND (gimple_assign_rhs1 (stmt), reduc_index);
break;
case GIMPLE_UNARY_RHS:
@ -3201,6 +3204,9 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt,
reduction_op = reduc_index ?
gimple_assign_rhs2 (stmt) : gimple_assign_rhs1 (stmt);
break;
case GIMPLE_TERNARY_RHS:
reduction_op = gimple_op (stmt, reduc_index + 1);
break;
default:
gcc_unreachable ();
}
@ -4026,6 +4032,15 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
ops[1] = gimple_assign_rhs2 (stmt);
break;
case GIMPLE_TERNARY_RHS:
code = gimple_assign_rhs_code (stmt);
op_type = TREE_CODE_LENGTH (code);
gcc_assert (op_type == ternary_op);
ops[0] = gimple_assign_rhs1 (stmt);
ops[1] = gimple_assign_rhs2 (stmt);
ops[2] = gimple_assign_rhs3 (stmt);
break;
case GIMPLE_UNARY_RHS:
return false;

View File

@ -179,7 +179,7 @@ vect_recog_dot_prod_pattern (gimple last_stmt, tree *type_in, tree *type_out)
tree prod_type;
loop_vec_info loop_info = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
struct loop *loop = LOOP_VINFO_LOOP (loop_info);
tree var, rhs;
tree var;
if (!is_gimple_assign (last_stmt))
return NULL;
@ -311,8 +311,8 @@ vect_recog_dot_prod_pattern (gimple last_stmt, tree *type_in, tree *type_out)
/* Pattern detected. Create a stmt to be used to replace the pattern: */
var = vect_recog_temp_ssa_var (type, NULL);
rhs = build3 (DOT_PROD_EXPR, type, oprnd00, oprnd01, oprnd1),
pattern_stmt = gimple_build_assign (var, rhs);
pattern_stmt = gimple_build_assign_with_ops3 (DOT_PROD_EXPR, var,
oprnd00, oprnd01, oprnd1);
if (vect_print_dump_info (REPORT_DETAILS))
{

View File

@ -4236,15 +4236,13 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
if (alignment_support_scheme == dr_explicit_realign_optimized
|| alignment_support_scheme == dr_explicit_realign)
{
tree tmp;
lsq = gimple_assign_lhs (new_stmt);
if (!realignment_token)
realignment_token = dataref_ptr;
vec_dest = vect_create_destination_var (scalar_dest, vectype);
tmp = build3 (REALIGN_LOAD_EXPR, vectype, msq, lsq,
realignment_token);
new_stmt = gimple_build_assign (vec_dest, tmp);
new_stmt
= gimple_build_assign_with_ops3 (REALIGN_LOAD_EXPR, vec_dest,
msq, lsq, realignment_token);
new_temp = make_ssa_name (vec_dest, new_stmt);
gimple_assign_set_lhs (new_stmt, new_temp);
vect_finish_stmt_generation (stmt, new_stmt, gsi);