GCC Middle and Back End API Reference
tree-vect-data-refs.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "predict.h"
#include "memmodel.h"
#include "tm_p.h"
#include "ssa.h"
#include "optabs-tree.h"
#include "cgraph.h"
#include "dumpfile.h"
#include "alias.h"
#include "fold-const.h"
#include "stor-layout.h"
#include "tree-eh.h"
#include "gimplify.h"
#include "gimple-iterator.h"
#include "gimplify-me.h"
#include "tree-ssa-loop-ivopts.h"
#include "tree-ssa-loop-manip.h"
#include "tree-ssa-loop.h"
#include "cfgloop.h"
#include "tree-scalar-evolution.h"
#include "tree-vectorizer.h"
#include "expr.h"
#include "builtins.h"
#include "tree-cfg.h"
#include "tree-hash-traits.h"
#include "vec-perm-indices.h"
#include "internal-fn.h"
#include "gimple-fold.h"
Include dependency graph for tree-vect-data-refs.cc:

Data Structures

struct  _vect_peel_info
 
struct  _vect_peel_extended_info
 
struct  peel_info_hasher
 

Macros

#define INCLUDE_MEMORY
 

Typedefs

typedef struct _vect_peel_infovect_peel_info
 
typedef struct _vect_peel_extended_infovect_peel_extended_info
 

Functions

static bool vect_lanes_optab_supported_p (const char *name, convert_optab optab, tree vectype, unsigned HOST_WIDE_INT count)
 
static cgraph_nodesimd_clone_call_p (gimple *stmt)
 
tree vect_get_smallest_scalar_type (stmt_vec_info stmt_info, tree scalar_type)
 
static opt_result vect_mark_for_runtime_alias_test (ddr_p ddr, loop_vec_info loop_vinfo)
 
static void vect_check_nonzero_value (loop_vec_info loop_vinfo, tree value)
 
static bool vect_preserves_scalar_order_p (dr_vec_info *dr_info_a, dr_vec_info *dr_info_b)
 
static bool vect_analyze_possibly_independent_ddr (data_dependence_relation *ddr, loop_vec_info loop_vinfo, int loop_depth, unsigned int *max_vf)
 
static opt_result vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, loop_vec_info loop_vinfo, unsigned int *max_vf)
 
static opt_result vect_analyze_early_break_dependences (loop_vec_info loop_vinfo)
 
opt_result vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo, unsigned int *max_vf)
 
static bool vect_slp_analyze_data_ref_dependence (vec_info *vinfo, struct data_dependence_relation *ddr)
 
static bool vect_slp_analyze_store_dependences (vec_info *vinfo, slp_tree node)
 
static bool vect_slp_analyze_load_dependences (vec_info *vinfo, slp_tree node, vec< stmt_vec_info > stores, stmt_vec_info last_store_info)
 
bool vect_slp_analyze_instance_dependence (vec_info *vinfo, slp_instance instance)
 
int dr_misalignment (dr_vec_info *dr_info, tree vectype, poly_int64 offset)
 
static void vect_record_base_alignment (vec_info *vinfo, stmt_vec_info stmt_info, innermost_loop_behavior *drb)
 
void vect_record_base_alignments (vec_info *vinfo)
 
static void vect_compute_data_ref_alignment (vec_info *vinfo, dr_vec_info *dr_info, tree vectype)
 
static bool vect_dr_aligned_if_related_peeled_dr_is (dr_vec_info *dr_info, dr_vec_info *dr_peel_info)
 
static bool vect_dr_aligned_if_peeled_dr_is (dr_vec_info *dr_info, dr_vec_info *dr_peel_info)
 
int vect_dr_misalign_for_aligned_access (dr_vec_info *dr_info)
 
static void vect_update_misalignment_for_peel (dr_vec_info *dr_info, dr_vec_info *dr_peel_info, int npeel)
 
static bool vect_relevant_for_alignment_p (dr_vec_info *dr_info)
 
static bool not_size_aligned (tree exp)
 
static bool vector_alignment_reachable_p (dr_vec_info *dr_info)
 
static void vect_get_data_access_cost (vec_info *vinfo, dr_vec_info *dr_info, dr_alignment_support alignment_support_scheme, int misalignment, unsigned int *inside_cost, unsigned int *outside_cost, stmt_vector_for_cost *body_cost_vec, stmt_vector_for_cost *prologue_cost_vec)
 
static void vect_peeling_hash_insert (hash_table< peel_info_hasher > *peeling_htab, loop_vec_info loop_vinfo, dr_vec_info *dr_info, int npeel, bool supportable_if_not_aligned)
 
int vect_peeling_hash_get_most_frequent (_vect_peel_info **slot, _vect_peel_extended_info *max)
 
static void vect_get_peeling_costs_all_drs (loop_vec_info loop_vinfo, dr_vec_info *dr0_info, unsigned int *inside_cost, unsigned int *outside_cost, stmt_vector_for_cost *body_cost_vec, stmt_vector_for_cost *prologue_cost_vec, unsigned int npeel)
 
int vect_peeling_hash_get_lowest_cost (_vect_peel_info **slot, _vect_peel_extended_info *min)
 
static struct _vect_peel_extended_info vect_peeling_hash_choose_best_peeling (hash_table< peel_info_hasher > *peeling_htab, loop_vec_info loop_vinfo)
 
static bool vect_peeling_supportable (loop_vec_info loop_vinfo, dr_vec_info *dr0_info, unsigned npeel)
 
static int dr_align_group_sort_cmp (const void *dra_, const void *drb_)
 
opt_result vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
 
opt_result vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo)
 
static bool vect_slp_analyze_node_alignment (vec_info *vinfo, slp_tree node)
 
bool vect_slp_analyze_instance_alignment (vec_info *vinfo, slp_instance instance)
 
static bool vect_analyze_group_access_1 (vec_info *vinfo, dr_vec_info *dr_info)
 
static bool vect_analyze_group_access (vec_info *vinfo, dr_vec_info *dr_info)
 
static bool vect_analyze_data_ref_access (vec_info *vinfo, dr_vec_info *dr_info)
 
static int dr_group_sort_cmp (const void *dra_, const void *drb_)
 
static tree strip_conversion (tree op)
 
static bool can_group_stmts_p (stmt_vec_info stmt1_info, stmt_vec_info stmt2_info, bool allow_slp_p)
 
opt_result vect_analyze_data_ref_accesses (vec_info *vinfo, vec< int > *dataref_groups)
 
static tree vect_vfa_segment_size (dr_vec_info *dr_info, tree length_factor)
 
static unsigned HOST_WIDE_INT vect_vfa_access_size (vec_info *vinfo, dr_vec_info *dr_info)
 
static unsigned int vect_vfa_align (dr_vec_info *dr_info)
 
static int vect_compile_time_alias (dr_vec_info *a, dr_vec_info *b, tree segment_length_a, tree segment_length_b, unsigned HOST_WIDE_INT access_size_a, unsigned HOST_WIDE_INT access_size_b)
 
static bool dependence_distance_ge_vf (data_dependence_relation *ddr, unsigned int loop_depth, poly_uint64 vf)
 
static void dump_lower_bound (dump_flags_t dump_kind, const vec_lower_bound &lower_bound)
 
static void vect_check_lower_bound (loop_vec_info loop_vinfo, tree expr, bool unsigned_p, poly_uint64 min_value)
 
static bool vect_small_gap_p (loop_vec_info loop_vinfo, dr_vec_info *dr_info, poly_int64 gap)
 
static bool vectorizable_with_step_bound_p (dr_vec_info *dr_info_a, dr_vec_info *dr_info_b, poly_uint64 *lower_bound_out)
 
opt_result vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo)
 
bool vect_gather_scatter_fn_p (vec_info *vinfo, bool read_p, bool masked_p, tree vectype, tree memory_type, tree offset_type, int scale, internal_fn *ifn_out, tree *offset_vectype_out)
 
static void vect_describe_gather_scatter_call (stmt_vec_info stmt_info, gather_scatter_info *info)
 
bool vect_check_gather_scatter (stmt_vec_info stmt_info, loop_vec_info loop_vinfo, gather_scatter_info *info)
 
opt_result vect_find_stmt_data_reference (loop_p loop, gimple *stmt, vec< data_reference_p > *datarefs, vec< int > *dataref_groups, int group_id)
 
opt_result vect_analyze_data_refs (vec_info *vinfo, poly_uint64 *min_vf, bool *fatal)
 
tree vect_get_new_vect_var (tree type, enum vect_var_kind var_kind, const char *name)
 
tree vect_get_new_ssa_name (tree type, enum vect_var_kind var_kind, const char *name)
 
static void vect_duplicate_ssa_name_ptr_info (tree name, dr_vec_info *dr_info)
 
tree vect_create_addr_base_for_vector_ref (vec_info *vinfo, stmt_vec_info stmt_info, gimple_seq *new_stmt_list, tree offset)
 
tree vect_create_data_ref_ptr (vec_info *vinfo, stmt_vec_info stmt_info, tree aggr_type, class loop *at_loop, tree offset, tree *initial_address, gimple_stmt_iterator *gsi, gimple **ptr_incr, bool only_init, tree iv_step)
 
tree bump_vector_ptr (vec_info *vinfo, tree dataref_ptr, gimple *ptr_incr, gimple_stmt_iterator *gsi, stmt_vec_info stmt_info, tree bump)
 
void vect_copy_ref_info (tree dest, tree src)
 
tree vect_create_destination_var (tree scalar_dest, tree vectype)
 
bool vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
 
internal_fn vect_store_lanes_supported (tree vectype, unsigned HOST_WIDE_INT count, bool masked_p)
 
void vect_permute_store_chain (vec_info *vinfo, vec< tree > &dr_chain, unsigned int length, stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, vec< tree > *result_chain)
 
tree vect_setup_realignment (vec_info *vinfo, stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, tree *realignment_token, enum dr_alignment_support alignment_support_scheme, tree init_addr, class loop **at_loop)
 
bool vect_grouped_load_supported (tree vectype, bool single_element_p, unsigned HOST_WIDE_INT count)
 
internal_fn vect_load_lanes_supported (tree vectype, unsigned HOST_WIDE_INT count, bool masked_p)
 
static void vect_permute_load_chain (vec_info *vinfo, vec< tree > dr_chain, unsigned int length, stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, vec< tree > *result_chain)
 
static bool vect_shift_permute_load_chain (vec_info *vinfo, vec< tree > dr_chain, unsigned int length, stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, vec< tree > *result_chain)
 
void vect_transform_grouped_load (vec_info *vinfo, stmt_vec_info stmt_info, vec< tree > dr_chain, int size, gimple_stmt_iterator *gsi)
 
void vect_record_grouped_load_vectors (vec_info *, stmt_vec_info stmt_info, vec< tree > result_chain)
 
bool vect_can_force_dr_alignment_p (const_tree decl, poly_uint64 alignment)
 
enum dr_alignment_support vect_supportable_dr_alignment (vec_info *vinfo, dr_vec_info *dr_info, tree vectype, int misalignment)
 

Macro Definition Documentation

◆ INCLUDE_MEMORY

#define INCLUDE_MEMORY
Data References Analysis and Manipulation Utilities for Vectorization.
   Copyright (C) 2003-2024 Free Software Foundation, Inc.
   Contributed by Dorit Naishlos <dorit@il.ibm.com>
   and Ira Rosen <irar@il.ibm.com>

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/>.   

Typedef Documentation

◆ vect_peel_extended_info

◆ vect_peel_info

typedef struct _vect_peel_info * vect_peel_info

Function Documentation

◆ bump_vector_ptr()

tree bump_vector_ptr ( vec_info * vinfo,
tree dataref_ptr,
gimple * ptr_incr,
gimple_stmt_iterator * gsi,
stmt_vec_info stmt_info,
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_INFO - 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 build1(), copy_ssa_name(), DR_PTR_INFO, duplicate_ssa_name_ptr_info(), fold_build2, fold_convert, fold_stmt(), follow_all_ssa_edges(), FOR_EACH_SSA_USE_OPERAND, gcc_assert, gimple_build_assign(), gsi_for_stmt(), gsi_stmt(), is_gimple_min_invariant(), make_ssa_name(), mark_ptr_info_alignment_unknown(), operand_equal_p(), ptr_type_node, SET_USE, SSA_NAME_PTR_INFO, SSA_OP_USE, STMT_VINFO_DATA_REF, STMT_VINFO_VECTYPE, TREE_CODE, TREE_TYPE, TYPE_SIZE_UNIT, update_stmt(), USE_FROM_PTR, and vect_finish_stmt_generation().

Referenced by vectorizable_load(), and vectorizable_store().

◆ can_group_stmts_p()

static bool can_group_stmts_p ( stmt_vec_info stmt1_info,
stmt_vec_info stmt2_info,
bool allow_slp_p )
static
Return true if vectorizable_* routines can handle statements STMT1_INFO
and STMT2_INFO being in a single group.  When ALLOW_SLP_P, masked loads can
be grouped in SLP mode.   

References dyn_cast(), gimple_assign_single_p(), gimple_call_arg(), gimple_call_internal_fn(), gimple_call_internal_p(), operand_equal_p(), and strip_conversion().

Referenced by vect_analyze_data_ref_accesses().

◆ dependence_distance_ge_vf()

static bool dependence_distance_ge_vf ( data_dependence_relation * ddr,
unsigned int loop_depth,
poly_uint64 vf )
static

◆ dr_align_group_sort_cmp()

static int dr_align_group_sort_cmp ( const void * dra_,
const void * drb_ )
static
Compare two data-references DRA and DRB to group them into chunks
with related alignment.   

References data_ref_compare_tree(), DR_BASE_ADDRESS, DR_INIT, DR_OFFSET, DR_STEP, DR_STMT, and gimple_uid().

Referenced by vect_enhance_data_refs_alignment().

◆ dr_group_sort_cmp()

static int dr_group_sort_cmp ( const void * dra_,
const void * drb_ )
static
Compare two data-references DRA and DRB to group them into chunks
suitable for grouping.   

References data_ref_compare_tree(), dr_vec_info::dr, DR_BASE_ADDRESS, DR_INIT, DR_IS_READ, DR_OFFSET, DR_REF, DR_STEP, DR_STMT, gimple_uid(), dr_vec_info::group, TREE_TYPE, and TYPE_SIZE_UNIT.

Referenced by vect_analyze_data_ref_accesses().

◆ dr_misalignment()

◆ dump_lower_bound()

static void dump_lower_bound ( dump_flags_t dump_kind,
const vec_lower_bound & lower_bound )
static
Dump LOWER_BOUND using flags DUMP_KIND.  Dumps are known to be enabled.   

References dump_dec(), dump_printf(), vec_lower_bound::expr, vec_lower_bound::min_value, and vec_lower_bound::unsigned_p.

Referenced by vect_check_lower_bound().

◆ not_size_aligned()

static bool not_size_aligned ( tree exp)
static
Given an memory reference EXP return whether its alignment is less
than its size.   

References exp(), get_object_alignment(), tree_fits_uhwi_p(), tree_to_uhwi(), TREE_TYPE, and TYPE_SIZE.

Referenced by vect_supportable_dr_alignment(), and vector_alignment_reachable_p().

◆ simd_clone_call_p()

static cgraph_node * simd_clone_call_p ( gimple * stmt)
static
Helper function to identify a simd clone call.  If this is a call to a
function with simd clones then return the corresponding cgraph_node,
otherwise return NULL.   

References dyn_cast(), cgraph_node::get(), gimple_call_arg(), gimple_call_fndecl(), gimple_call_internal_p(), NULL, NULL_TREE, cgraph_node::simd_clones, and TREE_OPERAND.

Referenced by vect_get_smallest_scalar_type().

◆ strip_conversion()

static tree strip_conversion ( tree op)
static
If OP is the result of a conversion, return the unconverted value,
otherwise return null.   

References CONVERT_EXPR_CODE_P, gimple_assign_rhs1(), gimple_assign_rhs_code(), is_gimple_assign(), NULL_TREE, SSA_NAME_DEF_STMT, and TREE_CODE.

Referenced by can_group_stmts_p().

◆ vect_analyze_data_ref_access()

◆ vect_analyze_data_ref_accesses()

opt_result vect_analyze_data_ref_accesses ( vec_info * vinfo,
vec< int > * dataref_groups )

◆ vect_analyze_data_ref_dependence()

◆ vect_analyze_data_ref_dependences()

opt_result vect_analyze_data_ref_dependences ( loop_vec_info loop_vinfo,
unsigned int * max_vf )
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_VECT_SCOPE, FOR_EACH_VEC_ELT, gcc_assert, i, LOOP_VINFO_DATAREFS, LOOP_VINFO_DDRS, LOOP_VINFO_EARLY_BREAKS, LOOP_VINFO_EPILOGUE_P, LOOP_VINFO_LOOP_NEST, LOOP_VINFO_NO_DATA_DEPENDENCIES, LOOP_VINFO_ORIG_MAX_VECT_FACTOR, opt_result::success(), vect_analyze_data_ref_dependence(), and vect_analyze_early_break_dependences().

Referenced by vect_analyze_loop_2().

◆ vect_analyze_data_refs()

opt_result vect_analyze_data_refs ( vec_info * vinfo,
poly_uint64 * min_vf,
bool * fatal )
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 as_a(), data_reference::aux, build_fold_indirect_ref, vec_info_shared::datarefs, DECL_NONALIASED, dr_analyze_innermost(), DR_BASE_ADDRESS, DR_INIT, DR_IS_READ, DR_IS_WRITE, DR_OFFSET, DR_REF, DR_STEP, DR_STMT, dump_enabled_p(), dump_generic_expr(), dump_printf(), dump_printf_loc(), DUMP_VECT_SCOPE, dyn_cast(), opt_result::failure_at(), fatal(), fold_build2, fold_build_pointer_plus, FOR_EACH_VEC_ELT, gcc_assert, get_base_address(), get_vectype_for_scalar_type(), i, is_a(), vec_info::lookup_stmt(), LOOP_VINFO_LOOP, MSG_MISSED_OPTIMIZATION, MSG_NOTE, nested_in_vect_loop_p(), NULL, gather_scatter_info::offset, offset, vec_info::shared, data_reference::stmt, STMT_VINFO_DR_BASE_ADDRESS, STMT_VINFO_DR_BASE_ALIGNMENT, STMT_VINFO_DR_BASE_MISALIGNMENT, STMT_VINFO_DR_INIT, STMT_VINFO_DR_OFFSET, STMT_VINFO_DR_OFFSET_ALIGNMENT, STMT_VINFO_DR_STEP, STMT_VINFO_DR_STEP_ALIGNMENT, STMT_VINFO_DR_WRT_VEC_LOOP, STMT_VINFO_GATHER_SCATTER_P, STMT_VINFO_SIMD_LANE_ACCESS_P, STMT_VINFO_STRIDED_P, STMT_VINFO_VECTORIZABLE, STMT_VINFO_VECTYPE, opt_result::success(), TDF_DETAILS, TREE_CODE, TREE_THIS_VOLATILE, TREE_TYPE, TYPE_VECTOR_SUBPARTS(), unshare_expr(), VAR_P, vect_check_gather_scatter(), and vect_location.

Referenced by vect_analyze_loop_2(), and vect_slp_analyze_bb_1().

◆ vect_analyze_data_refs_alignment()

opt_result vect_analyze_data_refs_alignment ( loop_vec_info loop_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 DR_GROUP_FIRST_ELEMENT, DUMP_VECT_SCOPE, FOR_EACH_VEC_ELT, i, vec_info::lookup_dr(), LOOP_VINFO_DATAREFS, STMT_VINFO_GROUPED_ACCESS, STMT_VINFO_VECTORIZABLE, STMT_VINFO_VECTYPE, opt_result::success(), vect_compute_data_ref_alignment(), and vect_record_base_alignments().

Referenced by vect_analyze_loop_2().

◆ vect_analyze_early_break_dependences()

static opt_result vect_analyze_early_break_dependences ( loop_vec_info loop_vinfo)
static
Function vect_analyze_early_break_dependences.

Examine all the data references in the loop and make sure that if we have
multiple exits that we are able to safely move stores such that they become
safe for vectorization.  The function also calculates the place where to move
the instructions to and computes what the new vUSE chain should be.

This works in tandem with the CFG that will be produced by
slpeel_tree_duplicate_loop_to_edge_cfg later on.

This function tries to validate whether an early break vectorization
is possible for the current instruction sequence. Returns True i
possible, otherwise False.

Requirements:
  - Any memory access must be to a fixed size buffer.
  - There must not be any loads and stores to the same object.
  - Multiple loads are allowed as long as they don't alias.

NOTE:
  This implementation is very conservative. Any overlapping loads/stores
  that take place before the early break statement gets rejected aside from
  WAR dependencies.

  i.e.:

     a[i] = 8
     c = a[i]
     if (b[i])
       ...

     is not allowed, but

     c = a[i]
     a[i] = 8
     if (b[i])
       ...

     is which is the common case.   

References DR_IS_READ, DR_IS_WRITE, dr_may_alias_p(), DR_REF, dump_enabled_p(), dump_printf_loc(), DUMP_VECT_SCOPE, opt_result::failure_at(), g, gcc_assert, get_virtual_phi(), gimple_vdef(), gimple_vuse(), gsi_end_p(), gsi_last_bb(), gsi_prev(), gsi_stmt(), loop::header, basic_block_def::index, is_empty(), is_gimple_debug(), last, loop::latch, vec_info::lookup_stmt(), basic_block_def::loop_father, loop_outer(), LOOP_VINFO_EARLY_BREAKS_VECT_PEELED, LOOP_VINFO_EARLY_BRK_DEST_BB, LOOP_VINFO_EARLY_BRK_STORES, LOOP_VINFO_EARLY_BRK_VUSES, LOOP_VINFO_LOOP, MSG_MISSED_OPTIMIZATION, MSG_NOTE, NULL, ref_within_array_bound(), single_pred(), single_pred_p(), STMT_VINFO_DATA_REF, opt_result::success(), and vect_location.

Referenced by vect_analyze_data_ref_dependences().

◆ vect_analyze_group_access()

static bool vect_analyze_group_access ( vec_info * vinfo,
dr_vec_info * dr_info )
static
Analyze groups of accesses: check that DR_INFO 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 DR_GROUP_FIRST_ELEMENT, DR_GROUP_NEXT_ELEMENT, NULL, and vect_analyze_group_access_1().

Referenced by vect_analyze_data_ref_access().

◆ vect_analyze_group_access_1()

static bool vect_analyze_group_access_1 ( vec_info * vinfo,
dr_vec_info * dr_info )
static
Analyze groups of accesses: check that DR_INFO 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.
Worker for vect_analyze_group_access.   

References absu_hwi(), BB_VINFO_GROUPED_STORES, count, dr_info::dr, DR_GROUP_FIRST_ELEMENT, DR_GROUP_GAP, DR_GROUP_NEXT_ELEMENT, DR_GROUP_SIZE, DR_INIT, DR_IS_READ, DR_IS_WRITE, DR_REF, DR_STEP, dump_enabled_p(), dump_printf(), dump_printf_loc(), dyn_cast(), gcc_assert, gcc_checking_assert, LOOP_VINFO_GROUPED_STORES, MSG_MISSED_OPTIMIZATION, MSG_NOTE, operand_equal_p(), STMT_VINFO_DATA_REF, STMT_VINFO_STRIDED_P, STMT_VINFO_VECTORIZABLE, tree_fits_shwi_p(), tree_int_cst_compare(), TREE_INT_CST_LOW, tree_to_shwi(), TREE_TYPE, TYPE_SIZE_UNIT, UINT_MAX, and vect_location.

Referenced by vect_analyze_group_access().

◆ vect_analyze_possibly_independent_ddr()

static bool vect_analyze_possibly_independent_ddr ( data_dependence_relation * ddr,
loop_vec_info loop_vinfo,
int loop_depth,
unsigned int * max_vf )
static
A subroutine of vect_analyze_data_ref_dependence.  Handle
DDR_COULD_BE_INDEPENDENT_P ddr DDR that has a known set of dependence
distances.  These distances are conservatively correct but they don't
reflect a guaranteed dependence.

Return true if this function does all the work necessary to avoid
an alias or false if the caller should use the dependence distances
to limit the vectorization factor in the usual way.  LOOP_DEPTH is
the depth of the loop described by LOOP_VINFO and the other arguments
are as for vect_analyze_data_ref_dependence.   

References abs_hwi(), DDR_A, DDR_B, DDR_DIST_VECTS, DDR_REVERSED_P, vec_info::lookup_dr(), loop_depth(), LOOP_VINFO_LOOP, LOOP_VINFO_NO_DATA_DEPENDENCIES, loop::safelen, dr_vec_info::stmt, STMT_VINFO_GATHER_SCATTER_P, and vect_mark_for_runtime_alias_test().

Referenced by vect_analyze_data_ref_dependence().

◆ vect_can_force_dr_alignment_p()

bool vect_can_force_dr_alignment_p ( const_tree decl,
poly_uint64 alignment )
Function vect_force_dr_alignment_p.

Returns whether the alignment of a DECL can be forced to be aligned
on ALIGNMENT bit boundary.   

References decl_in_symtab_p(), symtab_node::get(), known_le, MAX_OFILE_ALIGNMENT, MAX_STACK_ALIGNMENT, TREE_STATIC, and VAR_P.

Referenced by increase_alignment(), and vect_compute_data_ref_alignment().

◆ vect_check_gather_scatter()

bool vect_check_gather_scatter ( stmt_vec_info stmt_info,
loop_vec_info loop_vinfo,
gather_scatter_info * info )
Return true if a non-affine read or write in STMT_INFO is suitable for a
gather load or scatter store.  Describe the operation in *INFO if so.   

References gather_scatter_info::base, build_fold_addr_expr, CASE_CONVERT, gather_scatter_info::decl, do_add(), DR_IS_READ, DR_REF, dyn_cast(), gather_scatter_info::element_type, expr_invariant_in_loop_p(), extract_ops_from_tree(), fold_convert, get_gimple_rhs_class(), get_inner_reference(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_call_internal_fn(), gimple_call_internal_p(), GIMPLE_TERNARY_RHS, gather_scatter_info::ifn, integer_zerop(), INTEGRAL_TYPE_P, internal_gather_scatter_fn_p(), is_gimple_assign(), LOOP_VINFO_LOOP, may_be_nonaddressable_p(), mem_ref_offset(), gather_scatter_info::memory_type, NULL_TREE, gather_scatter_info::offset, gather_scatter_info::offset_dt, gather_scatter_info::offset_vectype, operand_equal_p(), POINTER_TYPE_P, gather_scatter_info::scale, signed_char_type_node, size_binop, size_int, size_zero_node, sizetype, SSA_NAME_DEF_STMT, STMT_VINFO_DATA_REF, STMT_VINFO_VECTYPE, STRIP_NOPS, supports_vec_gather_load_p(), supports_vec_scatter_store_p(), targetm, TREE_CODE, tree_fits_shwi_p(), TREE_OPERAND, tree_to_shwi(), TREE_TYPE, TYPE_MODE, TYPE_PRECISION, TYPE_SIZE, unsigned_char_type_node, vect_describe_gather_scatter_call(), vect_gather_scatter_fn_p(), vect_unknown_def_type, and wide_int_to_tree().

Referenced by get_load_store_type(), vect_analyze_data_refs(), vect_detect_hybrid_slp(), vect_get_and_check_slp_defs(), vect_mark_stmts_to_be_vectorized(), vect_recog_gather_scatter_pattern(), and vect_use_strided_gather_scatters_p().

◆ vect_check_lower_bound()

static void vect_check_lower_bound ( loop_vec_info loop_vinfo,
tree expr,
bool unsigned_p,
poly_uint64 min_value )
static
Record that the vectorized loop requires the vec_lower_bound described
by EXPR, UNSIGNED_P and MIN_VALUE.   

References dump_enabled_p(), dump_lower_bound(), dump_printf(), dump_printf_loc(), i, LOOP_VINFO_LOWER_BOUNDS, MSG_NOTE, operand_equal_p(), and vect_location.

Referenced by vect_prune_runtime_alias_test_list().

◆ vect_check_nonzero_value()

static void vect_check_nonzero_value ( loop_vec_info loop_vinfo,
tree value )
static
Record that loop LOOP_VINFO needs to check that VALUE is nonzero.   

References dump_enabled_p(), dump_printf_loc(), i, LOOP_VINFO_CHECK_NONZERO, MSG_NOTE, and vect_location.

Referenced by vect_analyze_data_ref_dependence().

◆ vect_compile_time_alias()

static int vect_compile_time_alias ( dr_vec_info * a,
dr_vec_info * b,
tree segment_length_a,
tree segment_length_b,
unsigned HOST_WIDE_INT access_size_a,
unsigned HOST_WIDE_INT access_size_b )
static
Function vect_no_alias_p.

Given data references A and B with equal base and offset, see whether
the alias relation can be decided at compilation time.  Return 1 if
it can and the references alias, 0 if it can and the references do
not alias, and -1 if we cannot decide at compile time.  SEGMENT_LENGTH_A,
SEGMENT_LENGTH_B, ACCESS_SIZE_A and ACCESS_SIZE_B are the equivalent
of dr_with_seg_len::{seg_len,access_size} for A and B.   

References a, b, DR_INIT, DR_STEP, size_zero_node, wi::to_poly_offset(), wi::to_poly_wide(), tree_int_cst_compare(), and tree_to_poly_uint64().

Referenced by vect_prune_runtime_alias_test_list().

◆ vect_compute_data_ref_alignment()

◆ vect_copy_ref_info()

void vect_copy_ref_info ( tree dest,
tree src )
Copy memory reference info such as base/clique from the SRC reference
to the DEST MEM_REF.   

References handled_component_p(), MR_DEPENDENCE_BASE, MR_DEPENDENCE_CLIQUE, TREE_CODE, and TREE_OPERAND.

Referenced by vect_setup_realignment(), vectorizable_load(), vectorizable_scan_store(), and vectorizable_store().

◆ vect_create_addr_base_for_vector_ref()

tree vect_create_addr_base_for_vector_ref ( vec_info * vinfo,
stmt_vec_info stmt_info,
gimple_seq * new_stmt_list,
tree offset )
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_INFO: 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 innermost_loop_behavior::base_address, build1(), build_pointer_type(), dr_info::dr, DR_PTR_INFO, DR_REF, dump_enabled_p(), dump_printf_loc(), dyn_cast(), fold_build2, fold_build_pointer_plus, fold_convert, force_gimple_operand(), gcc_assert, get_dr_vinfo_offset(), get_name(), gimple_seq_add_seq(), innermost_loop_behavior::init, MSG_NOTE, NULL, offset, size_binop, sizetype, SSA_NAME_PTR_INFO, SSA_NAME_VAR, ssize_int, STMT_VINFO_DR_INFO, strip_zero_offset_components(), TREE_CODE, TREE_TYPE, unshare_expr(), vect_dr_behavior(), vect_duplicate_ssa_name_ptr_info(), vect_get_new_vect_var(), vect_location, and vect_pointer_var.

Referenced by get_misalign_in_elems(), vect_create_cond_for_align_checks(), vect_create_data_ref_ptr(), and vect_setup_realignment().

◆ vect_create_data_ref_ptr()

tree vect_create_data_ref_ptr ( vec_info * vinfo,
stmt_vec_info stmt_info,
tree aggr_type,
class loop * at_loop,
tree offset,
tree * initial_address,
gimple_stmt_iterator * gsi,
gimple ** ptr_incr,
bool only_init,
tree iv_step )
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_INFO, 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_INFO: 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): a byte offset to be added to the initial address
     accessed by the data-ref in STMT_INFO.
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.
8. IV_STEP (optional, defaults to NULL): the amount that should be added
     to the IV during each iteration of the loop.  NULL says to move
     by one copy of AGGR_TYPE up or down, depending on the step of the
     data reference.

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;
   if BYTE_OFFSET is supplied:
      initial_address = &a[init] + BYTE_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. Return the pointer.   

References alias_sets_conflict_p(), build_pointer_type_for_mode(), create_iv(), dr_info::dr, DR_BASE_ADDRESS, DR_BASE_OBJECT, DR_GROUP_FIRST_ELEMENT, DR_GROUP_NEXT_ELEMENT, DR_GROUP_SIZE, DR_PTR_INFO, DR_REF, DR_STEP, dump_enabled_p(), dump_printf(), dump_printf_loc(), dyn_cast(), fold_build1, fold_convert, gcc_assert, gcc_unreachable, get_alias_set(), get_name(), get_tree_code_name(), gimple_bb(), gsi_insert_seq_before(), gsi_insert_seq_on_edge_immediate(), GSI_SAME_STMT, gsi_stmt(), integer_zerop(), loop_preheader_edge(), LOOP_VINFO_LOOP, MSG_NOTE, nested_in_vect_loop_p(), NULL, NULL_TREE, offset, standard_iv_increment_position(), innermost_loop_behavior::step, STMT_VINFO_DATA_REF, STMT_VINFO_DR_INFO, TREE_CODE, tree_int_cst_sgn(), TREE_TYPE, TYPE_SIZE_UNIT, vect_create_addr_base_for_vector_ref(), vect_dr_behavior(), vect_duplicate_ssa_name_ptr_info(), vect_get_new_vect_var(), vect_location, and vect_pointer_var.

Referenced by vect_setup_realignment(), vectorizable_load(), and vectorizable_store().

◆ vect_create_destination_var()

◆ vect_describe_gather_scatter_call()

◆ vect_dr_aligned_if_peeled_dr_is()

static bool vect_dr_aligned_if_peeled_dr_is ( dr_vec_info * dr_info,
dr_vec_info * dr_peel_info )
static

◆ vect_dr_aligned_if_related_peeled_dr_is()

static bool vect_dr_aligned_if_related_peeled_dr_is ( dr_vec_info * dr_info,
dr_vec_info * dr_peel_info )
static
Return whether DR_INFO, which is related to DR_PEEL_INFO in
that it only differs in DR_INIT, is aligned if DR_PEEL_INFO
is made aligned via peeling.   

References dr_info::dr, dr_vec_info::dr, DR_INIT, DR_TARGET_ALIGNMENT, known_eq, and wi::to_poly_offset().

Referenced by vect_dr_aligned_if_peeled_dr_is(), and vect_enhance_data_refs_alignment().

◆ vect_dr_misalign_for_aligned_access()

int vect_dr_misalign_for_aligned_access ( dr_vec_info * dr_info)
Compute the value for dr_info->misalign so that the access appears
aligned.  This is used by peeling to compensate for dr_misalignment
applying the offset for negative step.   

References dr_info::dr, DR_MISALIGNMENT_UNKNOWN, DR_STEP, STMT_VINFO_VECTYPE, TREE_INT_CST_LOW, tree_int_cst_sgn(), TREE_TYPE, TYPE_SIZE_UNIT, and TYPE_VECTOR_SUBPARTS().

Referenced by vect_enhance_data_refs_alignment(), and vect_update_misalignment_for_peel().

◆ vect_duplicate_ssa_name_ptr_info()

static void vect_duplicate_ssa_name_ptr_info ( tree name,
dr_vec_info * dr_info )
static

◆ vect_enhance_data_refs_alignment()

opt_result vect_enhance_data_refs_alignment ( loop_vec_info loop_vinfo)
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 aligned_access_p(), _vect_peel_info::count, dr_vec_info::dr, dr_align_group_sort_cmp(), DR_BASE_ADDRESS, DR_GROUP_SIZE, _vect_peel_info::dr_info, DR_IS_WRITE, dr_misalignment(), DR_MISALIGNMENT_UNKNOWN, DR_OFFSET, DR_STEP, DR_STEP_ALIGNMENT, DR_TARGET_ALIGNMENT, dr_unaligned_unsupported, dump_enabled_p(), dump_printf_loc(), DUMP_VECT_SCOPE, flow_loop_nested_p(), FOR_EACH_VEC_ELT, gcc_assert, GET_MODE_SIZE(), i, loop::inner, _vect_peel_extended_info::inside_cost, INT_MAX, is_empty(), known_alignment_for_access_p(), known_le, vec_info::lookup_dr(), loop_cost_model(), loop_preheader_edge(), LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT, LOOP_VINFO_DATAREFS, LOOP_VINFO_EARLY_BREAKS_VECT_PEELED, LOOP_VINFO_INT_NITERS, LOOP_VINFO_IV_EXIT, LOOP_VINFO_LOOP, LOOP_VINFO_MAY_MISALIGN_STMTS, LOOP_VINFO_NITERS_KNOWN_P, LOOP_VINFO_PEELING_FOR_ALIGNMENT, LOOP_VINFO_PTR_MASK, LOOP_VINFO_SCALAR_ITERATION_COST, LOOP_VINFO_UNALIGNED_DR, LOOP_VINFO_VECT_FACTOR, MAX, MSG_MISSED_OPTIMIZATION, MSG_NOTE, _vect_peel_info::npeel, NULL, operand_equal_p(), optimize_loop_nest_for_speed_p(), outermost_invariant_loop_for_expr(), _vect_peel_extended_info::outside_cost, _vect_peel_extended_info::peel_info, SET_DR_MISALIGNMENT, size_zero_node, slpeel_can_duplicate_loop_p(), dr_vec_info::stmt, STMT_SLP_TYPE, STMT_VINFO_DR_INFO, STMT_VINFO_GROUPED_ACCESS, STMT_VINFO_STRIDED_P, STMT_VINFO_VECTYPE, opt_result::success(), target_align(), tree_int_cst_compare(), TREE_INT_CST_LOW, TREE_TYPE, TYPE_MODE, TYPE_SIZE_UNIT, TYPE_VECTOR_SUBPARTS(), unlimited_cost_model(), vect_can_advance_ivs_p(), VECT_COST_MODEL_CHEAP, vect_dr_aligned_if_related_peeled_dr_is(), vect_dr_misalign_for_aligned_access(), vect_get_known_peeling_cost(), vect_get_peeling_costs_all_drs(), vect_get_scalar_dr_size(), vect_location, vect_peeling_hash_choose_best_peeling(), vect_peeling_hash_insert(), vect_peeling_supportable(), vect_relevant_for_alignment_p(), vect_supportable_dr_alignment(), vect_update_misalignment_for_peel(), vect_vf_for_cost(), and vector_alignment_reachable_p().

Referenced by vect_analyze_loop_2().

◆ vect_find_stmt_data_reference()

◆ vect_gather_scatter_fn_p()

bool vect_gather_scatter_fn_p ( vec_info * vinfo,
bool read_p,
bool masked_p,
tree vectype,
tree memory_type,
tree offset_type,
int scale,
internal_fn * ifn_out,
tree * offset_vectype_out )
Check whether we can use an internal function for a gather load
or scatter store.  READ_P is true for loads and false for stores.
MASKED_P is true if the load or store is conditional.  MEMORY_TYPE is
the type of the memory elements being loaded or stored.  OFFSET_TYPE
is the type of the offset that is being applied to the invariant
base address.  SCALE is the amount by which the offset should
be multiplied *after* it has been converted to address width.

Return true if the function is supported, storing the function id in
*IFN_OUT and the vector type for the offset in *OFFSET_VECTYPE_OUT.   

References build_nonstandard_integer_type(), get_vectype_for_scalar_type(), internal_gather_scatter_fn_supported_p(), POINTER_SIZE, tree_to_uhwi(), TYPE_PRECISION, TYPE_SIZE, TYPE_UNSIGNED, and vector_element_bits().

Referenced by vect_check_gather_scatter(), and vect_truncate_gather_scatter_offset().

◆ vect_get_data_access_cost()

static void vect_get_data_access_cost ( vec_info * vinfo,
dr_vec_info * dr_info,
dr_alignment_support alignment_support_scheme,
int misalignment,
unsigned int * inside_cost,
unsigned int * outside_cost,
stmt_vector_for_cost * body_cost_vec,
stmt_vector_for_cost * prologue_cost_vec )
static

◆ vect_get_new_ssa_name()

◆ vect_get_new_vect_var()

tree vect_get_new_vect_var ( tree type,
enum vect_var_kind var_kind,
const char * name )
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(), gcc_unreachable, NULL, vect_mask_var, vect_pointer_var, vect_scalar_var, and vect_simple_var.

Referenced by permute_vec_elements(), vect_create_addr_base_for_vector_ref(), vect_create_data_ref_ptr(), vect_create_destination_var(), vectorizable_induction(), vectorizable_nonlinear_induction(), and vectorizable_recurr().

◆ vect_get_peeling_costs_all_drs()

static void vect_get_peeling_costs_all_drs ( loop_vec_info loop_vinfo,
dr_vec_info * dr0_info,
unsigned int * inside_cost,
unsigned int * outside_cost,
stmt_vector_for_cost * body_cost_vec,
stmt_vector_for_cost * prologue_cost_vec,
unsigned int npeel )
static

◆ vect_get_smallest_scalar_type()

tree vect_get_smallest_scalar_type ( stmt_vec_info stmt_info,
tree scalar_type )
Return the smallest scalar part of STMT_INFO.
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 dyn_cast(), gimple_assign_cast_p(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs_code(), gimple_call_arg(), gimple_call_internal_fn(), gimple_call_internal_p(), gimple_call_num_args(), i, internal_fn_mask_index(), internal_fn_stored_value_index(), internal_load_fn_p(), internal_store_fn_p(), SIMD_CLONE_ARG_TYPE_VECTOR, simd_clone_call_p(), tree_fits_uhwi_p(), TREE_INT_CST_LOW, TREE_TYPE, and TYPE_SIZE_UNIT.

Referenced by vect_get_vector_types_for_stmt().

◆ vect_grouped_load_supported()

bool vect_grouped_load_supported ( tree vectype,
bool single_element_p,
unsigned HOST_WIDE_INT count )
Function vect_grouped_load_supported.

COUNT is the size of the load group (the number of statements plus the
number of gaps).  SINGLE_ELEMENT_P is true if there is actually
only one statement, with a gap of COUNT - 1.

Returns true if a suitable permute exists.   

References can_vec_perm_const_p(), count, dump_enabled_p(), dump_printf_loc(), exact_log2(), gcc_assert, GET_MODE_NUNITS(), i, maybe_gt, MSG_MISSED_OPTIMIZATION, pow2p_hwi(), TYPE_MODE, TYPE_VECTOR_SUBPARTS(), vect_location, and VECTOR_MODE_P.

Referenced by get_group_load_store_type(), and vect_analyze_loop_2().

◆ vect_grouped_store_supported()

bool vect_grouped_store_supported ( tree vectype,
unsigned HOST_WIDE_INT count )
Function vect_grouped_store_supported.

Returns TRUE if interleave high and interleave low permutations
are supported, and FALSE otherwise.   

References can_vec_perm_const_p(), count, dump_enabled_p(), dump_printf(), dump_printf_loc(), exact_log2(), gcc_assert, GET_MODE_NUNITS(), i, data_reference::indices, MSG_MISSED_OPTIMIZATION, pow2p_hwi(), TYPE_MODE, vect_location, and VECTOR_MODE_P.

Referenced by get_group_load_store_type(), and vect_analyze_loop_2().

◆ vect_lanes_optab_supported_p()

static bool vect_lanes_optab_supported_p ( const char * name,
convert_optab optab,
tree vectype,
unsigned HOST_WIDE_INT count )
static
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(), count, dump_enabled_p(), dump_printf_loc(), GET_MODE_BITSIZE(), GET_MODE_NAME, int_mode_for_size(), MSG_MISSED_OPTIMIZATION, MSG_NOTE, targetm, TYPE_MODE, and vect_location.

Referenced by vect_load_lanes_supported(), and vect_store_lanes_supported().

◆ vect_load_lanes_supported()

internal_fn vect_load_lanes_supported ( tree vectype,
unsigned HOST_WIDE_INT count,
bool masked_p )
Return FN if vec_{masked_,mask_len_}load_lanes is available for COUNT vectors
of type VECTYPE.  MASKED_P says whether the masked form is needed.   

References count, and vect_lanes_optab_supported_p().

Referenced by check_load_store_for_partial_vectors(), get_group_load_store_type(), vect_analyze_loop_2(), vect_analyze_slp(), and vect_lower_load_permutations().

◆ vect_mark_for_runtime_alias_test()

static opt_result vect_mark_for_runtime_alias_test ( ddr_p ddr,
loop_vec_info loop_vinfo )
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 opt_result::failure_at(), LOOP_VINFO_LOOP, LOOP_VINFO_MAY_ALIAS_DDRS, optimize_loop_nest_for_speed_p(), runtime_alias_check_p(), opt_result::success(), and vect_location.

Referenced by vect_analyze_data_ref_dependence(), and vect_analyze_possibly_independent_ddr().

◆ vect_peeling_hash_choose_best_peeling()

static struct _vect_peel_extended_info vect_peeling_hash_choose_best_peeling ( hash_table< peel_info_hasher > * peeling_htab,
loop_vec_info loop_vinfo )
static
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_info::count, _vect_peel_info::dr_info, _vect_peel_extended_info::inside_cost, INT_MAX, LOOP_VINFO_LOOP, NULL, _vect_peel_extended_info::outside_cost, _vect_peel_extended_info::peel_info, unlimited_cost_model(), vect_peeling_hash_get_lowest_cost(), vect_peeling_hash_get_most_frequent(), and _vect_peel_extended_info::vinfo.

Referenced by vect_enhance_data_refs_alignment().

◆ vect_peeling_hash_get_lowest_cost()

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_info::count, _vect_peel_info::dr_info, dyn_cast(), LOOP_VINFO_SCALAR_ITERATION_COST, _vect_peel_info::npeel, vect_get_known_peeling_cost(), and vect_get_peeling_costs_all_drs().

Referenced by vect_peeling_hash_choose_best_peeling().

◆ vect_peeling_hash_get_most_frequent()

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_info, and _vect_peel_info::npeel.

Referenced by vect_peeling_hash_choose_best_peeling().

◆ vect_peeling_hash_insert()

static void vect_peeling_hash_insert ( hash_table< peel_info_hasher > * peeling_htab,
loop_vec_info loop_vinfo,
dr_vec_info * dr_info,
int npeel,
bool supportable_if_not_aligned )
static

◆ vect_peeling_supportable()

◆ vect_permute_load_chain()

static void vect_permute_load_chain ( vec_info * vinfo,
vec< tree > dr_chain,
unsigned int length,
stmt_vec_info stmt_info,
gimple_stmt_iterator * gsi,
vec< tree > * result_chain )
static
Function vect_permute_load_chain.

Given a chain of interleaved loads in DR_CHAIN of LENGTH that must be
a power of 2 or equal to 3, 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(), gcc_assert, gimple_build_assign(), i, make_temp_ssa_name(), NULL, pow2p_hwi(), STMT_VINFO_VECTYPE, poly_int< N, C >::to_constant(), TYPE_VECTOR_SUBPARTS(), vect_finish_stmt_generation(), and vect_gen_perm_mask_checked().

Referenced by vect_transform_grouped_load().

◆ vect_permute_store_chain()

void vect_permute_store_chain ( vec_info * vinfo,
vec< tree > & dr_chain,
unsigned int length,
stmt_vec_info stmt_info,
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 or equal to 3, 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(), gcc_assert, gimple_build_assign(), i, data_reference::indices, make_temp_ssa_name(), NULL, pow2p_hwi(), STMT_VINFO_VECTYPE, poly_int< N, C >::to_constant(), TYPE_VECTOR_SUBPARTS(), vect_finish_stmt_generation(), and vect_gen_perm_mask_checked().

Referenced by vectorizable_store().

◆ vect_preserves_scalar_order_p()

static bool vect_preserves_scalar_order_p ( dr_vec_info * dr_info_a,
dr_vec_info * dr_info_b )
static
Return true if we know that the order of vectorized DR_INFO_A and
vectorized DR_INFO_B will be the same as the order of DR_INFO_A and
DR_INFO_B.  At least one of the accesses is a write.   

References dr_vec_info::dr, DR_GROUP_FIRST_ELEMENT, DR_GROUP_NEXT_ELEMENT, DR_IS_READ, DR_IS_WRITE, DR_STEP, get_later_stmt(), integer_zerop(), dr_vec_info::stmt, STMT_VINFO_DATA_REF, and STMT_VINFO_GROUPED_ACCESS.

Referenced by vect_analyze_data_ref_dependence(), vect_prune_runtime_alias_test_list(), and vectorizable_with_step_bound_p().

◆ vect_prune_runtime_alias_test_list()

opt_result vect_prune_runtime_alias_test_list ( loop_vec_info loop_vinfo)
Function vect_prune_runtime_alias_test_list.

Prune a list of ddrs to be tested at run-time by versioning for alias.
Merge several alias checks into one if possible.
Return FALSE if resulting list of ddrs is longer then allowed by
PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS, otherwise return TRUE.   

References hash_set< KeyId, Lazy, Traits >::add(), count, DDR_A, DDR_B, DDR_OBJECT_A, DDR_OBJECT_B, dependence_distance_ge_vf(), dr_vec_info::dr, DR_BASE_ADDRESS, DR_GROUP_FIRST_ELEMENT, dr_known_forward_stride_p(), DR_OFFSET, DR_REF, DR_STEP, dump_dec(), dump_enabled_p(), dump_printf(), dump_printf_loc(), DUMP_VECT_SCOPE, opt_result::failure_at(), FOR_EACH_VEC_ELT, get_later_stmt(), i, index_in_loop_nest(), known_eq, vec_info::lookup_dr(), loop_cost_model(), loop_depth(), LOOP_VINFO_CHECK_NONZERO, LOOP_VINFO_CHECK_UNEQUAL_ADDRS, LOOP_VINFO_COMP_ALIAS_DDRS, LOOP_VINFO_LOOP, LOOP_VINFO_LOOP_NEST, LOOP_VINFO_MAY_ALIAS_DDRS, LOOP_VINFO_NITERS, LOOP_VINFO_VECT_FACTOR, MSG_NOTE, loop::num, operand_equal_p(), poly_int_tree_p(), prune_runtime_alias_test_list(), dr_with_seg_len_pair_t::REORDERED, size_int, size_zero_node, dr_vec_info::stmt, STMT_VINFO_DR_INFO, opt_result::success(), TREE_CODE, vect_check_lower_bound(), vect_compile_time_alias(), VECT_COST_MODEL_CHEAP, VECT_COST_MODEL_VERY_CHEAP, vect_location, vect_preserves_scalar_order_p(), vect_small_gap_p(), vect_vfa_access_size(), vect_vfa_align(), vect_vfa_segment_size(), vectorizable_with_step_bound_p(), and dr_with_seg_len_pair_t::WELL_ORDERED.

Referenced by vect_analyze_loop_2().

◆ vect_record_base_alignment()

◆ vect_record_base_alignments()

void vect_record_base_alignments ( vec_info * vinfo)
If the region we're going to vectorize is reached, all unconditional
data references occur at least once.  We can therefore pool the base
alignment guarantees from each unconditional reference.  Do this by
going through all the data references in VINFO and checking whether
the containing statement makes the reference unconditionally.  If so,
record the alignment of the base address in VINFO so that it can be
used for all other references with the same base.   

References vec_info_shared::datarefs, DR_INNERMOST, DR_IS_CONDITIONAL_IN_STMT, dyn_cast(), vec_info::lookup_dr(), LOOP_VINFO_LOOP, nested_in_vect_loop_p(), NULL, vec_info::shared, STMT_VINFO_DR_WRT_VEC_LOOP, STMT_VINFO_GATHER_SCATTER_P, STMT_VINFO_VECTORIZABLE, and vect_record_base_alignment().

Referenced by vect_analyze_data_refs_alignment(), and vect_slp_analyze_bb_1().

◆ vect_record_grouped_load_vectors()

void vect_record_grouped_load_vectors ( vec_info * ,
stmt_vec_info stmt_info,
vec< tree > result_chain )
RESULT_CHAIN contains the output of a group of grouped loads that were
generated as part of the vectorization of STMT_INFO.  Assign the statement
for each vector to the associated scalar statement.   

References DR_GROUP_FIRST_ELEMENT, DR_GROUP_GAP, DR_GROUP_NEXT_ELEMENT, FOR_EACH_VEC_ELT, i, SSA_NAME_DEF_STMT, and STMT_VINFO_VEC_STMTS.

Referenced by vect_transform_grouped_load(), and vectorizable_load().

◆ vect_relevant_for_alignment_p()

◆ vect_setup_realignment()

tree vect_setup_realignment ( vec_info * vinfo,
stmt_vec_info stmt_info,
gimple_stmt_iterator * gsi,
tree * realignment_token,
enum dr_alignment_support alignment_support_scheme,
tree init_addr,
class 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_INFO, 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_INFO - (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(), build2(), build_int_cst(), copy_ssa_name(), create_phi_node(), dr_info::dr, dr_explicit_realign, dr_explicit_realign_optimized, DR_REF, DR_TARGET_ALIGNMENT, dyn_cast(), fold_build2, gcc_assert, get_virtual_phi(), gimple_assign_lhs(), gimple_assign_set_lhs(), gimple_bb(), gimple_build_assign(), gimple_build_call(), gimple_call_lhs(), gimple_call_return_type(), gimple_call_set_lhs(), gimple_set_vuse(), gimple_vuse(), gsi_insert_before(), gsi_insert_on_edge_immediate(), gsi_insert_seq_before(), gsi_insert_seq_on_edge_immediate(), GSI_SAME_STMT, gsi_stmt(), loop::header, loop::inner, loop_preheader_edge(), LOOP_VINFO_LOOP, make_ssa_name(), nested_in_vect_loop_p(), NULL, NULL_TREE, PHI_ARG_DEF_FROM_EDGE, reference_alias_ptr_type(), size_zero_node, STMT_VINFO_DR_INFO, STMT_VINFO_DR_STEP, STMT_VINFO_VECTYPE, targetm, TREE_CODE, tree_int_cst_compare(), TREE_READONLY, TREE_TYPE, UNKNOWN_LOCATION, vect_copy_ref_info(), vect_create_addr_base_for_vector_ref(), vect_create_data_ref_ptr(), and vect_create_destination_var().

Referenced by vectorizable_load().

◆ vect_shift_permute_load_chain()

static bool vect_shift_permute_load_chain ( vec_info * vinfo,
vec< tree > dr_chain,
unsigned int length,
stmt_vec_info stmt_info,
gimple_stmt_iterator * gsi,
vec< tree > * result_chain )
static
Function vect_shift_permute_load_chain.

  Given a chain of loads in DR_CHAIN of LENGTH 2 or 3, generate
  sequence of stmts to reorder the input data accordingly.
  Return the final references for loads in RESULT_CHAIN.
  Return true if successed, false otherwise.

  E.g., LENGTH is 3 and the scalar type is short, i.e., VF is 8.
  The input is 3 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

  The output sequence should be:

  1st vec:  0 3 6  9 12 15 18 21
  2nd vec:  1 4 7 10 13 16 19 22
  3rd vec:  2 5 8 11 14 17 20 23

  We use 3 shuffle instructions and 3 * 3 - 1 shifts to create such output.

  First we shuffle all 3 vectors to get correct elements order:

  1st vec:  ( 0  3  6) ( 1  4  7) ( 2  5)
  2nd vec:  ( 8 11 14) ( 9 12 15) (10 13)
  3rd vec:  (16 19 22) (17 20 23) (18 21)

  Next we unite and shift vector 3 times:

  1st step:
    shift right by 6 the concatenation of:
    "1st vec" and  "2nd vec"
      ( 0  3  6) ( 1  4  7) |( 2  5) _ ( 8 11 14) ( 9 12 15)| (10 13)
    "2nd vec" and  "3rd vec"
      ( 8 11 14) ( 9 12 15) |(10 13) _ (16 19 22) (17 20 23)| (18 21)
    "3rd vec" and  "1st vec"
      (16 19 22) (17 20 23) |(18 21) _ ( 0  3  6) ( 1  4  7)| ( 2  5)
                     | New vectors                   |

    So that now new vectors are:

    1st vec:  ( 2  5) ( 8 11 14) ( 9 12 15)
    2nd vec:  (10 13) (16 19 22) (17 20 23)
    3rd vec:  (18 21) ( 0  3  6) ( 1  4  7)

  2nd step:
    shift right by 5 the concatenation of:
    "1st vec" and  "3rd vec"
      ( 2  5) ( 8 11 14) |( 9 12 15) _ (18 21) ( 0  3  6)| ( 1  4  7)
    "2nd vec" and  "1st vec"
      (10 13) (16 19 22) |(17 20 23) _ ( 2  5) ( 8 11 14)| ( 9 12 15)
    "3rd vec" and  "2nd vec"
      (18 21) ( 0  3  6) |( 1  4  7) _ (10 13) (16 19 22)| (17 20 23)
                  | New vectors                   |

    So that now new vectors are:

    1st vec:  ( 9 12 15) (18 21) ( 0  3  6)
    2nd vec:  (17 20 23) ( 2  5) ( 8 11 14)
    3rd vec:  ( 1  4  7) (10 13) (16 19 22) READY

  3rd step:
    shift right by 5 the concatenation of:
    "1st vec" and  "1st vec"
      ( 9 12 15) (18 21) |( 0  3  6) _ ( 9 12 15) (18 21)| ( 0  3  6)
    shift right by 3 the concatenation of:
    "2nd vec" and  "2nd vec"
              (17 20 23) |( 2  5) ( 8 11 14) _ (17 20 23)| ( 2  5) ( 8 11 14)
                  | New vectors                   |

    So that now all vectors are READY:
    1st vec:  ( 0  3  6) ( 9 12 15) (18 21)
    2nd vec:  ( 2  5) ( 8 11 14) (17 20 23)
    3rd vec:  ( 1  4  7) (10 13) (16 19 22)

  This algorithm is faster than one in vect_permute_load_chain if:
    1.  "shift of a concatination" is faster than general permutation.
        This is usually so.
    2.  The TARGET machine can't execute vector instructions in parallel.
        This is because each step of the algorithm depends on previous.
        The algorithm in vect_permute_load_chain is much more parallel.

  The algorithm is applicable only for LOAD CHAIN LENGTH less than VF.

References can_vec_perm_const_p(), dump_enabled_p(), dump_printf_loc(), dyn_cast(), exact_log2(), gimple_build_assign(), i, LOOP_VINFO_VECT_FACTOR, make_temp_ssa_name(), MSG_MISSED_OPTIMIZATION, NULL, pow2p_hwi(), STMT_VINFO_VECTYPE, TYPE_MODE, TYPE_VECTOR_SUBPARTS(), vect_finish_stmt_generation(), vect_gen_perm_mask_checked(), and vect_location.

Referenced by vect_transform_grouped_load().

◆ vect_slp_analyze_data_ref_dependence()

static bool vect_slp_analyze_data_ref_dependence ( vec_info * vinfo,
struct data_dependence_relation * ddr )
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 for VINFO.  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_GROUP_FIRST_ELEMENT, DR_IS_READ, DR_REF, dump_enabled_p(), dump_printf_loc(), vec_info::lookup_dr(), MSG_MISSED_OPTIMIZATION, MSG_NOTE, dr_vec_info::stmt, STMT_VINFO_GROUPED_ACCESS, and vect_location.

Referenced by vect_slp_analyze_load_dependences(), and vect_slp_analyze_store_dependences().

◆ vect_slp_analyze_instance_alignment()

bool vect_slp_analyze_instance_alignment ( vec_info * vinfo,
slp_instance instance )
Function vect_slp_analyze_instance_alignment

Analyze the alignment of the data-references in the SLP instance.
Return FALSE if a data reference is found that cannot be vectorized.   

References DUMP_VECT_SCOPE, FOR_EACH_VEC_ELT, i, slp_inst_kind_store, SLP_INSTANCE_KIND, SLP_INSTANCE_LOADS, SLP_INSTANCE_TREE, and vect_slp_analyze_node_alignment().

Referenced by vect_slp_analyze_bb_1().

◆ vect_slp_analyze_instance_dependence()

bool vect_slp_analyze_instance_dependence ( vec_info * vinfo,
slp_instance instance )
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 DUMP_VECT_SCOPE, gimple_set_visited(), NULL, slp_inst_kind_store, SLP_INSTANCE_KIND, SLP_INSTANCE_LOADS, SLP_INSTANCE_TREE, SLP_TREE_SCALAR_STMTS, data_reference::stmt, vect_find_last_scalar_stmt_in_slp(), vect_slp_analyze_load_dependences(), vect_slp_analyze_store_dependences(), and vNULL.

Referenced by vect_slp_analyze_bb_1().

◆ vect_slp_analyze_load_dependences()

◆ vect_slp_analyze_node_alignment()

static bool vect_slp_analyze_node_alignment ( vec_info * vinfo,
slp_tree node )
static

◆ vect_slp_analyze_store_dependences()

◆ vect_small_gap_p()

static bool vect_small_gap_p ( loop_vec_info loop_vinfo,
dr_vec_info * dr_info,
poly_int64 gap )
static
Return true if it's unlikely that the step of the vectorized form of DR_INFO
will span fewer than GAP bytes.   

References count, DR_GROUP_FIRST_ELEMENT, DR_GROUP_SIZE, estimated_poly_value(), LOOP_VINFO_VECT_FACTOR, and vect_get_scalar_dr_size().

Referenced by vect_prune_runtime_alias_test_list().

◆ vect_store_lanes_supported()

internal_fn vect_store_lanes_supported ( tree vectype,
unsigned HOST_WIDE_INT count,
bool masked_p )
Return FN if vec_{mask_,mask_len_}store_lanes is available for COUNT vectors
of type VECTYPE.  MASKED_P says whether the masked form is needed.   

References count, and vect_lanes_optab_supported_p().

Referenced by check_load_store_for_partial_vectors(), get_group_load_store_type(), vect_analyze_loop_2(), vect_analyze_slp(), vect_build_slp_instance(), and vect_slp_prefer_store_lanes_p().

◆ vect_supportable_dr_alignment()

◆ vect_transform_grouped_load()

void vect_transform_grouped_load ( vec_info * vinfo,
stmt_vec_info stmt_info,
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 pow2p_hwi(), STMT_VINFO_VECTYPE, targetm, TYPE_MODE, vect_permute_load_chain(), vect_record_grouped_load_vectors(), vect_shift_permute_load_chain(), and vNULL.

Referenced by vectorizable_load().

◆ vect_update_misalignment_for_peel()

static void vect_update_misalignment_for_peel ( dr_vec_info * dr_info,
dr_vec_info * dr_peel_info,
int npeel )
static
Function vect_update_misalignment_for_peel.
Sets DR_INFO's misalignment
- to 0 if it has the same alignment as DR_PEEL_INFO,
- to the misalignment computed using NPEEL if DR_INFO's salignment is known,
- to -1 (unknown) otherwise.

DR_INFO - the data reference whose misalignment is to be adjusted.
DR_PEEL_INFO - 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_INFO is known at compile time.   

References dr_info::dr, DR_MISALIGNMENT_UNKNOWN, DR_STEP, DR_TARGET_ALIGNMENT, dump_enabled_p(), dump_printf_loc(), known_alignment_for_access_p(), MSG_NOTE, SET_DR_MISALIGNMENT, set_dr_misalignment(), dr_vec_info::stmt, STMT_VINFO_VECTYPE, TREE_INT_CST_LOW, vect_dr_aligned_if_peeled_dr_is(), vect_dr_misalign_for_aligned_access(), and vect_location.

Referenced by vect_enhance_data_refs_alignment().

◆ vect_vfa_access_size()

static unsigned HOST_WIDE_INT vect_vfa_access_size ( vec_info * vinfo,
dr_vec_info * dr_info )
static
Return a value that, when added to abs (vect_vfa_segment_size (DR_INFO)),
gives the worst-case number of bytes covered by the segment.   

References dr_info::dr, dr_explicit_realign_optimized, DR_GROUP_FIRST_ELEMENT, DR_GROUP_GAP, DR_GROUP_SIZE, dr_misalignment(), DR_REF, gcc_assert, STMT_VINFO_VEC_STMTS, STMT_VINFO_VECTYPE, tree_to_uhwi(), TREE_TYPE, TYPE_SIZE_UNIT, and vect_supportable_dr_alignment().

Referenced by vect_prune_runtime_alias_test_list().

◆ vect_vfa_align()

static unsigned int vect_vfa_align ( dr_vec_info * dr_info)
static
Get the minimum alignment for all the scalar accesses that DR_INFO
describes.   

References dr_info::dr, and dr_alignment().

Referenced by vect_prune_runtime_alias_test_list().

◆ vect_vfa_segment_size()

static tree vect_vfa_segment_size ( dr_vec_info * dr_info,
tree length_factor )
static
Function vect_vfa_segment_size.

Input:
  DR_INFO: The data reference.
  LENGTH_FACTOR: segment length to consider.

Return a value suitable for the dr_with_seg_len::seg_len field.
This is the "distance travelled" by the pointer from the first
iteration in the segment to the last.  Note that it does not include
the size of the access; in effect it only describes the first byte.   

References dr_info::dr, DR_STEP, fold_convert, size_binop, size_one_node, and sizetype.

Referenced by vect_prune_runtime_alias_test_list().

◆ vector_alignment_reachable_p()

static bool vector_alignment_reachable_p ( dr_vec_info * dr_info)
static

◆ vectorizable_with_step_bound_p()

static bool vectorizable_with_step_bound_p ( dr_vec_info * dr_info_a,
dr_vec_info * dr_info_b,
poly_uint64 * lower_bound_out )
static
Return true if we know that there is no alias between DR_INFO_A and
DR_INFO_B when abs (DR_STEP (DR_INFO_A->dr)) >= N for some N.
When returning true, set *LOWER_BOUND_OUT to this N.   

References dr_vec_info::dr, DR_BASE_ADDRESS, DR_INIT, DR_OFFSET, DR_STEP, maybe_gt, operand_equal_p(), poly_int_tree_p(), vect_get_scalar_dr_size(), and vect_preserves_scalar_order_p().

Referenced by vect_prune_runtime_alias_test_list().