This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [103/nnn] poly_int: TYPE_VECTOR_SUBPARTS


On 10/23/2017 11:41 AM, Richard Sandiford wrote:
> This patch changes TYPE_VECTOR_SUBPARTS to a poly_uint64.  The value is
> encoded in the 10-bit precision field and was previously always stored
> as a simple log2 value.  The challenge was to use this 10 bits to
> encode the number of elements in variable-length vectors, so that
> we didn't need to increase the size of the tree.
> 
> In practice the number of vector elements should always have the form
> N + N * X (where X is the runtime value), and as for constant-length
> vectors, N must be a power of 2 (even though X itself might not be).
> The patch therefore uses the low bit to select between constant-length
> and variable-length and uses the upper 9 bits to encode log2(N).
> Targets without variable-length vectors continue to use the old scheme.
> 
> A new valid_vector_subparts_p function tests whether a given number
> of elements can be encoded.  This is false for the vector modes that
> represent an LD3 or ST3 vector triple (which we want to treat as arrays
> of vectors rather than single vectors).
> 
> Most of the patch is mechanical; previous patches handled the changes
> that weren't entirely straightforward.
> 
> 
> 2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/
> 	* tree.h (TYPE_VECTOR_SUBPARTS): Turn into a function and handle
> 	polynomial numbers of units.
> 	(SET_TYPE_VECTOR_SUBPARTS): Likewise.
> 	(valid_vector_subparts_p): New function.
> 	(build_vector_type): Remove temporary shim and take the number
> 	of units as a poly_uint64 rather than an int.
> 	(build_opaque_vector_type): Take the number of units as a
> 	poly_uint64 rather than an int.
> 	* tree.c (build_vector): Handle polynomial TYPE_VECTOR_SUBPARTS.
> 	(build_vector_from_ctor, type_hash_canon_hash): Likewise.
> 	(type_cache_hasher::equal, uniform_vector_p): Likewise.
> 	(vector_type_mode): Likewise.
> 	(build_vector_from_val): If the number of units isn't constant,
> 	use build_vec_duplicate_cst for constant operands and
> 	VEC_DUPLICATE_EXPR otherwise.
> 	(make_vector_type): Remove temporary is_constant ().
> 	(build_vector_type, build_opaque_vector_type): Take the number of
> 	units as a poly_uint64 rather than an int.
> 	* cfgexpand.c (expand_debug_expr): Handle polynomial
> 	TYPE_VECTOR_SUBPARTS.
> 	* expr.c (count_type_elements, store_constructor): Likewise.
> 	* fold-const.c (const_binop, const_unop, fold_convert_const)
> 	(operand_equal_p, fold_view_convert_expr, fold_vec_perm)
> 	(fold_ternary_loc, fold_relational_const): Likewise.
> 	(native_interpret_vector): Likewise.  Change the size from an
> 	int to an unsigned int.
> 	* gimple-fold.c (gimple_fold_stmt_to_constant_1): Handle polynomial
> 	TYPE_VECTOR_SUBPARTS.
> 	(gimple_fold_indirect_ref, gimple_build_vector): Likewise.
> 	(gimple_build_vector_from_val): Use VEC_DUPLICATE_EXPR when
> 	duplicating a non-constant operand into a variable-length vector.
> 	* match.pd: Handle polynomial TYPE_VECTOR_SUBPARTS.
> 	* omp-simd-clone.c (simd_clone_subparts): Likewise.
> 	* print-tree.c (print_node): Likewise.
> 	* stor-layout.c (layout_type): Likewise.
> 	* targhooks.c (default_builtin_vectorization_cost): Likewise.
> 	* tree-cfg.c (verify_gimple_comparison): Likewise.
> 	(verify_gimple_assign_binary): Likewise.
> 	(verify_gimple_assign_ternary): Likewise.
> 	(verify_gimple_assign_single): Likewise.
> 	* tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
> 	* tree-vect-data-refs.c (vect_permute_store_chain): Likewise.
> 	(vect_grouped_load_supported, vect_permute_load_chain): Likewise.
> 	(vect_shift_permute_load_chain): Likewise.
> 	* tree-vect-generic.c (nunits_for_known_piecewise_op): Likewise.
> 	(expand_vector_condition, optimize_vector_constructor): Likewise.
> 	(lower_vec_perm, get_compute_type): Likewise.
> 	* tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
> 	(get_initial_defs_for_reduction, vect_transform_loop): Likewise.
> 	* tree-vect-patterns.c (vect_recog_bool_pattern): Likewise.
> 	(vect_recog_mask_conversion_pattern): Likewise.
> 	* tree-vect-slp.c (vect_supported_load_permutation_p): Likewise.
> 	(vect_get_constant_vectors, vect_transform_slp_perm_load): Likewise.
> 	* tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
> 	(get_group_load_store_type, vectorizable_mask_load_store): Likewise.
> 	(vectorizable_bswap, simd_clone_subparts, vectorizable_assignment)
> 	(vectorizable_shift, vectorizable_operation, vectorizable_store)
> 	(vect_gen_perm_mask_any, vectorizable_load, vect_is_simple_cond)
> 	(vectorizable_comparison, supportable_widening_operation): Likewise.
> 	(supportable_narrowing_operation): Likewise.
> 
> gcc/ada/
> 	* gcc-interface/utils.c (gnat_types_compatible_p): Handle
> 	polynomial TYPE_VECTOR_SUBPARTS.
> 
> gcc/brig/
> 	* brigfrontend/brig-to-generic.cc (get_unsigned_int_type): Handle
> 	polynomial TYPE_VECTOR_SUBPARTS.
> 	* brigfrontend/brig-util.h (gccbrig_type_vector_subparts): Likewise.
> 
> gcc/c-family/
> 	* c-common.c (vector_types_convertible_p, c_build_vec_perm_expr)
> 	(convert_vector_to_array_for_subscript): Handle polynomial
> 	TYPE_VECTOR_SUBPARTS.
> 	(c_common_type_for_mode): Check valid_vector_subparts_p.
> 
> gcc/c/
> 	* c-typeck.c (comptypes_internal, build_binary_op): Handle polynomial
> 	TYPE_VECTOR_SUBPARTS.
> 
> gcc/cp/
> 	* call.c (build_conditional_expr_1): Handle polynomial
> 	TYPE_VECTOR_SUBPARTS.
> 	* constexpr.c (cxx_fold_indirect_ref): Likewise.
> 	* decl.c (cp_finish_decomp): Likewise.
> 	* mangle.c (write_type): Likewise.
> 	* typeck.c (structural_comptypes): Likewise.
> 	(cp_build_binary_op): Likewise.
> 	* typeck2.c (process_init_constructor_array): Likewise.
> 
> gcc/fortran/
> 	* trans-types.c (gfc_type_for_mode): Check valid_vector_subparts_p.
> 
> gcc/lto/
> 	* lto-lang.c (lto_type_for_mode): Check valid_vector_subparts_p.
> 	* lto.c (hash_canonical_type): Handle polynomial TYPE_VECTOR_SUBPARTS.
> 
> gcc/go/
> 	* go-lang.c (go_langhook_type_for_mode): Check valid_vector_subparts_p.
My recollection is that the encoding was going to change on this one,
but that shouldn't affect the bulk of this patch.

OK.  I'll trust you'll adjust the encoding per the discussion with Richi.

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]