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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |irar at il dot ibm.com
         AssignedTo|unassigned at gcc dot       |irar at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #4 from Ira Rosen <irar at il dot ibm.com> 2012-01-12 10:48:11 UTC 
---
This is actually the same problem as in pr 51301, and the fix of 51301 looks
incomplete: we want an over-promoted sequence to end with type demotion
operation, so we need to check that properly:

Index: tree-vect-patterns.c
===================================================================
--- tree-vect-patterns.c        (revision 182840)
+++ tree-vect-patterns.c        (working copy)
@@ -1186,13 +1186,15 @@
     {
       use_lhs = gimple_assign_lhs (use_stmt);
       use_type = TREE_TYPE (use_lhs);
-      /* Support only type promotion or signedess change.  Check that USE_TYPE
-        is not bigger than the original type.  */
+      /* Support only type demotion or signedess change.  */
       if (!INTEGRAL_TYPE_P (use_type)
-          || TYPE_PRECISION (new_type) > TYPE_PRECISION (use_type)
-         || TYPE_PRECISION (type) < TYPE_PRECISION (use_type))
+         || TYPE_PRECISION (type) <= TYPE_PRECISION (use_type))
         return NULL;

+      /* Check that NEW_TYPE is not bigger than the conversion result.  */
+      if (TYPE_PRECISION (new_type) > TYPE_PRECISION (use_type))
+       return NULL;
+
       if (TYPE_UNSIGNED (new_type) != TYPE_UNSIGNED (use_type)
           || TYPE_PRECISION (new_type) != TYPE_PRECISION (use_type))
         {

I am going to test this patch.

Reply via email to