+2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
+
+ * tree-vect-stmts.c (vectorizable_call): If an operand is
+ constant or external, use get_vectype_for_scalar_type
+ rather than get_same_sized_vectype to get its vector type.
+ (vectorizable_conversion, vectorizable_shift): Likewise.
+ (vectorizable_operation): Likewise.
+
2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
* tree-vectorizer.h (vec_info::vector_size): Replace with...
return false;
}
}
- /* If all arguments are external or constant defs use a vector type with
- the same size as the output vector type. */
+ /* If all arguments are external or constant defs, infer the vector type
+ from the scalar type. */
if (!vectype_in)
- vectype_in = get_same_sized_vectype (rhs_type, vectype_out);
+ vectype_in = get_vectype_for_scalar_type (vinfo, rhs_type);
if (vec_stmt)
gcc_assert (vectype_in);
if (!vectype_in)
}
}
- /* If op0 is an external or constant defs use a vector type of
- the same size as the output vector type. */
+ /* If op0 is an external or constant def, infer the vector type
+ from the scalar type. */
if (!vectype_in)
- vectype_in = get_same_sized_vectype (rhs_type, vectype_out);
+ vectype_in = get_vectype_for_scalar_type (vinfo, rhs_type);
if (vec_stmt)
gcc_assert (vectype_in);
if (!vectype_in)
"use not simple.\n");
return false;
}
- /* If op0 is an external or constant def use a vector type with
- the same size as the output vector type. */
+ /* If op0 is an external or constant def, infer the vector type
+ from the scalar type. */
if (!vectype)
- vectype = get_same_sized_vectype (TREE_TYPE (op0), vectype_out);
+ vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (op0));
if (vec_stmt)
gcc_assert (vectype);
if (!vectype)
"vector/vector shift/rotate found.\n");
if (!op1_vectype)
- op1_vectype = get_same_sized_vectype (TREE_TYPE (op1), vectype_out);
+ op1_vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (op1));
incompatible_op1_vectype_p
= (op1_vectype == NULL_TREE
|| maybe_ne (TYPE_VECTOR_SUBPARTS (op1_vectype),
"use not simple.\n");
return false;
}
- /* If op0 is an external or constant def use a vector type with
- the same size as the output vector type. */
+ /* If op0 is an external or constant def, infer the vector type
+ from the scalar type. */
if (!vectype)
{
/* For boolean type we cannot determine vectype by
vectype = vectype_out;
}
else
- vectype = get_same_sized_vectype (TREE_TYPE (op0), vectype_out);
+ vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (op0));
}
if (vec_stmt)
gcc_assert (vectype);