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);
+ 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);
}
tree vals = TREE_VECTOR_CST_ELTS (mask);
for (i = 0; i < elements; ++i, vals = TREE_CHAIN (vals))
- sel_int[i] = TREE_INT_CST_LOW (TREE_VALUE (vals));
+ sel_int[i] = TREE_INT_CST_LOW (TREE_VALUE (vals)) & (2 * elements - 1);
if (can_vec_perm_p (TYPE_MODE (vect_type), false, sel_int))
return;
|| code == VIEW_CONVERT_EXPR)
return;
+ /* These are only created by the vectorizer, after having queried
+ the target support. It's more than just looking at the optab,
+ and there's no need to do it again. */
+ if (code == VEC_INTERLEAVE_HIGH_EXPR
+ || code == VEC_INTERLEAVE_LOW_EXPR
+ || code == VEC_EXTRACT_EVEN_EXPR
+ || code == VEC_EXTRACT_ODD_EXPR)
+ return;
+
gcc_assert (code != CONVERT_EXPR);
/* The signedness is determined from input argument. */