Patchwork [committed] Fix up can_vec_perm_p call in vector division lowering (PR tree-optimization/53645)

login
register
mail settings
Submitter Jakub Jelinek
Date July 2, 2012, 6:59 a.m.
Message ID <20120702065917.GF20264@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/168501/
State New
Headers show

Comments

Jakub Jelinek - July 2, 2012, 6:59 a.m.
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  <jakub@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.


	Jakub

Patch

--- 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