On Fri, 17 May 2013, Jakub Jelinek wrote:
On Thu, May 16, 2013 at 07:59:00PM +0200, Mikael Pettersson wrote:
Jakub Jelinek writes:
On Thu, Apr 25, 2013 at 11:47:02PM +0200, Jakub Jelinek wrote:
This patch adds folding of constant arguments v and v, which helps
to
optimize the testcase from the PR back into constant store after
vectorized
loop is unrolled.
As this fixes a regression on the 4.8 branch, I've backported it (and
minimal prerequisite for that) to 4.8 branch too.
Unfortunately this patch makes gcc.dg/vect/no-scevccp-outer-{7,13}.c fail
on powerpc64-linux:
+FAIL: gcc.dg/vect/no-scevccp-outer-13.c execution test
+FAIL: gcc.dg/vect/no-scevccp-outer-7.c execution test
which is a regression from 4.8-20130502. Reverting r198580 fixes it.
The same FAILs also occur on trunk.
Ah right, I was confused by the fact that VEC_RSHIFT_EXPR is used
not just on little endian targets, but on big endian as well
(VEC_LSHIFT_EXPR is never emitted), but the important spot is
when extracting the scalar result from the vector:
if (BYTES_BIG_ENDIAN)
bitpos = size_binop (MULT_EXPR,
bitsize_int (TYPE_VECTOR_SUBPARTS (vectype) - 1),
TYPE_SIZE (scalar_type));
else
bitpos = bitsize_zero_node;
Fixed thusly, ok for trunk/4.8?
Ok with a comment in front of (code == VEC_RSHIFT_EXPR) ^
(!BYTES_BIG_ENDIAN)
Thanks,
Richard.
2013-05-17 Jakub Jelinek ja...@redhat.com
PR tree-optimization/57051
* fold-const.c (const_binop) case VEC_LSHIFT_EXPR,
case VEC_RSHIFT_EXPR: Fix BYTES_BIG_ENDIAN handling.
--- gcc/fold-const.c.jj 2013-05-16 12:36:28.0 +0200
+++ gcc/fold-const.c 2013-05-17 08:38:12.575117676 +0200
@@ -1393,7 +1393,7 @@ const_binop (enum tree_code code, tree a
if (shiftc = outerc || (shiftc % innerc) != 0)
return NULL_TREE;
int offset = shiftc / innerc;
- if (code == VEC_LSHIFT_EXPR)
+ if ((code == VEC_RSHIFT_EXPR) ^ (!BYTES_BIG_ENDIAN))
offset = -offset;
tree zero = build_zero_cst (TREE_TYPE (type));
for (i = 0; i count; i++)
Jakub
--
Richard Biener rguent...@suse.de
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend