GCC Middle and Back End API Reference
|
tree bump_vector_ptr | ( | tree | dataref_ptr, |
gimple | ptr_incr, | ||
gimple_stmt_iterator * | gsi, | ||
gimple | stmt, | ||
tree | bump | ||
) |
Function bump_vector_ptr Increment a pointer (to a vector type) by vector-size. If requested, i.e. if PTR-INCR is given, then also connect the new increment stmt to the existing def-use update-chain of the pointer, by modifying the PTR_INCR as illustrated below: The pointer def-use update-chain before this function: DATAREF_PTR = phi (p_0, p_2) .... PTR_INCR: p_2 = DATAREF_PTR + step The pointer def-use update-chain after this function: DATAREF_PTR = phi (p_0, p_2) .... NEW_DATAREF_PTR = DATAREF_PTR + BUMP .... PTR_INCR: p_2 = NEW_DATAREF_PTR + step Input: DATAREF_PTR - ssa_name of a pointer (to vector type) that is being updated in the loop. PTR_INCR - optional. The stmt that updates the pointer in each iteration of the loop. The increment amount across iterations is expected to be vector_size. BSI - location where the new update stmt is to be placed. STMT - the original scalar memory-access stmt that is being vectorized. BUMP - optional. The offset by which to bump the pointer. If not given, the offset is assumed to be vector_size. Output: Return NEW_DATAREF_PTR as illustrated above.
References copy_ssa_name(), DR_PTR_INFO, duplicate_ssa_name_ptr_info(), gimple_build_assign_with_ops(), mark_ptr_info_alignment_unknown(), tree_int_cst_compare(), vect_finish_stmt_generation(), and vinfo_for_stmt().
Referenced by vectorizable_load(), and vectorizable_store().
|
static |
A helper function used in the comparator function to sort data references. T1 and T2 are two data references to be compared. The function returns -1, 0, or 1.
References iterative_hash_expr(), and tcc_declaration.
Referenced by dr_group_sort_cmp().
|
static |
Compare two data-references DRA and DRB to group them into chunks suitable for grouping.
References compare_tree(), DR_BASE_ADDRESS, dr_equal_offsets_p(), DR_INIT, DR_IS_READ, DR_OFFSET, DR_REF, DR_STEP, DR_STMT, gimple_uid(), operand_equal_p(), and tree_int_cst_compare().
Referenced by vect_analyze_data_ref_accesses().
|
static |
Given an memory reference EXP return whether its alignment is less than its size.
References get_object_alignment(), and host_integerp().
Referenced by vect_supportable_dr_alignment(), and vector_alignment_reachable_p().
|
static |
Analyze the access pattern of the data-reference DR. In case of non-consecutive accesses call vect_analyze_group_access() to analyze groups of accesses.
References compare_tree_int(), DR_IS_READ, DR_REF, DR_STEP, DR_STMT, dump_enabled_p(), dump_printf_loc(), HOST_WIDE_INT, integer_zerop(), nested_in_vect_loop_p(), data_reference::stmt, tree_int_cst_compare(), vect_analyze_group_access(), vect_location, and vinfo_for_stmt().
Referenced by vect_analyze_data_ref_accesses().
bool vect_analyze_data_ref_accesses | ( | ) |
Function vect_analyze_data_ref_accesses. Analyze the access pattern of all the data references in the loop. FORNOW: the only access pattern that is considered vectorizable is a simple step 1 (consecutive) access. FORNOW: handle only arrays and pointer accesses.
References DR_BASE_ADDRESS, dr_equal_offsets_p(), dr_group_sort_cmp(), DR_INIT, DR_IS_READ, DR_REF, DR_STEP, DR_STMT, dump_enabled_p(), dump_generic_expr(), dump_printf(), dump_printf_loc(), host_integerp(), HOST_WIDE_INT, operand_equal_p(), tree_int_cst_compare(), tree_int_cst_equal(), types_compatible_p(), vect_analyze_data_ref_access(), vect_location, and vinfo_for_stmt().
Referenced by vect_analyze_loop_2(), and vect_slp_analyze_bb_1().
|
static |
Function vect_analyze_data_ref_dependence. Return TRUE if there (might) exist a dependence between a memory-reference DRA and a memory-reference DRB. When versioning for alias may check a dependence at run-time, return FALSE. Adjust *MAX_VF according to the data dependence.
References chrec_dont_know, chrec_known, DDR_A, DDR_ARE_DEPENDENT, DDR_B, DDR_DIST_VECTS, DDR_LOOP_NEST, DDR_NUM_DIST_VECTS, DDR_REVERSED_P, DR_IS_READ, DR_IS_WRITE, DR_REF, DR_STMT, dump_enabled_p(), dump_generic_expr(), dump_printf(), dump_printf_loc(), get_earlier_stmt(), index_in_loop_nest(), loop_depth(), loop::num, loop::safelen, vect_location, vect_mark_for_runtime_alias_test(), and vinfo_for_stmt().
Referenced by vect_analyze_data_ref_dependences().
bool vect_analyze_data_ref_dependences | ( | ) |
Function vect_analyze_data_ref_dependences. Examine all the data references in the loop, and make sure there do not exist any data dependences between them. Set *MAX_VF according to the maximum vectorization factor the data dependences allow.
References compute_all_dependences(), dump_enabled_p(), dump_printf_loc(), vect_analyze_data_ref_dependence(), and vect_location.
Referenced by vect_analyze_loop_2().
bool vect_analyze_data_refs | ( | loop_vec_info | loop_vinfo, |
bb_vec_info | bb_vinfo, | ||
int * | min_vf | ||
) |
Function vect_analyze_data_refs. Find all the data references in the loop or basic block. The general structure of the analysis of data refs in the vectorizer is as follows: 1- vect_analyze_data_refs(loop/bb): call compute_data_dependences_for_loop/bb to find and analyze all data-refs in the loop/bb and their dependences. 2- vect_analyze_dependences(): apply dependence testing using ddrs. 3- vect_analyze_drs_alignment(): check that ref_stmt.alignment is ok. 4- vect_analyze_drs_access(): check that ref_stmt.step is ok.
References affine_iv::base, create_data_ref(), DR_BASE_ADDRESS, DR_INIT, DR_IS_READ, DR_OFFSET, DR_REF, DR_STEP, DR_STMT, dump_enabled_p(), dump_generic_expr(), dump_gimple_stmt(), dump_printf(), dump_printf_loc(), find_data_references_in_loop(), find_data_references_in_stmt(), find_loop_nest(), free_data_ref(), get_inner_reference(), get_vectype_for_scalar_type(), gimple_call_arg(), gimple_call_internal_fn(), gimple_call_internal_p(), gimple_clobber_p(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), highest_pow2_factor(), host_integerp(), HOST_WIDE_INT, integer_zerop(), is_gimple_call(), loop_containing_stmt(), nested_in_vect_loop_p(), offset, loop::simduid, simple_iv(), split_constant_offset(), affine_iv::step, data_reference::stmt, stmt_can_throw_internal(), targetm, tree_int_cst_equal(), unshare_expr(), vect_check_gather(), vect_location, and vinfo_for_stmt().
Referenced by vect_analyze_loop_2(), and vect_slp_analyze_bb_1().
bool vect_analyze_data_refs_alignment | ( | loop_vec_info | loop_vinfo, |
bb_vec_info | bb_vinfo | ||
) |
Function vect_analyze_data_refs_alignment Analyze the alignment of the data-references in the loop. Return FALSE if a data reference is found that cannot be vectorized.
References dump_enabled_p(), dump_printf_loc(), vect_compute_data_refs_alignment(), vect_find_same_alignment_drs(), and vect_location.
Referenced by vect_analyze_loop_2(), and vect_slp_analyze_bb_1().
|
static |
Analyze groups of accesses: check that DR belongs to a group of accesses of legal size, step, etc. Detect gaps, single element interleaving, and other special cases. Set grouped access info. Collect groups of strided stores for further use in SLP analysis.
References absu_hwi(), count, DR_INIT, DR_IS_READ, DR_IS_WRITE, DR_REF, DR_STEP, DR_STMT, dump_enabled_p(), dump_generic_expr(), dump_gimple_stmt(), dump_printf(), dump_printf_loc(), exact_log2(), HOST_WIDE_INT, loop::inner, loop::next, operand_equal_p(), data_reference::stmt, tree_int_cst_compare(), vect_location, and vinfo_for_stmt().
Referenced by vect_analyze_data_ref_access().
bool vect_can_force_dr_alignment_p | ( | ) |
Function vect_force_dr_alignment_p. Returns whether the alignment of a DECL can be forced to be aligned on ALIGNMENT bit boundary.
Referenced by increase_alignment(), and vect_compute_data_ref_alignment().
tree vect_check_gather | ( | gimple | stmt, |
loop_vec_info | loop_vinfo, | ||
tree * | basep, | ||
tree * | offp, | ||
int * | scalep | ||
) |
Check whether a non-affine read in stmt is suitable for gather load and if so, return a builtin decl for that operation.
References do_add(), double_int_to_tree(), DR_REF, expr_invariant_in_loop_p(), extract_ops_from_tree(), get_gimple_rhs_class(), get_inner_reference(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), GIMPLE_TERNARY_RHS, host_integerp(), HOST_WIDE_INT, integer_zerop(), mem_ref_offset(), targetm, tree_low_cst(), and vinfo_for_stmt().
Referenced by vect_analyze_data_refs(), vect_mark_stmts_to_be_vectorized(), and vectorizable_load().
|
static |
Function vect_compute_data_ref_alignment Compute the misalignment of the data reference DR. Output: 1. If during the misalignment computation it is found that the data reference cannot be vectorized then false is returned. 2. DR_MISALIGNMENT (DR) is defined. FOR NOW: No analysis is actually performed. Misalignment is calculated only for trivial cases. TODO.
References DR_ALIGNED_TO, DR_BASE_ADDRESS, DR_INIT, DR_REF, DR_STEP, DR_STMT, dump_enabled_p(), dump_generic_expr(), dump_printf_loc(), get_pointer_alignment(), host_integerp(), HOST_WIDE_INT, nested_in_vect_loop_p(), offset, tree_int_cst_compare(), vect_can_force_dr_alignment_p(), vect_location, and vinfo_for_stmt().
Referenced by vect_compute_data_refs_alignment().
|
static |
Function vect_compute_data_refs_alignment Compute the misalignment of data references in the loop. Return FALSE if a data reference is found that cannot be vectorized.
References DR_STMT, vect_compute_data_ref_alignment(), and vinfo_for_stmt().
Referenced by vect_analyze_data_refs_alignment().
tree vect_create_addr_base_for_vector_ref | ( | gimple | stmt, |
gimple_seq * | new_stmt_list, | ||
tree | offset, | ||
struct loop * | loop | ||
) |
Function vect_create_addr_base_for_vector_ref. Create an expression that computes the address of the first memory location that will be accessed for a data reference. Input: STMT: The statement containing the data reference. NEW_STMT_LIST: Must be initialized to NULL_TREE or a statement list. OFFSET: Optional. If supplied, it is be added to the initial address. LOOP: Specify relative to which loop-nest should the address be computed. For example, when the dataref is in an inner-loop nested in an outer-loop that is now being vectorized, LOOP can be either the outer-loop, or the inner-loop. The first memory location accessed by the following dataref ('in' points to short): for (i=0; i<N; i++) for (j=0; j<M; j++) s += in[i+j] is as follows: if LOOP=i_loop: &in (relative to i_loop) if LOOP=j_loop: &in+i*2B (relative to j_loop) Output: 1. Return an SSA_NAME whose value is the address of the memory location of the first vector of the data reference. 2. If new_stmt_list is not NULL_TREE after return then the caller must insert these statement(s) which define the returned SSA_NAME. FORNOW: We are only handling array accesses with step 1.
References build_pointer_type(), DR_BASE_ADDRESS, DR_INIT, DR_OFFSET, DR_PTR_INFO, DR_REF, dump_enabled_p(), dump_generic_expr(), dump_printf_loc(), duplicate_ssa_name_ptr_info(), force_gimple_operand(), get_name(), gimple_seq_add_seq(), mark_ptr_info_alignment_unknown(), nested_in_vect_loop_p(), unshare_expr(), vect_get_new_vect_var(), vect_location, vect_pointer_var, and vinfo_for_stmt().
Referenced by vect_create_cond_for_align_checks(), vect_create_data_ref_ptr(), vect_gen_niters_for_prolog_loop(), and vect_setup_realignment().
tree vect_create_data_ref_ptr | ( | gimple | stmt, |
tree | aggr_type, | ||
struct loop * | at_loop, | ||
tree | offset, | ||
tree * | initial_address, | ||
gimple_stmt_iterator * | gsi, | ||
gimple * | ptr_incr, | ||
bool | only_init, | ||
bool * | inv_p | ||
) |
Function vect_create_data_ref_ptr. Create a new pointer-to-AGGR_TYPE variable (ap), that points to the first location accessed in the loop by STMT, along with the def-use update chain to appropriately advance the pointer through the loop iterations. Also set aliasing information for the pointer. This pointer is used by the callers to this function to create a memory reference expression for vector load/store access. Input: 1. STMT: a stmt that references memory. Expected to be of the form GIMPLE_ASSIGN <name, data-ref> or GIMPLE_ASSIGN <data-ref, name>. 2. AGGR_TYPE: the type of the reference, which should be either a vector or an array. 3. AT_LOOP: the loop where the vector memref is to be created. 4. OFFSET (optional): an offset to be added to the initial address accessed by the data-ref in STMT. 5. BSI: location where the new stmts are to be placed if there is no loop 6. ONLY_INIT: indicate if ap is to be updated in the loop, or remain pointing to the initial address. Output: 1. Declare a new ptr to vector_type, and have it point to the base of the data reference (initial addressed accessed by the data reference). For example, for vector of type V8HI, the following code is generated: v8hi *ap; ap = (v8hi *)initial_address; if OFFSET is not supplied: initial_address = &a[init]; if OFFSET is supplied: initial_address = &a[init + OFFSET]; Return the initial_address in INITIAL_ADDRESS. 2. If ONLY_INIT is true, just return the initial pointer. Otherwise, also update the pointer in each iteration of the loop. Return the increment stmt that updates the pointer in PTR_INCR. 3. Set INV_P to true if the access pattern of the data reference in the vectorized loop is invariant. Set it to false otherwise. 4. Return the pointer.
References alias_sets_conflict_p(), build_pointer_type_for_mode(), create_iv(), DR_BASE_ADDRESS, DR_BASE_OBJECT, DR_PTR_INFO, DR_REF, DR_STEP, dump_enabled_p(), dump_generic_expr(), dump_printf(), dump_printf_loc(), duplicate_ssa_name_ptr_info(), get_alias_set(), get_name(), gimple_assign_set_lhs(), gimple_bb(), gsi_insert_before(), gsi_insert_on_edge_immediate(), gsi_insert_seq_before(), gsi_insert_seq_on_edge_immediate(), GSI_SAME_STMT, gsi_stmt(), integer_zerop(), loop_preheader_edge(), make_ssa_name(), nested_in_vect_loop_p(), new_stmt_vec_info(), ptr_mode, set_vinfo_for_stmt(), standard_iv_increment_position(), tree_code_name, tree_int_cst_sgn(), useless_type_conversion_p(), vect_create_addr_base_for_vector_ref(), vect_get_new_vect_var(), vect_location, vect_pointer_var, and vinfo_for_stmt().
Referenced by vect_setup_realignment(), vectorizable_load(), and vectorizable_store().
tree vect_create_destination_var | ( | ) |
Function vect_create_destination_var. Create a new temporary of type VECTYPE.
References free(), get_name(), type(), vect_get_new_vect_var(), vect_scalar_var, and vect_simple_var.
Referenced by get_initial_def_for_reduction(), permute_vec_elements(), read_vector_array(), vect_create_epilog_for_reduction(), vect_create_mask_and_perm(), vect_setup_realignment(), vectorizable_assignment(), vectorizable_call(), vectorizable_condition(), vectorizable_conversion(), vectorizable_load(), vectorizable_operation(), vectorizable_reduction(), and vectorizable_shift().
bool vect_enhance_data_refs_alignment | ( | ) |
Function vect_enhance_data_refs_alignment This pass will use loop versioning and loop peeling in order to enhance the alignment of data references in the loop. FOR NOW: we assume that whatever versioning/peeling takes place, only the original loop is to be vectorized. Any other loops that are created by the transformations performed in this pass - are not supposed to be vectorized. This restriction will be relaxed. This pass will require a cost model to guide it whether to apply peeling or versioning or a combination of the two. For example, the scheme that intel uses when given a loop with several memory accesses, is as follows: choose one memory access ('p') which alignment you want to force by doing peeling. Then, either (1) generate a loop in which 'p' is aligned and all other accesses are not necessarily aligned, or (2) use loop versioning to generate one loop in which all accesses are aligned, and another loop in which only 'p' is necessarily aligned. ("Automatic Intra-Register Vectorization for the Intel Architecture", Aart J.C. Bik, Milind Girkar, Paul M. Grey and Ximmin Tian, International Journal of Parallel Programming, Vol. 30, No. 2, April 2002.) Devising a cost model is the most critical aspect of this work. It will guide us on which access to peel for, whether to use loop versioning, how many versions to create, etc. The cost model will probably consist of generic considerations as well as target specific considerations (on powerpc for example, misaligned stores are more painful than misaligned loads). Here are the general steps involved in alignment enhancements: -- original loop, before alignment analysis: for (i=0; i<N; i++){ x = q[i]; # DR_MISALIGNMENT(q) = unknown p[i] = y; # DR_MISALIGNMENT(p) = unknown } -- After vect_compute_data_refs_alignment: for (i=0; i<N; i++){ x = q[i]; # DR_MISALIGNMENT(q) = 3 p[i] = y; # DR_MISALIGNMENT(p) = unknown } -- Possibility 1: we do loop versioning: if (p is aligned) { for (i=0; i<N; i++){ # loop 1A x = q[i]; # DR_MISALIGNMENT(q) = 3 p[i] = y; # DR_MISALIGNMENT(p) = 0 } } else { for (i=0; i<N; i++){ # loop 1B x = q[i]; # DR_MISALIGNMENT(q) = 3 p[i] = y; # DR_MISALIGNMENT(p) = unaligned } } -- Possibility 2: we do loop peeling: for (i = 0; i < 3; i++){ # (scalar loop, not to be vectorized). x = q[i]; p[i] = y; } for (i = 3; i < N; i++){ # loop 2A x = q[i]; # DR_MISALIGNMENT(q) = 0 p[i] = y; # DR_MISALIGNMENT(p) = unknown } -- Possibility 3: combination of loop peeling and versioning: for (i = 0; i < 3; i++){ # (scalar loop, not to be vectorized). x = q[i]; p[i] = y; } if (p is aligned) { for (i = 3; i<N; i++){ # loop 3A x = q[i]; # DR_MISALIGNMENT(q) = 0 p[i] = y; # DR_MISALIGNMENT(p) = 0 } } else { for (i = 3; i<N; i++){ # loop 3B x = q[i]; # DR_MISALIGNMENT(q) = 0 p[i] = y; # DR_MISALIGNMENT(p) = unaligned } } These loops are later passed to loop_transform to be vectorized. The vectorizer will use the alignment information to guide the transformation (whether to generate regular loads/stores, or with special handling for misalignment).
References add_stmt_cost(), aligned_access_p(), _stmt_info_for_cost::count, DR_BASE_ADDRESS, DR_IS_READ, DR_IS_WRITE, DR_REF, DR_STEP, DR_STMT, dr_unaligned_supported, dump_enabled_p(), dump_printf_loc(), flow_loop_nested_p(), loop::inner, integer_zerop(), _stmt_info_for_cost::kind, known_alignment_for_access_p(), _stmt_info_for_cost::misalign, optimize_loop_nest_for_speed_p(), outermost_invariant_loop_for_expr(), si, single_exit(), slpeel_can_duplicate_loop_p(), _stmt_info_for_cost::stmt, data_reference::stmt, _stmt_vec_info::stmt, tree_int_cst_compare(), vect_body, vect_can_advance_ivs_p(), vect_get_data_access_cost(), vect_location, vect_peeling_hash_choose_best_peeling(), vect_peeling_hash_insert(), vect_supportable_dr_alignment(), vect_update_misalignment_for_peel(), vect_verify_datarefs_alignment(), vector_alignment_reachable_p(), _stmt_vec_info::vectype, and vinfo_for_stmt().
Referenced by vect_analyze_loop_2().
|
static |
Function vect_find_same_alignment_drs. Update group and alignment relations according to the chosen vectorization factor.
References chrec_dont_know, chrec_known, DDR_A, DDR_ARE_DEPENDENT, DDR_B, DDR_DIST_VECTS, DDR_LOOP_NEST, DDR_NUM_DIST_VECTS, DR_REF, DR_STEP, DR_STMT, dump_enabled_p(), dump_generic_expr(), dump_printf(), dump_printf_loc(), index_in_loop_nest(), loop_depth(), loop::num, operand_equal_p(), vect_location, and vinfo_for_stmt().
Referenced by vect_analyze_data_refs_alignment().
|
static |
Calculate the cost of the memory access represented by DR.
References DR_IS_READ, DR_STMT, dump_enabled_p(), dump_printf_loc(), data_reference::stmt, vect_get_load_cost(), vect_get_store_cost(), vect_location, and vinfo_for_stmt().
Referenced by vect_enhance_data_refs_alignment(), and vect_peeling_hash_get_lowest_cost().
tree vect_get_new_vect_var | ( | ) |
Function vect_get_new_vect_var. Returns a name for a new variable. The current naming scheme appends the prefix "vect_" or "vect_p" (depending on the value of VAR_KIND) to the name of vectorizer generated variables, and appends that to NAME if provided.
References create_tmp_reg(), free(), vect_pointer_var, vect_scalar_var, and vect_simple_var.
Referenced by get_initial_def_for_induction(), vect_create_addr_base_for_vector_ref(), vect_create_data_ref_ptr(), vect_create_destination_var(), vect_init_vector(), vectorizable_call(), and vectorizable_load().
tree vect_get_smallest_scalar_type | ( | gimple | stmt, |
HOST_WIDE_INT * | lhs_size_unit, | ||
HOST_WIDE_INT * | rhs_size_unit | ||
) |
Return the smallest scalar part of STMT. This is used to determine the vectype of the stmt. We generally set the vectype according to the type of the result (lhs). For stmts whose result-type is different than the type of the arguments (e.g., demotion, promotion), vectype will be reset appropriately (later). Note that we have to visit the smallest datatype in this function, because that determines the VF. If the smallest datatype in the loop is present only as the rhs of a promotion operation - we'd miss it. Such a case, where a variable of this datatype does not appear in the lhs anywhere in the loop, can only occur if it's an invariant: e.g.: 'int_x = (int) short_inv', which we'd expect to have been optimized away by invariant motion. However, we cannot rely on invariant motion to always take invariants out of the loop, and so in the case of promotion we also have to check the rhs. LHS_SIZE_UNIT and RHS_SIZE_UNIT contain the sizes of the corresponding types.
References gimple_assign_cast_p(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_expr_type(), HOST_WIDE_INT, and is_gimple_assign().
Referenced by vect_build_slp_tree_1(), vect_determine_vectorization_factor(), and vect_get_slp_defs().
bool vect_grouped_load_supported | ( | ) |
Function vect_grouped_load_supported. Returns TRUE if even and odd permutations are supported, and FALSE otherwise.
References can_vec_perm_p(), dump_enabled_p(), dump_printf_loc(), exact_log2(), and vect_location.
Referenced by vectorizable_load().
bool vect_grouped_store_supported | ( | ) |
Function vect_grouped_store_supported. Returns TRUE if interleave high and interleave low permutations are supported, and FALSE otherwise.
References can_vec_perm_p(), dump_enabled_p(), dump_printf(), dump_printf_loc(), exact_log2(), and vect_location.
Referenced by vectorizable_store().
|
static |
@verbatim Data References Analysis and Manipulation Utilities for Vectorization.
Copyright (C) 2003-2013 Free Software Foundation, Inc. Contributed by Dorit Naishlos dorit and Ira Rosen @il. ibm.c omirar@ il.i bm.co m
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.
Need to include rtl.h, expr.h, etc. for optabs.
Return true if load- or store-lanes optab OPTAB is implemented for COUNT vectors of type VECTYPE. NAME is the name of OPTAB.
References convert_optab_handler(), dump_enabled_p(), dump_printf_loc(), HOST_WIDE_INT_PRINT_DEC, mode_for_size(), targetm, and vect_location.
Referenced by vect_load_lanes_supported(), and vect_store_lanes_supported().
bool vect_load_lanes_supported | ( | ) |
Return TRUE if vec_load_lanes is available for COUNT vectors of type VECTYPE.
References vect_lanes_optab_supported_p().
Referenced by vectorizable_load().
|
static |
Insert DDR into LOOP_VINFO list of ddrs that may alias and need to be tested at run-time. Return TRUE if DDR was successfully inserted. Return false if versioning is not supported.
References DDR_A, DDR_B, DR_REF, DR_STEP, dump_enabled_p(), dump_generic_expr(), dump_printf(), dump_printf_loc(), loop::inner, optimize_loop_nest_for_size_p(), and vect_location.
Referenced by vect_analyze_data_ref_dependence().
|
staticread |
Choose best peeling option by traversing peeling hash table and either choosing an option with the lowest cost (if cost model is enabled) or the option that aligns as many accesses as possible.
References _vect_peel_extended_info::body_cost_vec, _vect_peel_info::count, _vect_peel_info::dr, _vect_peel_extended_info::inside_cost, _vect_peel_info::npeel, _vect_peel_extended_info::outside_cost, _vect_peel_extended_info::peel_info, vect_peeling_hash_get_lowest_cost(), and vect_peeling_hash_get_most_frequent().
Referenced by vect_enhance_data_refs_alignment().
int vect_peeling_hash_get_lowest_cost | ( | _vect_peel_info ** | slot, |
_vect_peel_extended_info * | min | ||
) |
Traverse peeling hash table and calculate cost for each peeling option. Find the one with the lowest cost.
References _vect_peel_extended_info::body_cost_vec, _vect_peel_info::dr, DR_STMT, _vect_peel_extended_info::inside_cost, _vect_peel_info::npeel, _vect_peel_extended_info::outside_cost, _vect_peel_extended_info::peel_info, vect_get_data_access_cost(), vect_get_known_peeling_cost(), vect_get_single_scalar_iteration_cost(), vect_update_misalignment_for_peel(), and vinfo_for_stmt().
Referenced by vect_peeling_hash_choose_best_peeling().
int vect_peeling_hash_get_most_frequent | ( | _vect_peel_info ** | slot, |
_vect_peel_extended_info * | max | ||
) |
Traverse peeling hash table to find peeling option that aligns maximum number of data accesses.
References _vect_peel_info::count, _vect_peel_info::dr, _vect_peel_info::npeel, and _vect_peel_extended_info::peel_info.
Referenced by vect_peeling_hash_choose_best_peeling().
|
static |
Insert DR into peeling hash table with NPEEL as key.
References _vect_peel_info::count, _vect_peel_info::dr, _vect_peel_info::npeel, and vect_supportable_dr_alignment().
Referenced by vect_enhance_data_refs_alignment().
|
static |
Function vect_permute_load_chain. Given a chain of interleaved loads in DR_CHAIN of LENGTH that must be a power of 2, generate extract_even/odd stmts to reorder the input data correctly. Return the final references for loads in RESULT_CHAIN. E.g., LENGTH is 4 and the scalar type is short, i.e., VF is 8. The input is 4 vectors each containing 8 elements. We assign a number to each element, the input sequence is: 1st vec: 0 1 2 3 4 5 6 7 2nd vec: 8 9 10 11 12 13 14 15 3rd vec: 16 17 18 19 20 21 22 23 4th vec: 24 25 26 27 28 29 30 31 The output sequence should be: 1st vec: 0 4 8 12 16 20 24 28 2nd vec: 1 5 9 13 17 21 25 29 3rd vec: 2 6 10 14 18 22 26 30 4th vec: 3 7 11 15 19 23 27 31 i.e., the first output vector should contain the first elements of each interleaving group, etc. We use extract_even/odd instructions to create such output. The input of each extract_even/odd operation is two vectors 1st vec 2nd vec 0 1 2 3 4 5 6 7 and the output is the vector of extracted even/odd elements. The output of extract_even will be: 0 2 4 6 and of extract_odd: 1 3 5 7 The permutation is done in log LENGTH stages. In each stage extract_even and extract_odd stmts are created for each pair of vectors in DR_CHAIN in their order. In our example, E1: extract_even (1st vec, 2nd vec) E2: extract_odd (1st vec, 2nd vec) E3: extract_even (3rd vec, 4th vec) E4: extract_odd (3rd vec, 4th vec) The output for the first stage will be: E1: 0 2 4 6 8 10 12 14 E2: 1 3 5 7 9 11 13 15 E3: 16 18 20 22 24 26 28 30 E4: 17 19 21 23 25 27 29 31 In order to proceed and create the correct sequence for the next stage (or for the correct output, if the second stage is the last one, as in our example), we first put the output of extract_even operation and then the output of extract_odd in RESULT_CHAIN (which is then copied to DR_CHAIN). The input for the second stage is: 1st vec (E1): 0 2 4 6 8 10 12 14 2nd vec (E3): 16 18 20 22 24 26 28 30 3rd vec (E2): 1 3 5 7 9 11 13 15 4th vec (E4): 17 19 21 23 25 27 29 31 The output of the second stage: E1: 0 4 8 12 16 20 24 28 E2: 2 6 10 14 18 22 26 30 E3: 1 5 9 13 17 21 25 29 E4: 3 7 11 15 19 23 27 31 And RESULT_CHAIN after reordering: 1st vec (E1): 0 4 8 12 16 20 24 28 2nd vec (E3): 1 5 9 13 17 21 25 29 3rd vec (E2): 2 6 10 14 18 22 26 30 4th vec (E4): 3 7 11 15 19 23 27 31.
References exact_log2(), gimple_build_assign_with_ops(), make_temp_ssa_name(), memcpy(), vect_finish_stmt_generation(), vect_gen_perm_mask(), and vinfo_for_stmt().
Referenced by vect_transform_grouped_load().
void vect_permute_store_chain | ( | vec< tree > | dr_chain, |
unsigned int | length, | ||
gimple | stmt, | ||
gimple_stmt_iterator * | gsi, | ||
vec< tree > * | result_chain | ||
) |
Function vect_permute_store_chain. Given a chain of interleaved stores in DR_CHAIN of LENGTH that must be a power of 2, generate interleave_high/low stmts to reorder the data correctly for the stores. Return the final references for stores in RESULT_CHAIN. E.g., LENGTH is 4 and the scalar type is short, i.e., VF is 8. The input is 4 vectors each containing 8 elements. We assign a number to each element, the input sequence is: 1st vec: 0 1 2 3 4 5 6 7 2nd vec: 8 9 10 11 12 13 14 15 3rd vec: 16 17 18 19 20 21 22 23 4th vec: 24 25 26 27 28 29 30 31 The output sequence should be: 1st vec: 0 8 16 24 1 9 17 25 2nd vec: 2 10 18 26 3 11 19 27 3rd vec: 4 12 20 28 5 13 21 30 4th vec: 6 14 22 30 7 15 23 31 i.e., we interleave the contents of the four vectors in their order. We use interleave_high/low instructions to create such output. The input of each interleave_high/low operation is two vectors: 1st vec 2nd vec 0 1 2 3 4 5 6 7 the even elements of the result vector are obtained left-to-right from the high/low elements of the first vector. The odd elements of the result are obtained left-to-right from the high/low elements of the second vector. The output of interleave_high will be: 0 4 1 5 and of interleave_low: 2 6 3 7 The permutation is done in log LENGTH stages. In each stage interleave_high and interleave_low stmts are created for each pair of vectors in DR_CHAIN, where the first argument is taken from the first half of DR_CHAIN and the second argument from it's second half. In our example, I1: interleave_high (1st vec, 3rd vec) I2: interleave_low (1st vec, 3rd vec) I3: interleave_high (2nd vec, 4th vec) I4: interleave_low (2nd vec, 4th vec) The output for the first stage is: I1: 0 16 1 17 2 18 3 19 I2: 4 20 5 21 6 22 7 23 I3: 8 24 9 25 10 26 11 27 I4: 12 28 13 29 14 30 15 31 The output of the second stage, i.e. the final result is: I1: 0 8 16 24 1 9 17 25 I2: 2 10 18 26 3 11 19 27 I3: 4 12 20 28 5 13 21 30 I4: 6 14 22 30 7 15 23 31.
References exact_log2(), gimple_build_assign_with_ops(), make_temp_ssa_name(), memcpy(), vect_finish_stmt_generation(), vect_gen_perm_mask(), and vinfo_for_stmt().
Referenced by vectorizable_store().
bool vect_prune_runtime_alias_test_list | ( | ) |
Function vect_prune_runtime_alias_test_list. Prune a list of ddrs to be tested at run-time by versioning for alias. Return FALSE if resulting list of ddrs is longer then allowed by PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS, otherwise return TRUE.
References DDR_A, DDR_B, DR_REF, dump_enabled_p(), dump_generic_expr(), dump_printf(), dump_printf_loc(), vect_location, and vect_vfa_range_equal().
Referenced by vect_analyze_loop_2().
void vect_record_grouped_load_vectors | ( | ) |
RESULT_CHAIN contains the output of a group of grouped loads that were generated as part of the vectorization of STMT. Assign the statement for each vector to the associated scalar statement.
References first_stmt(), and vinfo_for_stmt().
Referenced by vect_transform_grouped_load(), and vectorizable_load().
|
static |
Check if data references pointed by DR_I and DR_J are same or belong to same interleaving group. Return FALSE if drs are different, otherwise return TRUE.
References DR_REF, DR_STMT, operand_equal_p(), and vinfo_for_stmt().
Referenced by vect_vfa_range_equal().
tree vect_setup_realignment | ( | gimple | stmt, |
gimple_stmt_iterator * | gsi, | ||
tree * | realignment_token, | ||
enum dr_alignment_support | alignment_support_scheme, | ||
tree | init_addr, | ||
struct loop ** | at_loop | ||
) |
Function vect_setup_realignment This function is called when vectorizing an unaligned load using the dr_explicit_realign[_optimized] scheme. This function generates the following code at the loop prolog: p = initial_addr; x msq_init = *(floor(p)); # prolog load realignment_token = call target_builtin; loop: x msq = phi (msq_init, ---) The stmts marked with x are generated only for the case of dr_explicit_realign_optimized. The code above sets up a new (vector) pointer, pointing to the first location accessed by STMT, and a "floor-aligned" load using that pointer. It also generates code to compute the "realignment-token" (if the relevant target hook was defined), and creates a phi-node at the loop-header bb whose arguments are the result of the prolog-load (created by this function) and the result of a load that takes place in the loop (to be created by the caller to this function). For the case of dr_explicit_realign_optimized: The caller to this function uses the phi-result (msq) to create the realignment code inside the loop, and sets up the missing phi argument, as follows: loop: msq = phi (msq_init, lsq) lsq = *(floor(p')); # load in loop result = realign_load (msq, lsq, realignment_token); For the case of dr_explicit_realign: loop: msq = *(floor(p)); # load in loop p' = p + (VS-1); lsq = *(floor(p')); # load in loop result = realign_load (msq, lsq, realignment_token); Input: STMT - (scalar) load stmt to be vectorized. This load accesses a memory location that may be unaligned. BSI - place where new code is to be inserted. ALIGNMENT_SUPPORT_SCHEME - which of the two misalignment handling schemes is used. Output: REALIGNMENT_TOKEN - the result of a call to the builtin_mask_for_load target hook, if defined. Return value - the result of the loop-header phi node.
References add_phi_arg(), build_int_cst(), copy_ssa_name(), create_phi_node(), dr_explicit_realign, dr_explicit_realign_optimized, DR_REF, gimple_assign_lhs(), gimple_assign_set_lhs(), gimple_bb(), gimple_build_assign_with_ops(), gimple_build_call(), gimple_call_lhs(), gimple_call_return_type(), gimple_call_set_lhs(), gsi_insert_before(), gsi_insert_on_edge_immediate(), gsi_insert_seq_before(), gsi_insert_seq_on_edge_immediate(), GSI_SAME_STMT, loop::header, HOST_WIDE_INT, loop::inner, loop_preheader_edge(), make_ssa_name(), nested_in_vect_loop_p(), reference_alias_ptr_type(), targetm, tree_int_cst_compare(), vect_create_addr_base_for_vector_ref(), vect_create_data_ref_ptr(), vect_create_destination_var(), and vinfo_for_stmt().
Referenced by vectorizable_load().
|
static |
Function vect_slp_analyze_data_ref_dependence. Return TRUE if there (might) exist a dependence between a memory-reference DRA and a memory-reference DRB. When versioning for alias may check a dependence at run-time, return FALSE. Adjust *MAX_VF according to the data dependence.
References chrec_dont_know, chrec_known, DDR_A, DDR_ARE_DEPENDENT, DDR_B, DR_BASE_ADDRESS, dr_equal_offsets_p(), DR_INIT, DR_IS_READ, DR_IS_WRITE, DR_REF, DR_STMT, dump_enabled_p(), dump_generic_expr(), dump_printf(), dump_printf_loc(), get_earlier_stmt(), HOST_WIDE_INT, operand_equal_p(), types_compatible_p(), vect_location, and vinfo_for_stmt().
Referenced by vect_slp_analyze_data_ref_dependences().
bool vect_slp_analyze_data_ref_dependences | ( | ) |
Function vect_analyze_data_ref_dependences. Examine all the data references in the basic-block, and make sure there do not exist any data dependences between them. Set *MAX_VF according to the maximum vectorization factor the data dependences allow.
References compute_all_dependences(), dump_enabled_p(), dump_printf_loc(), vect_location, vect_slp_analyze_data_ref_dependence(), and vNULL.
Referenced by vect_slp_analyze_bb_1().
bool vect_store_lanes_supported | ( | ) |
Return TRUE if vec_store_lanes is available for COUNT vectors of type VECTYPE.
References vect_lanes_optab_supported_p().
Referenced by vectorizable_store().
enum dr_alignment_support vect_supportable_dr_alignment | ( | struct data_reference * | dr, |
bool | check_aligned_accesses | ||
) |
Return whether the data reference DR is supported with respect to its alignment. If CHECK_ALIGNED_ACCESSES is TRUE, check if the access is supported even it is aligned, i.e., check if it is possible to vectorize it with different alignment.
References aligned_access_p(), dr_aligned, dr_explicit_realign, dr_explicit_realign_optimized, DR_IS_READ, DR_REF, DR_STEP, DR_STMT, dr_unaligned_supported, dr_unaligned_unsupported, known_alignment_for_access_p(), nested_in_vect_loop_p(), not_size_aligned(), optab_handler(), targetm, and vinfo_for_stmt().
Referenced by vect_build_slp_tree_1(), vect_enhance_data_refs_alignment(), vect_get_load_cost(), vect_get_store_cost(), vect_peeling_hash_insert(), vect_supported_load_permutation_p(), vect_verify_datarefs_alignment(), vect_vfa_segment_size(), vectorizable_load(), and vectorizable_store().
void vect_transform_grouped_load | ( | gimple | stmt, |
vec< tree > | dr_chain, | ||
int | size, | ||
gimple_stmt_iterator * | gsi | ||
) |
Function vect_transform_grouped_load. Given a chain of input interleaved data-refs (in DR_CHAIN), build statements to perform their permutation and ascribe the result vectorized statements to the scalar statements.
References vect_permute_load_chain(), vect_record_grouped_load_vectors(), and vNULL.
Referenced by vectorizable_load().
|
static |
Function vect_update_misalignment_for_peel DR - the data reference whose misalignment is to be adjusted. DR_PEEL - the data reference whose misalignment is being made zero in the vector loop by the peel. NPEEL - the number of iterations in the peel loop if the misalignment of DR_PEEL is known at compile time.
References DR_REF, DR_STEP, DR_STMT, dump_enabled_p(), dump_printf_loc(), known_alignment_for_access_p(), tree_int_cst_compare(), vect_location, and vinfo_for_stmt().
Referenced by vect_enhance_data_refs_alignment(), and vect_peeling_hash_get_lowest_cost().
bool vect_verify_datarefs_alignment | ( | ) |
Function vect_verify_datarefs_alignment Return TRUE if all data references in the loop can be handled with respect to alignment.
References dr_aligned, DR_IS_READ, DR_REF, DR_STMT, dump_enabled_p(), dump_generic_expr(), dump_printf_loc(), data_reference::stmt, vect_location, vect_supportable_dr_alignment(), and vinfo_for_stmt().
Referenced by vect_enhance_data_refs_alignment(), and vect_slp_analyze_bb_1().
|
static |
If address ranges represented by DDR_I and DDR_J are equal, return TRUE, otherwise return FALSE.
References DDR_A, DDR_B, and vect_same_range_drs().
Referenced by vect_prune_runtime_alias_test_list().
|
static |
Function vector_alignment_reachable_p Return true if vector alignment for DR is reachable by peeling a few loop iterations. Return false otherwise.
References aligned_access_p(), DR_REF, DR_STMT, dump_enabled_p(), dump_printf(), dump_printf_loc(), HOST_WIDE_INT, HOST_WIDE_INT_PRINT_DEC, int_cst_value(), known_alignment_for_access_p(), not_size_aligned(), data_reference::stmt, targetm, vect_location, and vinfo_for_stmt().
Referenced by vect_enhance_data_refs_alignment().