+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.
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 ();
}
int unsignedp;
enum machine_mode mode;
enum tree_code code = TREE_CODE (exp);
- optab this_optab;
rtx subtarget, original_target;
int ignore;
tree context;
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
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 ();
}
: (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 \
|| (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,
}
break;
+ case DOT_PROD_EXPR:
+ case REALIGN_LOAD_EXPR:
+ /* FIXME. */
+ return false;
+
default:
gcc_unreachable ();
}
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;
*off = ssize_int (0);
STRIP_NOPS (exp);
- if (automatically_generated_chrec_p (exp))
+ if (tree_is_chrec (exp))
return;
otype = TREE_TYPE (exp);
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 ();
}
{
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:
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 ();
}
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;
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;
/* 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))
{
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);