re PR middle-end/52750 (32xsigned char __builtin_shuffle)

PR middle-end/52750
	* tree-vect-generic.c (vector_element): Perform multiplication
	for pos in bitsizetype type instead of idx type.

	* gcc.c-torture/compile/pr52750.c: New test.

From-SVN: r185916
This commit is contained in:
Jakub Jelinek 2012-03-28 16:46:14 +02:00 committed by Jakub Jelinek
parent ae0d9296d1
commit 4108bbe9af
4 changed files with 26 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2012-03-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/52750
* tree-vect-generic.c (vector_element): Perform multiplication
for pos in bitsizetype type instead of idx type.
2012-03-28 Georg-Johann Lay <avr@gjlay.de>
Backport from 2012-03-28 mainline r185910.

View File

@ -1,3 +1,8 @@
2012-03-28 Jakub Jelinek <jakub@redhat.com>
PR middle-end/52750
* gcc.c-torture/compile/pr52750.c: New test.
2012-03-28 Georg-Johann Lay <avr@gjlay.de>
Backport from 2012-03-28 mainline r185910.

View File

@ -0,0 +1,11 @@
/* PR middle-end/52750 */
typedef signed char V __attribute__((vector_size (32)));
void
foo (V *x)
{
V m = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
*x = __builtin_shuffle (*x, m);
}

View File

@ -1,5 +1,5 @@
/* Lower vector operations to scalar operations.
Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of GCC.
@ -583,8 +583,9 @@ vector_element (gimple_stmt_iterator *gsi, tree vect, tree idx, tree *ptmpvec)
else
{
tree size = TYPE_SIZE (vect_elt_type);
tree pos = fold_build2 (MULT_EXPR, TREE_TYPE (idx), idx, size);
return fold_build3 (BIT_FIELD_REF, vect_elt_type, vect, size, pos);
tree pos = fold_build2 (MULT_EXPR, bitsizetype, bitsize_int (index),
size);
return fold_build3 (BIT_FIELD_REF, vect_elt_type, vect, size, pos);
}
}