diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-11-14 14:49:36 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-11-14 14:49:36 +0000 |
commit | e8738f4e9686203451fd11f05b268b8a31b95ebd (patch) | |
tree | d5dbc63cf68c0c71f9eff08aac3fe370a2ce8e1c /gcc/tree-vect-stmts.c | |
parent | 0a0ef2387cc1561d537d8d949aef9479ef17ba35 (diff) | |
download | gcc-e8738f4e9686203451fd11f05b268b8a31b95ebd.zip gcc-e8738f4e9686203451fd11f05b268b8a31b95ebd.tar.gz gcc-e8738f4e9686203451fd11f05b268b8a31b95ebd.tar.bz2 |
Remove build_{same_sized_,}truth_vector_type
build_same_sized_truth_vector_type was confusingly named, since for
SVE and AVX512 the returned vector isn't the same byte size (although
it does have the same number of elements). What it really returns
is the "truth" vector type for a given data vector type.
The more general truth_type_for provides the same thing when passed
a vector and IMO has a more descriptive name, so this patch replaces
all uses of build_same_sized_truth_vector_type with that. It does
the same for a call to build_truth_vector_type, leaving truth_type_for
itself as the only remaining caller.
It's then more natural to pass build_truth_vector_type the original
vector type rather than its size and nunits, especially since the
given size isn't the size of the returned vector. This in turn allows
a future patch to simplify the interface of get_mask_mode. Doing this
also fixes a bug in which truth_type_for would pass a size of zero for
BLKmode vector types.
2019-11-14 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree.h (build_truth_vector_type): Delete.
(build_same_sized_truth_vector_type): Likewise.
* tree.c (build_truth_vector_type): Rename to...
(build_truth_vector_type_for): ...this. Make static and take
a vector type as argument.
(truth_type_for): Update accordingly.
(build_same_sized_truth_vector_type): Delete.
* tree-vect-generic.c (expand_vector_divmod): Use truth_type_for
instead of build_same_sized_truth_vector_type.
* tree-vect-loop.c (vect_create_epilog_for_reduction): Likewise.
(vect_record_loop_mask, vect_get_loop_mask): Likewise.
* tree-vect-patterns.c (build_mask_conversion): Likeise.
* tree-vect-slp.c (vect_get_constant_vectors): Likewise.
* tree-vect-stmts.c (vect_get_vec_def_for_operand): Likewise.
(vect_build_gather_load_calls, vectorizable_call): Likewise.
(scan_store_can_perm_p, vectorizable_scan_store): Likewise.
(vectorizable_store, vectorizable_condition): Likewise.
(get_mask_type_for_scalar_type, get_same_sized_vectype): Likewise.
(vect_get_mask_type_for_stmt): Use truth_type_for instead of
build_truth_vector_type.
* config/aarch64/aarch64-sve-builtins.cc (gimple_folder::convert_pred):
Use truth_type_for instead of build_same_sized_truth_vector_type.
* config/rs6000/rs6000-call.c (fold_build_vec_cmp): Likewise.
gcc/c/
* c-typeck.c (build_conditional_expr): Use truth_type_for instead
of build_same_sized_truth_vector_type.
(build_vec_cmp): Likewise.
gcc/cp/
* call.c (build_conditional_expr_1): Use truth_type_for instead
of build_same_sized_truth_vector_type.
* typeck.c (build_vec_cmp): Likewise.
gcc/d/
* d-codegen.cc (build_boolop): Use truth_type_for instead of
build_same_sized_truth_vector_type.
From-SVN: r278232
Diffstat (limited to 'gcc/tree-vect-stmts.c')
-rw-r--r-- | gcc/tree-vect-stmts.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 9668643..19984b5 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -1605,7 +1605,7 @@ vect_get_vec_def_for_operand (tree op, stmt_vec_info stmt_vinfo, tree vectype) vector_type = vectype; else if (VECT_SCALAR_BOOLEAN_TYPE_P (TREE_TYPE (op)) && VECTOR_BOOLEAN_TYPE_P (stmt_vectype)) - vector_type = build_same_sized_truth_vector_type (stmt_vectype); + vector_type = truth_type_for (stmt_vectype); else vector_type = get_vectype_for_scalar_type (loop_vinfo, TREE_TYPE (op)); @@ -2734,7 +2734,7 @@ vect_build_gather_load_calls (stmt_vec_info stmt_info, || TREE_CODE (masktype) == INTEGER_TYPE || types_compatible_p (srctype, masktype))); if (mask && TREE_CODE (masktype) == INTEGER_TYPE) - masktype = build_same_sized_truth_vector_type (srctype); + masktype = truth_type_for (srctype); tree mask_halftype = masktype; tree perm_mask = NULL_TREE; @@ -2780,8 +2780,7 @@ vect_build_gather_load_calls (stmt_vec_info stmt_info, mask_perm_mask = vect_gen_perm_mask_checked (masktype, indices); } else if (mask) - mask_halftype - = build_same_sized_truth_vector_type (gs_info->offset_vectype); + mask_halftype = truth_type_for (gs_info->offset_vectype); } else gcc_unreachable (); @@ -3524,8 +3523,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, if (mask_opno >= 0 && !vectypes[mask_opno]) { gcc_assert (modifier != WIDEN); - vectypes[mask_opno] - = build_same_sized_truth_vector_type (vectype_in); + vectypes[mask_opno] = truth_type_for (vectype_in); } for (i = 0; i < nargs; i++) @@ -6581,7 +6579,7 @@ scan_store_can_perm_p (tree vectype, tree init, && TREE_CODE (init) != REAL_CST) || !initializer_zerop (init)) { - tree masktype = build_same_sized_truth_vector_type (vectype); + tree masktype = truth_type_for (vectype); if (!expand_vec_cond_expr_p (vectype, masktype, VECTOR_CST)) return -1; whole_vector_shift_kind = scan_store_kind_lshift_cond; @@ -7106,7 +7104,7 @@ vectorizable_scan_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, zero_vec = build_zero_cst (vectype); if (masktype == NULL_TREE && use_whole_vector[i] == scan_store_kind_lshift_cond) - masktype = build_same_sized_truth_vector_type (vectype); + masktype = truth_type_for (vectype); perms[i] = vect_gen_perm_mask_any (vectype, indices); } else @@ -7547,8 +7545,7 @@ vectorizable_store (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ncopies *= 2; if (mask) - mask_halfvectype - = build_same_sized_truth_vector_type (gs_info.offset_vectype); + mask_halfvectype = truth_type_for (gs_info.offset_vectype); } else gcc_unreachable (); @@ -9972,7 +9969,7 @@ vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, return false; masked = !COMPARISON_CLASS_P (cond_expr); - vec_cmp_type = build_same_sized_truth_vector_type (comp_vectype); + vec_cmp_type = truth_type_for (comp_vectype); if (vec_cmp_type == NULL_TREE) return false; @@ -11233,8 +11230,7 @@ get_mask_type_for_scalar_type (vec_info *vinfo, tree scalar_type) if (!vectype) return NULL; - return build_truth_vector_type (TYPE_VECTOR_SUBPARTS (vectype), - vinfo->vector_size); + return truth_type_for (vectype); } /* Function get_same_sized_vectype @@ -11246,7 +11242,7 @@ tree get_same_sized_vectype (tree scalar_type, tree vector_type) { if (VECT_SCALAR_BOOLEAN_TYPE_P (scalar_type)) - return build_same_sized_truth_vector_type (vector_type); + return truth_type_for (vector_type); return get_vectype_for_scalar_type_and_size (scalar_type, GET_MODE_SIZE (TYPE_MODE (vector_type))); @@ -12109,7 +12105,7 @@ vect_get_mask_type_for_stmt (stmt_vec_info stmt_info) && !VECTOR_BOOLEAN_TYPE_P (mask_type) && gimple_code (stmt) == GIMPLE_ASSIGN && TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)) == tcc_comparison) - mask_type = build_same_sized_truth_vector_type (mask_type); + mask_type = truth_type_for (mask_type); } /* No mask_type should mean loop invariant predicate. |