Hi! As reported by Uros, the new testcase now fails with -mno-sse4. The problem is that can_vec_perm_p tests different permutation from what is actually expanded in the even/odd case (hi/lo is correct). The permutation is always done after VCE to the narrower type.
Fixed thusly, committed as obvious. 2012-07-02 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/53645 * tree-vect-generic.c (expand_vector_divmod): Use TYPE_MODE (type) instead of TYPE_MODE (wider_type) as can_vec_perm_p argument. --- gcc/tree-vect-generic.c.jj 2012-06-29 21:39:32.000000000 +0200 +++ gcc/tree-vect-generic.c 2012-07-02 08:39:08.318530872 +0200 @@ -768,7 +768,7 @@ expand_vector_divmod (gimple_stmt_iterat { for (i = 0; i < nunits; i++) sel[i] = !BYTES_BIG_ENDIAN + (i & ~1) + ((i & 1) ? nunits : 0); - if (!can_vec_perm_p (TYPE_MODE (wider_type), false, sel)) + if (!can_vec_perm_p (TYPE_MODE (type), false, sel)) decl_e = decl_o = NULL_TREE; } else Jakub