re PR tree-optimization/60960 (Wrong result when a vector variable is divided by a literal constant)

PR tree-optimization/60960
	* tree-vect-generic.c (expand_vector_operation): Only call
	expand_vector_divmod if type's mode satisfies VECTOR_MODE_P.

	* gcc.c-torture/execute/pr60960.c: New test.

From-SVN: r209802
This commit is contained in:
Jakub Jelinek 2014-04-25 15:52:52 +02:00 committed by Jakub Jelinek
parent ce2acd31d8
commit 2b33282907
4 changed files with 51 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2014-04-25 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/60960
* tree-vect-generic.c (expand_vector_operation): Only call
expand_vector_divmod if type's mode satisfies VECTOR_MODE_P.
2014-04-25 Tom de Vries <tom@codesourcery.com>
* expr.c (clobber_reg_mode): New function.

View File

@ -1,3 +1,8 @@
2014-04-25 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/60960
* gcc.c-torture/execute/pr60960.c: New test.
2014-04-25 Marek Polacek <polacek@redhat.com>
* gcc.dg/pr18079-2.c: Fix quoting in dg-warning.

View File

@ -0,0 +1,38 @@
/* PR tree-optimization/60960 */
typedef unsigned char v4qi __attribute__ ((vector_size (4)));
__attribute__((noinline, noclone)) v4qi
f1 (v4qi v)
{
return v / 2;
}
__attribute__((noinline, noclone)) v4qi
f2 (v4qi v)
{
return v / (v4qi) { 2, 2, 2, 2 };
}
__attribute__((noinline, noclone)) v4qi
f3 (v4qi x, v4qi y)
{
return x / y;
}
int
main ()
{
v4qi x = { 5, 5, 5, 5 };
v4qi y = { 2, 2, 2, 2 };
v4qi z = f1 (x);
if (__builtin_memcmp (&y, &z, sizeof (y)) != 0)
__builtin_abort ();
z = f2 (x);
if (__builtin_memcmp (&y, &z, sizeof (y)) != 0)
__builtin_abort ();
z = f3 (x, y);
if (__builtin_memcmp (&y, &z, sizeof (y)) != 0)
__builtin_abort ();
return 0;
}

View File

@ -971,7 +971,8 @@ expand_vector_operation (gimple_stmt_iterator *gsi, tree type, tree compute_type
if (!optimize
|| !VECTOR_INTEGER_TYPE_P (type)
|| TREE_CODE (rhs2) != VECTOR_CST)
|| TREE_CODE (rhs2) != VECTOR_CST
|| !VECTOR_MODE_P (TYPE_MODE (type)))
break;
ret = expand_vector_divmod (gsi, type, rhs1, rhs2, code);