diff options
-rw-r--r-- | gcc/ChangeLog | 20 | ||||
-rw-r--r-- | gcc/expr.c | 61 | ||||
-rw-r--r-- | gcc/gimple-pretty-print.c | 20 | ||||
-rw-r--r-- | gcc/gimple.c | 7 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 8 | ||||
-rw-r--r-- | gcc/tree-data-ref.c | 2 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 17 | ||||
-rw-r--r-- | gcc/tree-vect-patterns.c | 6 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.c | 8 |
9 files changed, 101 insertions, 48 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c6d5fe9..ab8ea93 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. @@ -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 diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 747e8cd..d841929 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -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 (); } diff --git a/gcc/gimple.c b/gcc/gimple.c index 81607d9..5af3cd4 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -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, diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 1f533a3..6fe6b90 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -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; diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 54cb46c..62d024d 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -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); diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 7692eb8..690d9b7 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -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; diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index d405304..c241ee0 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -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)) { diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index b347925..069a8ee 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -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); |