This fixes PR52636 now that we treat all constants as constants
we need to convert them to the appropriate vector type.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2012-03-20  Richard Guenther  <rguent...@suse.de>

        PR tree-optimizer/52636
        * tree-vect-slp.c (vect_get_constant_vectors): Convert constants
        to the appropriate type.

Index: gcc/tree-vect-slp.c
===================================================================
*** gcc/tree-vect-slp.c (revision 185563)
--- gcc/tree-vect-slp.c (working copy)
*************** vect_get_constant_vectors (tree op, slp_
*** 2363,2368 ****
--- 2363,2374 ----
  
            /* Create 'vect_ = {op0,op1,...,opn}'.  */
            number_of_places_left_in_vector--;
+         if (constant_p
+             && !types_compatible_p (TREE_TYPE (vector_type), TREE_TYPE (op)))
+           {
+             op = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (vector_type), op);
+             gcc_assert (op && CONSTANT_CLASS_P (op));
+           }
          elts[number_of_places_left_in_vector] = op;
  
            if (number_of_places_left_in_vector == 0)

Reply via email to