Commit 41e10689 by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/57051 (Optimization regression in 4.8.0 from 4.7.2)

	PR tree-optimization/57051
	* fold-const.c (const_binop): Handle VEC_LSHIFT_EXPR
	and VEC_RSHIFT_EXPR if shift count is a multiple of element
	bitsize.

From-SVN: r198339
parent d7ed20db
2013-04-26 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/57051
* fold-const.c (const_binop): Handle VEC_LSHIFT_EXPR
and VEC_RSHIFT_EXPR if shift count is a multiple of element
bitsize.
2013-04-26 Richard Biener <rguenther@suse.de> 2013-04-26 Richard Biener <rguenther@suse.de>
* omp-low.c (finalize_task_copyfn): Do not drop PROP_loops. * omp-low.c (finalize_task_copyfn): Do not drop PROP_loops.
......
...@@ -1380,6 +1380,31 @@ const_binop (enum tree_code code, tree arg1, tree arg2) ...@@ -1380,6 +1380,31 @@ const_binop (enum tree_code code, tree arg1, tree arg2)
int count = TYPE_VECTOR_SUBPARTS (type), i; int count = TYPE_VECTOR_SUBPARTS (type), i;
tree *elts = XALLOCAVEC (tree, count); tree *elts = XALLOCAVEC (tree, count);
if (code == VEC_LSHIFT_EXPR
|| code == VEC_RSHIFT_EXPR)
{
if (!host_integerp (arg2, 1))
return NULL_TREE;
unsigned HOST_WIDE_INT shiftc = tree_low_cst (arg2, 1);
unsigned HOST_WIDE_INT outerc = tree_low_cst (TYPE_SIZE (type), 1);
unsigned HOST_WIDE_INT innerc
= tree_low_cst (TYPE_SIZE (TREE_TYPE (type)), 1);
if (shiftc >= outerc || (shiftc % innerc) != 0)
return NULL_TREE;
int offset = shiftc / innerc;
if (code == VEC_LSHIFT_EXPR)
offset = -offset;
tree zero = build_zero_cst (TREE_TYPE (type));
for (i = 0; i < count; i++)
{
if (i + offset < 0 || i + offset >= count)
elts[i] = zero;
else
elts[i] = VECTOR_CST_ELT (arg1, i + offset);
}
}
else
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
tree elem1 = VECTOR_CST_ELT (arg1, i); tree elem1 = VECTOR_CST_ELT (arg1, i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment