gimple.c (gimple_rhs_class_table): POLYNOMIAL_CHREC is not a valid RHS.
authorRichard Guenther <rguenther@suse.de>
Tue, 22 Mar 2011 11:12:57 +0000 (11:12 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 22 Mar 2011 11:12:57 +0000 (11:12 +0000)
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

gcc/ChangeLog
gcc/expr.c
gcc/gimple-pretty-print.c
gcc/gimple.c
gcc/tree-cfg.c
gcc/tree-data-ref.c
gcc/tree-vect-loop.c
gcc/tree-vect-patterns.c
gcc/tree-vect-stmts.c

index c6d5fe915b0463da05a596ec2d773bad5cf64bc2..ab8ea93caf72195b2ab0e78ba1d2d5a8bae658cb 100644 (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.
index 64ddde7a54f0dad812bfcc1ecfdb40c18b72cfdb..2c0378c12e70a87c450c7e116e7190f49a4fd036 100644 (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
index 747e8cd404f4beb648d20ec58477887d53609909..d841929fd84321dcd502beaa45913cdb3f219112 100644 (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 ();
     }
index 81607d98b24e74e03b112ac756e67a9452e8a4ee..5af3cd463a19fdd3782153f793a7f9c1f460b502 100644 (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,
 
index 1f533a33086fbcf4b2b0928c1839876d43799aa8..6fe6b90e5245a4f21d713ecc98139496424d07cd 100644 (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;
 
index 54cb46c9464db191ff719f4af02e01f6e6897180..62d024d531634f5d295c9d2d083e58cb8fb87e0d 100644 (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);
index 7692eb8bc96a419375f5cfafdc3604e916e6a8de..690d9b7401eabc309709a7aa6068209ef2ed3460 100644 (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;
 
index d4053044de9b2626f53781fd096e83c276133ff0..c241ee028d6b77bdbc4f1be1fab5cf6250cb61d4 100644 (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))
     {
index b3479252886c0b320a7a8689078be48d5f7f2bea..069a8eeeabd43d97977893ad40725a4758fd4588 100644 (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);