summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-stmts.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-11-14 14:45:49 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-11-14 14:45:49 +0000
commit0a0ef2387cc1561d537d8d949aef9479ef17ba35 (patch)
tree9c5d882c792520fd488d9020641474564b6e62de /gcc/tree-vect-stmts.c
parentd083ee47a9828236016841356fc7207e7c90bbbd (diff)
Add build_truth_vector_type_for_mode
Callers of vect_halve_mask_nunits and vect_double_mask_nunits already know what mode the resulting vector type should have, so we might as well create the vector type directly with that mode, just like build_vector_type_for_mode lets us build normal vectors with a known mode. This avoids the current awkwardness of having to recompute the mode starting from vec_info::vector_size, which hard-codes the assumption that all vectors have to be the same size. A later patch gets rid of build_truth_vector_type and build_same_sized_truth_vector_type, so the net effect of the series is to reduce the number of type functions by one. 2019-11-14 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree.h (build_truth_vector_type_for_mode): Declare. * tree.c (build_truth_vector_type_for_mode): New function, split out from... (build_truth_vector_type): ...here. (build_opaque_vector_type): Fix head comment. * tree-vectorizer.h (supportable_narrowing_operation): Remove vec_info parameter. (vect_halve_mask_nunits): Replace vec_info parameter with the mode of the new vector. (vect_double_mask_nunits): Likewise. * tree-vect-loop.c (vect_halve_mask_nunits): Likewise. (vect_double_mask_nunits): Likewise. * tree-vect-loop-manip.c: Include insn-config.h, rtl.h and recog.h. (vect_maybe_permute_loop_masks): Remove vinfo parameter. Update call to vect_halve_mask_nunits, getting the required mode from the unpack patterns. (vect_set_loop_condition_masked): Update call accordingly. * tree-vect-stmts.c (supportable_narrowing_operation): Remove vec_info parameter and update call to vect_double_mask_nunits. (vectorizable_conversion): Update call accordingly. (simple_integer_narrowing): Likewise. Remove vec_info parameter. (vectorizable_call): Update call accordingly. (supportable_widening_operation): Update call to vect_halve_mask_nunits. * config/aarch64/aarch64-sve-builtins.cc (register_builtin_types): Use build_truth_vector_type_mode instead of build_truth_vector_type. From-SVN: r278231
Diffstat (limited to 'gcc/tree-vect-stmts.c')
-rw-r--r--gcc/tree-vect-stmts.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 73fe573ea3e..9668643d20b 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -3153,7 +3153,7 @@ vectorizable_bswap (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
*CONVERT_CODE. */
static bool
-simple_integer_narrowing (vec_info *vinfo, tree vectype_out, tree vectype_in,
+simple_integer_narrowing (tree vectype_out, tree vectype_in,
tree_code *convert_code)
{
if (!INTEGRAL_TYPE_P (TREE_TYPE (vectype_out))
@@ -3163,9 +3163,8 @@ simple_integer_narrowing (vec_info *vinfo, tree vectype_out, tree vectype_in,
tree_code code;
int multi_step_cvt = 0;
auto_vec <tree, 8> interm_types;
- if (!supportable_narrowing_operation (vinfo, NOP_EXPR, vectype_out,
- vectype_in, &code, &multi_step_cvt,
- &interm_types)
+ if (!supportable_narrowing_operation (NOP_EXPR, vectype_out, vectype_in,
+ &code, &multi_step_cvt, &interm_types)
|| multi_step_cvt)
return false;
@@ -3347,7 +3346,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (cfn != CFN_LAST
&& (modifier == NONE
|| (modifier == NARROW
- && simple_integer_narrowing (vinfo, vectype_out, vectype_in,
+ && simple_integer_narrowing (vectype_out, vectype_in,
&convert_code))))
ifn = vectorizable_internal_function (cfn, callee, vectype_out,
vectype_in);
@@ -4931,8 +4930,8 @@ vectorizable_conversion (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
case NARROW:
gcc_assert (op_type == unary_op);
- if (supportable_narrowing_operation (vinfo, code, vectype_out,
- vectype_in, &code1, &multi_step_cvt,
+ if (supportable_narrowing_operation (code, vectype_out, vectype_in,
+ &code1, &multi_step_cvt,
&interm_types))
break;
@@ -4948,8 +4947,8 @@ vectorizable_conversion (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (!supportable_convert_operation (code, cvt_type, vectype_in,
&decl1, &codecvt1))
goto unsupported;
- if (supportable_narrowing_operation (vinfo, NOP_EXPR, vectype_out,
- cvt_type, &code1, &multi_step_cvt,
+ if (supportable_narrowing_operation (NOP_EXPR, vectype_out, cvt_type,
+ &code1, &multi_step_cvt,
&interm_types))
break;
goto unsupported;
@@ -11454,7 +11453,6 @@ supportable_widening_operation (enum tree_code code, stmt_vec_info stmt_info,
int *multi_step_cvt,
vec<tree> *interm_types)
{
- vec_info *vinfo = stmt_info->vinfo;
loop_vec_info loop_info = STMT_VINFO_LOOP_VINFO (stmt_info);
class loop *vect_loop = NULL;
machine_mode vec_mode;
@@ -11639,11 +11637,8 @@ supportable_widening_operation (enum tree_code code, stmt_vec_info stmt_info,
{
intermediate_mode = insn_data[icode1].operand[0].mode;
if (VECTOR_BOOLEAN_TYPE_P (prev_type))
- {
- intermediate_type = vect_halve_mask_nunits (vinfo, prev_type);
- if (intermediate_mode != TYPE_MODE (intermediate_type))
- return false;
- }
+ intermediate_type
+ = vect_halve_mask_nunits (prev_type, intermediate_mode);
else
intermediate_type
= lang_hooks.types.type_for_mode (intermediate_mode,
@@ -11719,7 +11714,7 @@ supportable_widening_operation (enum tree_code code, stmt_vec_info stmt_info,
narrowing operation (short in the above example). */
bool
-supportable_narrowing_operation (vec_info *vinfo, enum tree_code code,
+supportable_narrowing_operation (enum tree_code code,
tree vectype_out, tree vectype_in,
enum tree_code *code1, int *multi_step_cvt,
vec<tree> *interm_types)
@@ -11827,11 +11822,8 @@ supportable_narrowing_operation (vec_info *vinfo, enum tree_code code,
{
intermediate_mode = insn_data[icode1].operand[0].mode;
if (VECTOR_BOOLEAN_TYPE_P (prev_type))
- {
- intermediate_type = vect_double_mask_nunits (vinfo, prev_type);
- if (intermediate_mode != TYPE_MODE (intermediate_type))
- return false;
- }
+ intermediate_type
+ = vect_double_mask_nunits (prev_type, intermediate_mode);
else
intermediate_type
= lang_hooks.types.type_for_mode (intermediate_mode, uns);