re PR tree-optimization/70509 (wrong code with extract from a v64qi)

PR tree-optimization/70509
	* tree-ssa-forwprop.c (simplify_bitfield_ref): Use bitsize_int instead
	of the vector base type for index.

	* gcc.target/i386/avx512bw-pr70509.c: New test.

From-SVN: r234754
This commit is contained in:
Zdenek Sojka 2016-04-05 18:58:50 +02:00 committed by Jakub Jelinek
parent c0daf32d0c
commit 5e8c2eb17e
4 changed files with 39 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2016-04-05 Zdenek Sojka <zsojka@seznam.cz>
PR tree-optimization/70509
* tree-ssa-forwprop.c (simplify_bitfield_ref): Use bitsize_int instead
of the vector base type for index.
2016-04-05 Uros Bizjak <ubizjak@gmail.com>
PR target/70510

View File

@ -1,3 +1,8 @@
2016-04-05 Zdenek Sojka <zsojka@seznam.cz>
PR tree-optimization/70509
* gcc.target/i386/avx512bw-pr70509.c: New test.
2016-04-05 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/70452

View File

@ -0,0 +1,26 @@
/* PR tree-optimization/70509 */
/* { dg-do run } */
/* { dg-options "-O1 -mavx512bw" } */
/* { dg-require-effective-target avx512bw } */
#define AVX512BW
#include "avx512f-helper.h"
typedef char V __attribute__ ((vector_size (64)));
int __attribute__ ((noinline, noclone))
foo (V u, V v)
{
u /= v[0x20];
return u[0];
}
void
TEST (void)
{
int x = foo ((V) { 9 }, (V) { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3 });
if (x != 3)
abort ();
}

View File

@ -1773,7 +1773,7 @@ simplify_bitfield_ref (gimple_stmt_iterator *gsi)
if (code == VEC_PERM_EXPR)
{
tree p, m, index, tem;
tree p, m, tem;
unsigned nelts;
m = gimple_assign_rhs3 (def_stmt);
if (TREE_CODE (m) != VECTOR_CST)
@ -1790,9 +1790,8 @@ simplify_bitfield_ref (gimple_stmt_iterator *gsi)
p = gimple_assign_rhs2 (def_stmt);
idx -= nelts;
}
index = build_int_cst (TREE_TYPE (TREE_TYPE (m)), idx * size);
tem = build3 (BIT_FIELD_REF, TREE_TYPE (op),
unshare_expr (p), op1, index);
unshare_expr (p), op1, bitsize_int (idx * size));
gimple_assign_set_rhs1 (stmt, tem);
fold_stmt (gsi);
update_stmt (gsi_stmt (*gsi));