+2019-11-27 Richard Biener <rguenther@suse.de>
+
+ * target.def (TARGET_VECTORIZE_BUILTIN_CONVERSION): Remove.
+ * targhooks.c (default_builtin_vectorized_conversion): Likewise.
+ * targhooks.h (default_builtin_vectorized_conversion): Likewise.
+ * optabs-tree.c (supportable_convert_operation): Do not call
+ targetm.vectorize.builtin_conversion. Remove unused decl parameter.
+ * optabs-tree.h (supportable_convert_operation): Adjust.
+ * doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_CONVERSION): Remove.
+ * doc/tm.texi: Regenerate.
+ * tree-ssa-forwprop.c (simplify_vector_constructor): Adjust.
+ * tree-vect-generic.c (expand_vector_conversion): Likewise.
+ * tree-vect-stmts.c (vect_gen_widened_results_half): Remove
+ unused decl parameter and adjust.
+ (vect_create_vectorized_promotion_stmts): Likewise.
+ (vectorizable_conversion): Adjust.
+
2019-11-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/92690
implementation approaches itself.
@end deftypefn
-@deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_CONVERSION (unsigned @var{code}, tree @var{dest_type}, tree @var{src_type})
-This hook should return the DECL of a function that implements conversion of the
-input vector of type @var{src_type} to type @var{dest_type}.
-The value of @var{code} is one of the enumerators in @code{enum tree_code} and
-specifies how the conversion is to be applied
-(truncation, rounding, etc.).
-
-If this hook is defined, the autovectorizer will use the
-@code{TARGET_VECTORIZE_BUILTIN_CONVERSION} target hook when vectorizing
-conversion. Otherwise, it will return @code{NULL_TREE}.
-@end deftypefn
-
@deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION (unsigned @var{code}, tree @var{vec_type_out}, tree @var{vec_type_in})
This hook should return the decl of a function that implements the
vectorized variant of the function with the @code{combined_fn} code
@hook TARGET_VECTORIZE_VEC_PERM_CONST
-@hook TARGET_VECTORIZE_BUILTIN_CONVERSION
-
@hook TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION
@hook TARGET_VECTORIZE_BUILTIN_MD_VECTORIZED_FUNCTION
Convert operations we currently support directly are FIX_TRUNC and FLOAT.
This function checks if these operations are supported
- by the target platform either directly (via vector tree-codes), or via
- target builtins.
+ by the target platform directly (via vector tree-codes).
Output:
- CODE1 is code of vector operation to be used when
- vectorizing the operation, if available.
- - DECL is decl of target builtin functions to be used
- when vectorizing the operation, if available. In this case,
- CODE1 is CALL_EXPR. */
+ vectorizing the operation, if available. */
bool
supportable_convert_operation (enum tree_code code,
tree vectype_out, tree vectype_in,
- tree *decl, enum tree_code *code1)
+ enum tree_code *code1)
{
machine_mode m1,m2;
bool truncp;
return true;
}
- /* Now check for builtin. */
- if (targetm.vectorize.builtin_conversion
- && targetm.vectorize.builtin_conversion (code, vectype_out, vectype_in))
- {
- *code1 = CALL_EXPR;
- *decl = targetm.vectorize.builtin_conversion (code, vectype_out,
- vectype_in);
- return true;
- }
return false;
}
the second argument. The third argument distinguishes between the types of
vector shifts and rotates. */
optab optab_for_tree_code (enum tree_code, const_tree, enum optab_subtype);
-bool supportable_convert_operation (enum tree_code, tree, tree, tree *,
+bool supportable_convert_operation (enum tree_code, tree, tree,
enum tree_code *);
bool expand_vec_cmp_expr_p (tree, tree, enum tree_code);
bool expand_vec_cond_expr_p (tree, tree, enum tree_code);
tree, (tree fndecl, tree vec_type_out, tree vec_type_in),
default_builtin_md_vectorized_function)
-/* Returns a function declaration for a builtin that realizes the
- vector conversion, or NULL_TREE if not available. */
-DEFHOOK
-(builtin_conversion,
- "This hook should return the DECL of a function that implements conversion of the\n\
-input vector of type @var{src_type} to type @var{dest_type}.\n\
-The value of @var{code} is one of the enumerators in @code{enum tree_code} and\n\
-specifies how the conversion is to be applied\n\
-(truncation, rounding, etc.).\n\
-\n\
-If this hook is defined, the autovectorizer will use the\n\
-@code{TARGET_VECTORIZE_BUILTIN_CONVERSION} target hook when vectorizing\n\
-conversion. Otherwise, it will return @code{NULL_TREE}.",
- tree, (unsigned code, tree dest_type, tree src_type),
- default_builtin_vectorized_conversion)
-
/* Cost of different vector/scalar statements in vectorization cost
model. In case of misaligned vector loads and stores the cost depends
on the data type and misalignment value. */
return NULL_TREE;
}
-/* Vectorized conversion. */
-
-tree
-default_builtin_vectorized_conversion (unsigned int code ATTRIBUTE_UNUSED,
- tree dest_type ATTRIBUTE_UNUSED,
- tree src_type ATTRIBUTE_UNUSED)
-{
- return NULL_TREE;
-}
-
/* Default vectorizer cost model values. */
int
extern tree default_builtin_vectorized_function (unsigned int, tree, tree);
extern tree default_builtin_md_vectorized_function (tree, tree, tree);
-extern tree default_builtin_vectorized_conversion (unsigned int, tree, tree);
-
extern int default_builtin_vectorization_cost (enum vect_cost_for_stmt, tree, int);
extern tree default_builtin_reciprocal (tree);
? build_vector_type (TREE_TYPE (TREE_TYPE (orig[0])), nelts)
: type)
: TREE_TYPE (orig[0]));
- tree tem;
if (conv_code != ERROR_MARK
- && (!supportable_convert_operation (conv_code, type, conv_src_type,
- &tem, &conv_code)
- || conv_code == CALL_EXPR))
+ && !supportable_convert_operation (conv_code, type, conv_src_type,
+ &conv_code))
return false;
if (nelts != refnelts)
{
conv_src_type = (nelts == refnelts
? perm_type
: build_vector_type (TREE_TYPE (perm_type), nelts));
- tree tem;
if (conv_code != ERROR_MARK
&& (!supportable_convert_operation (conv_code, type, conv_src_type,
- &tem, &conv_code)
+ &conv_code)
|| conv_code == CALL_EXPR))
return false;
gimple *g;
tree lhs = gimple_call_lhs (stmt);
tree arg = gimple_call_arg (stmt, 0);
- tree decl = NULL_TREE;
tree ret_type = TREE_TYPE (lhs);
tree arg_type = TREE_TYPE (arg);
tree new_rhs, compute_type = TREE_TYPE (arg_type);
if (modifier == NONE && (code == FIX_TRUNC_EXPR || code == FLOAT_EXPR))
{
- if (supportable_convert_operation (code, ret_type, arg_type, &decl,
- &code1))
+ if (supportable_convert_operation (code, ret_type, arg_type, &code1))
{
- if (code1 == CALL_EXPR)
- {
- g = gimple_build_call (decl, 1, arg);
- gimple_call_set_lhs (g, lhs);
- }
- else
- g = gimple_build_assign (lhs, code1, arg);
+ g = gimple_build_assign (lhs, code1, arg);
gsi_replace (gsi, g, false);
return;
}
tree ret1_type = build_vector_type (TREE_TYPE (ret_type), nelts);
tree arg1_type = build_vector_type (TREE_TYPE (arg_type), nelts);
if (supportable_convert_operation (code, ret1_type, arg1_type,
- &decl, &code1))
+ &code1))
{
new_rhs = expand_vector_piecewise (gsi, do_vec_conversion,
ret_type, arg1_type, arg,
- decl, code1);
+ NULL_TREE, code1);
g = gimple_build_assign (lhs, new_rhs);
gsi_replace (gsi, g, false);
return;
static gimple *
vect_gen_widened_results_half (enum tree_code code,
- tree decl,
tree vec_oprnd0, tree vec_oprnd1, int op_type,
tree vec_dest, gimple_stmt_iterator *gsi,
stmt_vec_info stmt_info)
tree new_temp;
/* Generate half of the widened result: */
- if (code == CALL_EXPR)
- {
- /* Target specific support */
- if (op_type == binary_op)
- new_stmt = gimple_build_call (decl, 2, vec_oprnd0, vec_oprnd1);
- else
- new_stmt = gimple_build_call (decl, 1, vec_oprnd0);
- new_temp = make_ssa_name (vec_dest, new_stmt);
- gimple_call_set_lhs (new_stmt, new_temp);
- }
- else
- {
- /* Generic support */
- gcc_assert (op_type == TREE_CODE_LENGTH (code));
- if (op_type != binary_op)
- vec_oprnd1 = NULL;
- new_stmt = gimple_build_assign (vec_dest, code, vec_oprnd0, vec_oprnd1);
- new_temp = make_ssa_name (vec_dest, new_stmt);
- gimple_assign_set_lhs (new_stmt, new_temp);
- }
+ gcc_assert (op_type == TREE_CODE_LENGTH (code));
+ if (op_type != binary_op)
+ vec_oprnd1 = NULL;
+ new_stmt = gimple_build_assign (vec_dest, code, vec_oprnd0, vec_oprnd1);
+ new_temp = make_ssa_name (vec_dest, new_stmt);
+ gimple_assign_set_lhs (new_stmt, new_temp);
vect_finish_stmt_generation (stmt_info, new_stmt, gsi);
return new_stmt;
stmt_vec_info stmt_info, tree vec_dest,
gimple_stmt_iterator *gsi,
enum tree_code code1,
- enum tree_code code2, tree decl1,
- tree decl2, int op_type)
+ enum tree_code code2, int op_type)
{
int i;
tree vop0, vop1, new_tmp1, new_tmp2;
vop1 = NULL_TREE;
/* Generate the two halves of promotion operation. */
- new_stmt1 = vect_gen_widened_results_half (code1, decl1, vop0, vop1,
+ new_stmt1 = vect_gen_widened_results_half (code1, vop0, vop1,
op_type, vec_dest, gsi,
stmt_info);
- new_stmt2 = vect_gen_widened_results_half (code2, decl2, vop0, vop1,
+ new_stmt2 = vect_gen_widened_results_half (code2, vop0, vop1,
op_type, vec_dest, gsi,
stmt_info);
if (is_gimple_call (new_stmt1))
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
enum tree_code code, code1 = ERROR_MARK, code2 = ERROR_MARK;
enum tree_code codecvt1 = ERROR_MARK, codecvt2 = ERROR_MARK;
- tree decl1 = NULL_TREE, decl2 = NULL_TREE;
tree new_temp;
enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type};
int ndts = 2;
&& code != FLOAT_EXPR
&& !CONVERT_EXPR_CODE_P (code))
return false;
- if (supportable_convert_operation (code, vectype_out, vectype_in,
- &decl1, &code1))
+ if (supportable_convert_operation (code, vectype_out, vectype_in, &code1))
break;
/* FALLTHRU */
unsupported:
if (GET_MODE_SIZE (rhs_mode) == fltsz)
{
if (!supportable_convert_operation (code, vectype_out,
- cvt_type, &decl1, &codecvt1))
+ cvt_type, &codecvt1))
goto unsupported;
}
else if (!supportable_widening_operation (code, stmt_info,
if (cvt_type == NULL_TREE)
goto unsupported;
if (!supportable_convert_operation (code, cvt_type, vectype_in,
- &decl1, &codecvt1))
+ &codecvt1))
goto unsupported;
if (supportable_narrowing_operation (NOP_EXPR, vectype_out, cvt_type,
&code1, &multi_step_cvt,
{
stmt_vec_info new_stmt_info;
/* Arguments are ready, create the new vector stmt. */
- if (code1 == CALL_EXPR)
- {
- gcall *new_stmt = gimple_build_call (decl1, 1, vop0);
- new_temp = make_ssa_name (vec_dest, new_stmt);
- gimple_call_set_lhs (new_stmt, new_temp);
- new_stmt_info
- = vect_finish_stmt_generation (stmt_info, new_stmt, gsi);
- }
- else
- {
- gcc_assert (TREE_CODE_LENGTH (code1) == unary_op);
- gassign *new_stmt
- = gimple_build_assign (vec_dest, code1, vop0);
- new_temp = make_ssa_name (vec_dest, new_stmt);
- gimple_assign_set_lhs (new_stmt, new_temp);
- new_stmt_info
- = vect_finish_stmt_generation (stmt_info, new_stmt, gsi);
- }
+ gcc_assert (TREE_CODE_LENGTH (code1) == unary_op);
+ gassign *new_stmt = gimple_build_assign (vec_dest, code1, vop0);
+ new_temp = make_ssa_name (vec_dest, new_stmt);
+ gimple_assign_set_lhs (new_stmt, new_temp);
+ new_stmt_info
+ = vect_finish_stmt_generation (stmt_info, new_stmt, gsi);
if (slp_node)
SLP_TREE_VEC_STMTS (slp_node).quick_push (new_stmt_info);
vect_create_vectorized_promotion_stmts (&vec_oprnds0,
&vec_oprnds1, stmt_info,
this_dest, gsi,
- c1, c2, decl1, decl2,
- op_type);
+ c1, c2, op_type);
}
FOR_EACH_VEC_ELT (vec_oprnds0, i, vop0)
stmt_vec_info new_stmt_info;
if (cvt_type)
{
- if (codecvt1 == CALL_EXPR)
- {
- gcall *new_stmt = gimple_build_call (decl1, 1, vop0);
- new_temp = make_ssa_name (vec_dest, new_stmt);
- gimple_call_set_lhs (new_stmt, new_temp);
- new_stmt_info
- = vect_finish_stmt_generation (stmt_info, new_stmt,
- gsi);
- }
- else
- {
- gcc_assert (TREE_CODE_LENGTH (codecvt1) == unary_op);
- new_temp = make_ssa_name (vec_dest);
- gassign *new_stmt
- = gimple_build_assign (new_temp, codecvt1, vop0);
- new_stmt_info
- = vect_finish_stmt_generation (stmt_info, new_stmt,
- gsi);
- }
+ gcc_assert (TREE_CODE_LENGTH (codecvt1) == unary_op);
+ new_temp = make_ssa_name (vec_dest);
+ gassign *new_stmt
+ = gimple_build_assign (new_temp, codecvt1, vop0);
+ new_stmt_info
+ = vect_finish_stmt_generation (stmt_info, new_stmt, gsi);
}
else
new_stmt_info = vinfo->lookup_def (vop0);
if (cvt_type)
FOR_EACH_VEC_ELT (vec_oprnds0, i, vop0)
{
- if (codecvt1 == CALL_EXPR)
- {
- gcall *new_stmt = gimple_build_call (decl1, 1, vop0);
- new_temp = make_ssa_name (vec_dest, new_stmt);
- gimple_call_set_lhs (new_stmt, new_temp);
- vect_finish_stmt_generation (stmt_info, new_stmt, gsi);
- }
- else
- {
- gcc_assert (TREE_CODE_LENGTH (codecvt1) == unary_op);
- new_temp = make_ssa_name (vec_dest);
- gassign *new_stmt
- = gimple_build_assign (new_temp, codecvt1, vop0);
- vect_finish_stmt_generation (stmt_info, new_stmt, gsi);
- }
-
+ gcc_assert (TREE_CODE_LENGTH (codecvt1) == unary_op);
+ new_temp = make_ssa_name (vec_dest);
+ gassign *new_stmt
+ = gimple_build_assign (new_temp, codecvt1, vop0);
+ vect_finish_stmt_generation (stmt_info, new_stmt, gsi);
vec_oprnds0[i] = new_temp;
}