On Wed, 27 Nov 2019, Richard Biener wrote: > > All conversions go via standard optabs now. > > Bootstrap running on x86_64-unknown-linux-gnu.
I applied the more complete patch below. Richard. 2019-11-27 Richard Biener <rguent...@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. Index: gcc/doc/tm.texi =================================================================== --- gcc/doc/tm.texi (revision 278762) +++ gcc/doc/tm.texi (working copy) @@ -5959,18 +5959,6 @@ instruction pattern. There is no need f 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 Index: gcc/doc/tm.texi.in =================================================================== --- gcc/doc/tm.texi.in (revision 278762) +++ gcc/doc/tm.texi.in (working copy) @@ -4163,8 +4163,6 @@ address; but often a machine-dependent @hook TARGET_VECTORIZE_VEC_PERM_CONST -@hook TARGET_VECTORIZE_BUILTIN_CONVERSION - @hook TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION @hook TARGET_VECTORIZE_BUILTIN_MD_VECTORIZED_FUNCTION Index: gcc/optabs-tree.c =================================================================== --- gcc/optabs-tree.c (revision 278762) +++ gcc/optabs-tree.c (working copy) @@ -270,20 +270,16 @@ optab_for_tree_code (enum tree_code code 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; @@ -317,15 +313,6 @@ supportable_convert_operation (enum tree 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; } Index: gcc/optabs-tree.h =================================================================== --- gcc/optabs-tree.h (revision 278762) +++ gcc/optabs-tree.h (working copy) @@ -36,7 +36,7 @@ enum optab_subtype 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); Index: gcc/target.def =================================================================== --- gcc/target.def (revision 278762) +++ gcc/target.def (working copy) @@ -1797,22 +1797,6 @@ return type of the vectorized function s 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. */ Index: gcc/targhooks.c =================================================================== --- gcc/targhooks.c (revision 278762) +++ gcc/targhooks.c (working copy) @@ -688,16 +688,6 @@ default_builtin_md_vectorized_function ( 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 Index: gcc/targhooks.h =================================================================== --- gcc/targhooks.h (revision 278762) +++ gcc/targhooks.h (working copy) @@ -93,8 +93,6 @@ extern const char * default_invalid_with 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); Index: gcc/tree-ssa-forwprop.c =================================================================== --- gcc/tree-ssa-forwprop.c (revision 278762) +++ gcc/tree-ssa-forwprop.c (working copy) @@ -2150,11 +2150,9 @@ simplify_vector_constructor (gimple_stmt ? 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) { @@ -2192,10 +2190,9 @@ simplify_vector_constructor (gimple_stmt ? 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; Index: gcc/tree-vect-generic.c =================================================================== --- gcc/tree-vect-generic.c (revision 278762) +++ gcc/tree-vect-generic.c (working copy) @@ -1697,7 +1697,6 @@ expand_vector_conversion (gimple_stmt_it 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); @@ -1724,16 +1723,9 @@ expand_vector_conversion (gimple_stmt_it 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; } @@ -1752,11 +1744,11 @@ expand_vector_conversion (gimple_stmt_it 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; Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c (revision 278762) +++ gcc/tree-vect-stmts.c (working copy) @@ -4482,7 +4482,6 @@ vectorizable_simd_clone_call (stmt_vec_i 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) @@ -4491,26 +4490,12 @@ vect_gen_widened_results_half (enum tree 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; @@ -4636,8 +4621,7 @@ vect_create_vectorized_promotion_stmts ( 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; @@ -4653,10 +4637,10 @@ vect_create_vectorized_promotion_stmts ( 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)) @@ -4697,7 +4681,6 @@ vectorizable_conversion (stmt_vec_info s 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; @@ -4868,8 +4851,7 @@ vectorizable_conversion (stmt_vec_info s && 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: @@ -4909,7 +4891,7 @@ vectorizable_conversion (stmt_vec_info s 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, @@ -4960,7 +4942,7 @@ vectorizable_conversion (stmt_vec_info s 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, @@ -5079,24 +5061,12 @@ vectorizable_conversion (stmt_vec_info s { 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); @@ -5188,8 +5158,7 @@ vectorizable_conversion (stmt_vec_info s 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) @@ -5197,25 +5166,12 @@ vectorizable_conversion (stmt_vec_info s 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); @@ -5258,22 +5214,11 @@ vectorizable_conversion (stmt_vec_info s 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; }