[Bug middle-end/50731] [4.7 Regression] FAIL: gcc.dg/torture/vector-shift2.c
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Oct 27 11:01:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50731
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org
|gnu.org |
--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-27 11:00:49 UTC ---
I suppose it's just completely optimized away at -O1+ and thus broken
unconditionally. Shift lowering gives us
vuchar_1 = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4 };
vchar0_2 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
vchar1_3 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
D.2720_7 = BIT_FIELD_REF <vchar1_3, 8, 0>;
D.2721_8 = D.2720_7 << 1;
D.2722_9 = BIT_FIELD_REF <vchar1_3, 8, 8>;
D.2723_10 = 1;
D.2724_11 = BIT_FIELD_REF <D.2723_10, 8, 8>;
and that last two lines already look completely bogus...
We are lowering from
vuchar_1 = { 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4 };
vchar0_2 = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
vchar1_3 = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
i1.0_4 = vchar1_3 << 1;
i1 = i1.0_4;
D.2714_5 = BIT_FIELD_REF <i1, 8, 8>;
but the generic binary lowering and do_binop do not handle a scalar
RHS separately but do
static tree
do_binop (gimple_stmt_iterator *gsi, tree inner_type, tree a, tree b,
tree bitpos, tree bitsize, enum tree_code code)
{
a = tree_vec_extract (gsi, inner_type, a, bitsize, bitpos);
b = tree_vec_extract (gsi, inner_type, b, bitsize, bitpos);
return gimplify_build2 (gsi, code, inner_type, a, b);
that of course only works for element 0.
We came here via
gcc_assert (code != VEC_LSHIFT_EXPR && code != VEC_RSHIFT_EXPR);
new_rhs = expand_vector_operation (gsi, type, compute_type, stmt, code);
(gdb) p code
$6 = LSHIFT_EXPR
Fixing it in do_binop like
static tree
do_binop (gimple_stmt_iterator *gsi, tree inner_type, tree a, tree b,
tree bitpos, tree bitsize, enum tree_code code)
{
if (TREE_CODE (TREE_TYPE (a)) == VECTOR_TYPE)
a = tree_vec_extract (gsi, inner_type, a, bitsize, bitpos);
if (TREE_CODE (TREE_TYPE (b)) == VECTOR_TYPE)
b = tree_vec_extract (gsi, inner_type, b, bitsize, bitpos);
return gimplify_build2 (gsi, code, inner_type, a, b);
is easiest.
More information about the Gcc-bugs
mailing list