http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49478

Ira Rosen <irar at il dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |irar at il dot ibm.com

--- Comment #2 from Ira Rosen <irar at il dot ibm.com> 2011-06-21 07:33:15 UTC 
---
I am testing this patch:

Index: tree-vect-loop.c
===================================================================
--- tree-vect-loop.c    (revision 175238)
+++ tree-vect-loop.c    (working copy)
@@ -4591,6 +4591,29 @@ vectorizable_reduction (gimple stmt, gim
       return false;
     }

+  /* In case of widenning multiplication by a constant, we update the type
+     of the constant to be the type of the other operand.  We check that the
+     constant fits the type in the pattern recognition pass.  */
+  if (code == DOT_PROD_EXPR
+      && !types_compatible_p (TREE_TYPE (ops[0]), TREE_TYPE (ops[1])))
+    {
+      if (TREE_CODE (ops[0]) == INTEGER_CST)
+        ops[0] = build_int_cst_wide (TREE_TYPE (ops[1]),
+                                    TREE_INT_CST_LOW (ops[0]),
+                                    TREE_INT_CST_HIGH (ops[0]));
+      else if (TREE_CODE (ops[1]) == INTEGER_CST)
+        ops[1] = build_int_cst_wide (TREE_TYPE (ops[0]),
+                                    TREE_INT_CST_LOW (ops[1]),
+                                    TREE_INT_CST_HIGH (ops[1]));
+      else
+        {
+          if (vect_print_dump_info (REPORT_DETAILS))
+            fprintf (vect_dump, "invalid types in dot-prod");
+
+          return false;
+        }
+    }
+
   if (!vec_stmt) /* transformation not required.  */
     {
       if (!vect_model_reduction_cost (stmt_info, epilog_reduc_code, ncopies))

Reply via email to