[Bug middle-end/49478] ice in expand_widen_pattern_expr with -O3

2011-06-21 Thread irar at il dot ibm.com
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))


[Bug middle-end/49478] ice in expand_widen_pattern_expr with -O3

2011-06-21 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49478

--- Comment #3 from Richard Guenther rguenth at gcc dot gnu.org 2011-06-21 
09:39:47 UTC ---
(In reply to comment #2)
 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;
 +}
 +}

Please instead simply do

   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] = fold_convert (TREE_TYPE (ops[1]), ops[0]);
   else if (TREE_CODE (ops[1]) == INTEEGER_CST)
 ops[1] = fold_convert (TREE_TYPE (ops[0]), ops[1]);
 +  else
 +{
 +  if (vect_print_dump_info (REPORT_DETAILS))
 +fprintf (vect_dump, invalid types in dot-prod);
 +
 +  return false;
   }
 }

Thanks.

 +
if (!vec_stmt) /* transformation not required.  */
  {
if (!vect_model_reduction_cost (stmt_info, epilog_reduc_code, ncopies))


[Bug middle-end/49478] ice in expand_widen_pattern_expr with -O3

2011-06-21 Thread irar at il dot ibm.com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49478

--- Comment #4 from Ira Rosen irar at il dot ibm.com 2011-06-21 10:03:05 UTC 
---
OK.
Thanks,
Ira


[Bug middle-end/49478] ice in expand_widen_pattern_expr with -O3

2011-06-20 Thread hjl.tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49478

H.J. Lu hjl.tools at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2011.06.21 00:31:48
 CC||irar at gcc dot gnu.org
   Target Milestone|--- |4.7.0
 Ever Confirmed|0   |1

--- Comment #1 from H.J. Lu hjl.tools at gmail dot com 2011-06-21 00:31:48 
UTC ---
It is caused by revision 174735:

http://gcc.gnu.org/ml/gcc-cvs/2011-06/msg00223.html