tree-vectorizer.h 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563
  1. /* Vectorizer
  2. Copyright (C) 2003-2018 Free Software Foundation, Inc.
  3. Contributed by Dorit Naishlos <dorit@il.ibm.com>
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 3, or (at your option) any later
  8. version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_TREE_VECTORIZER_H
  17. #define GCC_TREE_VECTORIZER_H
  18. #include "tree-data-ref.h"
  19. #include "tree-hash-traits.h"
  20. #include "target.h"
  21. /* Used for naming of new temporaries. */
  22. enum vect_var_kind {
  23. vect_simple_var,
  24. vect_pointer_var,
  25. vect_scalar_var,
  26. vect_mask_var
  27. };
  28. /* Defines type of operation. */
  29. enum operation_type {
  30. unary_op = 1,
  31. binary_op,
  32. ternary_op
  33. };
  34. /* Define type of available alignment support. */
  35. enum dr_alignment_support {
  36. dr_unaligned_unsupported,
  37. dr_unaligned_supported,
  38. dr_explicit_realign,
  39. dr_explicit_realign_optimized,
  40. dr_aligned
  41. };
  42. /* Define type of def-use cross-iteration cycle. */
  43. enum vect_def_type {
  44. vect_uninitialized_def = 0,
  45. vect_constant_def = 1,
  46. vect_external_def,
  47. vect_internal_def,
  48. vect_induction_def,
  49. vect_reduction_def,
  50. vect_double_reduction_def,
  51. vect_nested_cycle,
  52. vect_unknown_def_type
  53. };
  54. /* Define type of reduction. */
  55. enum vect_reduction_type {
  56. TREE_CODE_REDUCTION,
  57. COND_REDUCTION,
  58. INTEGER_INDUC_COND_REDUCTION,
  59. CONST_COND_REDUCTION,
  60. /* Retain a scalar phi and use a FOLD_EXTRACT_LAST within the loop
  61. to implement:
  62. for (int i = 0; i < VF; ++i)
  63. res = cond[i] ? val[i] : res; */
  64. EXTRACT_LAST_REDUCTION,
  65. /* Use a folding reduction within the loop to implement:
  66. for (int i = 0; i < VF; ++i)
  67. res = res OP val[i];
  68. (with no reassocation). */
  69. FOLD_LEFT_REDUCTION
  70. };
  71. #define VECTORIZABLE_CYCLE_DEF(D) (((D) == vect_reduction_def) \
  72. || ((D) == vect_double_reduction_def) \
  73. || ((D) == vect_nested_cycle))
  74. /* Structure to encapsulate information about a group of like
  75. instructions to be presented to the target cost model. */
  76. struct stmt_info_for_cost {
  77. int count;
  78. enum vect_cost_for_stmt kind;
  79. gimple *stmt;
  80. int misalign;
  81. };
  82. typedef vec<stmt_info_for_cost> stmt_vector_for_cost;
  83. /* Maps base addresses to an innermost_loop_behavior that gives the maximum
  84. known alignment for that base. */
  85. typedef hash_map<tree_operand_hash,
  86. innermost_loop_behavior *> vec_base_alignments;
  87. /************************************************************************
  88. SLP
  89. ************************************************************************/
  90. typedef struct _slp_tree *slp_tree;
  91. /* A computation tree of an SLP instance. Each node corresponds to a group of
  92. stmts to be packed in a SIMD stmt. */
  93. struct _slp_tree {
  94. /* Nodes that contain def-stmts of this node statements operands. */
  95. vec<slp_tree> children;
  96. /* A group of scalar stmts to be vectorized together. */
  97. vec<gimple *> stmts;
  98. /* Load permutation relative to the stores, NULL if there is no
  99. permutation. */
  100. vec<unsigned> load_permutation;
  101. /* Vectorized stmt/s. */
  102. vec<gimple *> vec_stmts;
  103. /* Number of vector stmts that are created to replace the group of scalar
  104. stmts. It is calculated during the transformation phase as the number of
  105. scalar elements in one scalar iteration (GROUP_SIZE) multiplied by VF
  106. divided by vector size. */
  107. unsigned int vec_stmts_size;
  108. /* Whether the scalar computations use two different operators. */
  109. bool two_operators;
  110. /* The DEF type of this node. */
  111. enum vect_def_type def_type;
  112. };
  113. /* SLP instance is a sequence of stmts in a loop that can be packed into
  114. SIMD stmts. */
  115. typedef struct _slp_instance {
  116. /* The root of SLP tree. */
  117. slp_tree root;
  118. /* Size of groups of scalar stmts that will be replaced by SIMD stmt/s. */
  119. unsigned int group_size;
  120. /* The unrolling factor required to vectorized this SLP instance. */
  121. poly_uint64 unrolling_factor;
  122. /* The group of nodes that contain loads of this SLP instance. */
  123. vec<slp_tree> loads;
  124. /* The SLP node containing the reduction PHIs. */
  125. slp_tree reduc_phis;
  126. } *slp_instance;
  127. /* Access Functions. */
  128. #define SLP_INSTANCE_TREE(S) (S)->root
  129. #define SLP_INSTANCE_GROUP_SIZE(S) (S)->group_size
  130. #define SLP_INSTANCE_UNROLLING_FACTOR(S) (S)->unrolling_factor
  131. #define SLP_INSTANCE_LOADS(S) (S)->loads
  132. #define SLP_TREE_CHILDREN(S) (S)->children
  133. #define SLP_TREE_SCALAR_STMTS(S) (S)->stmts
  134. #define SLP_TREE_VEC_STMTS(S) (S)->vec_stmts
  135. #define SLP_TREE_NUMBER_OF_VEC_STMTS(S) (S)->vec_stmts_size
  136. #define SLP_TREE_LOAD_PERMUTATION(S) (S)->load_permutation
  137. #define SLP_TREE_TWO_OPERATORS(S) (S)->two_operators
  138. #define SLP_TREE_DEF_TYPE(S) (S)->def_type
  139. /* Describes two objects whose addresses must be unequal for the vectorized
  140. loop to be valid. */
  141. typedef std::pair<tree, tree> vec_object_pair;
  142. /* Records that vectorization is only possible if abs (EXPR) >= MIN_VALUE.
  143. UNSIGNED_P is true if we can assume that abs (EXPR) == EXPR. */
  144. struct vec_lower_bound {
  145. vec_lower_bound () {}
  146. vec_lower_bound (tree e, bool u, poly_uint64 m)
  147. : expr (e), unsigned_p (u), min_value (m) {}
  148. tree expr;
  149. bool unsigned_p;
  150. poly_uint64 min_value;
  151. };
  152. /* Vectorizer state common between loop and basic-block vectorization. */
  153. struct vec_info {
  154. enum vec_kind { bb, loop };
  155. vec_info (vec_kind, void *);
  156. ~vec_info ();
  157. /* The type of vectorization. */
  158. vec_kind kind;
  159. /* All SLP instances. */
  160. auto_vec<slp_instance> slp_instances;
  161. /* All data references. Freed by free_data_refs, so not an auto_vec. */
  162. vec<data_reference_p> datarefs;
  163. /* Maps base addresses to an innermost_loop_behavior that gives the maximum
  164. known alignment for that base. */
  165. vec_base_alignments base_alignments;
  166. /* All data dependences. Freed by free_dependence_relations, so not
  167. an auto_vec. */
  168. vec<ddr_p> ddrs;
  169. /* All interleaving chains of stores, represented by the first
  170. stmt in the chain. */
  171. auto_vec<gimple *> grouped_stores;
  172. /* Cost data used by the target cost model. */
  173. void *target_cost_data;
  174. };
  175. struct _loop_vec_info;
  176. struct _bb_vec_info;
  177. template<>
  178. template<>
  179. inline bool
  180. is_a_helper <_loop_vec_info *>::test (vec_info *i)
  181. {
  182. return i->kind == vec_info::loop;
  183. }
  184. template<>
  185. template<>
  186. inline bool
  187. is_a_helper <_bb_vec_info *>::test (vec_info *i)
  188. {
  189. return i->kind == vec_info::bb;
  190. }
  191. /* In general, we can divide the vector statements in a vectorized loop
  192. into related groups ("rgroups") and say that for each rgroup there is
  193. some nS such that the rgroup operates on nS values from one scalar
  194. iteration followed by nS values from the next. That is, if VF is the
  195. vectorization factor of the loop, the rgroup operates on a sequence:
  196. (1,1) (1,2) ... (1,nS) (2,1) ... (2,nS) ... (VF,1) ... (VF,nS)
  197. where (i,j) represents a scalar value with index j in a scalar
  198. iteration with index i.
  199. [ We use the term "rgroup" to emphasise that this grouping isn't
  200. necessarily the same as the grouping of statements used elsewhere.
  201. For example, if we implement a group of scalar loads using gather
  202. loads, we'll use a separate gather load for each scalar load, and
  203. thus each gather load will belong to its own rgroup. ]
  204. In general this sequence will occupy nV vectors concatenated
  205. together. If these vectors have nL lanes each, the total number
  206. of scalar values N is given by:
  207. N = nS * VF = nV * nL
  208. None of nS, VF, nV and nL are required to be a power of 2. nS and nV
  209. are compile-time constants but VF and nL can be variable (if the target
  210. supports variable-length vectors).
  211. In classical vectorization, each iteration of the vector loop would
  212. handle exactly VF iterations of the original scalar loop. However,
  213. in a fully-masked loop, a particular iteration of the vector loop
  214. might handle fewer than VF iterations of the scalar loop. The vector
  215. lanes that correspond to iterations of the scalar loop are said to be
  216. "active" and the other lanes are said to be "inactive".
  217. In a fully-masked loop, many rgroups need to be masked to ensure that
  218. they have no effect for the inactive lanes. Each such rgroup needs a
  219. sequence of booleans in the same order as above, but with each (i,j)
  220. replaced by a boolean that indicates whether iteration i is active.
  221. This sequence occupies nV vector masks that again have nL lanes each.
  222. Thus the mask sequence as a whole consists of VF independent booleans
  223. that are each repeated nS times.
  224. We make the simplifying assumption that if a sequence of nV masks is
  225. suitable for one (nS,nL) pair, we can reuse it for (nS/2,nL/2) by
  226. VIEW_CONVERTing it. This holds for all current targets that support
  227. fully-masked loops. For example, suppose the scalar loop is:
  228. float *f;
  229. double *d;
  230. for (int i = 0; i < n; ++i)
  231. {
  232. f[i * 2 + 0] += 1.0f;
  233. f[i * 2 + 1] += 2.0f;
  234. d[i] += 3.0;
  235. }
  236. and suppose that vectors have 256 bits. The vectorized f accesses
  237. will belong to one rgroup and the vectorized d access to another:
  238. f rgroup: nS = 2, nV = 1, nL = 8
  239. d rgroup: nS = 1, nV = 1, nL = 4
  240. VF = 4
  241. [ In this simple example the rgroups do correspond to the normal
  242. SLP grouping scheme. ]
  243. If only the first three lanes are active, the masks we need are:
  244. f rgroup: 1 1 | 1 1 | 1 1 | 0 0
  245. d rgroup: 1 | 1 | 1 | 0
  246. Here we can use a mask calculated for f's rgroup for d's, but not
  247. vice versa.
  248. Thus for each value of nV, it is enough to provide nV masks, with the
  249. mask being calculated based on the highest nL (or, equivalently, based
  250. on the highest nS) required by any rgroup with that nV. We therefore
  251. represent the entire collection of masks as a two-level table, with the
  252. first level being indexed by nV - 1 (since nV == 0 doesn't exist) and
  253. the second being indexed by the mask index 0 <= i < nV. */
  254. /* The masks needed by rgroups with nV vectors, according to the
  255. description above. */
  256. struct rgroup_masks {
  257. /* The largest nS for all rgroups that use these masks. */
  258. unsigned int max_nscalars_per_iter;
  259. /* The type of mask to use, based on the highest nS recorded above. */
  260. tree mask_type;
  261. /* A vector of nV masks, in iteration order. */
  262. vec<tree> masks;
  263. };
  264. typedef auto_vec<rgroup_masks> vec_loop_masks;
  265. /*-----------------------------------------------------------------*/
  266. /* Info on vectorized loops. */
  267. /*-----------------------------------------------------------------*/
  268. typedef struct _loop_vec_info : public vec_info {
  269. _loop_vec_info (struct loop *);
  270. ~_loop_vec_info ();
  271. /* The loop to which this info struct refers to. */
  272. struct loop *loop;
  273. /* The loop basic blocks. */
  274. basic_block *bbs;
  275. /* Number of latch executions. */
  276. tree num_itersm1;
  277. /* Number of iterations. */
  278. tree num_iters;
  279. /* Number of iterations of the original loop. */
  280. tree num_iters_unchanged;
  281. /* Condition under which this loop is analyzed and versioned. */
  282. tree num_iters_assumptions;
  283. /* Threshold of number of iterations below which vectorzation will not be
  284. performed. It is calculated from MIN_PROFITABLE_ITERS and
  285. PARAM_MIN_VECT_LOOP_BOUND. */
  286. unsigned int th;
  287. /* When applying loop versioning, the vector form should only be used
  288. if the number of scalar iterations is >= this value, on top of all
  289. the other requirements. Ignored when loop versioning is not being
  290. used. */
  291. poly_uint64 versioning_threshold;
  292. /* Unrolling factor */
  293. poly_uint64 vectorization_factor;
  294. /* Maximum runtime vectorization factor, or MAX_VECTORIZATION_FACTOR
  295. if there is no particular limit. */
  296. unsigned HOST_WIDE_INT max_vectorization_factor;
  297. /* The masks that a fully-masked loop should use to avoid operating
  298. on inactive scalars. */
  299. vec_loop_masks masks;
  300. /* If we are using a loop mask to align memory addresses, this variable
  301. contains the number of vector elements that we should skip in the
  302. first iteration of the vector loop (i.e. the number of leading
  303. elements that should be false in the first mask). */
  304. tree mask_skip_niters;
  305. /* Type of the variables to use in the WHILE_ULT call for fully-masked
  306. loops. */
  307. tree mask_compare_type;
  308. /* Unknown DRs according to which loop was peeled. */
  309. struct data_reference *unaligned_dr;
  310. /* peeling_for_alignment indicates whether peeling for alignment will take
  311. place, and what the peeling factor should be:
  312. peeling_for_alignment = X means:
  313. If X=0: Peeling for alignment will not be applied.
  314. If X>0: Peel first X iterations.
  315. If X=-1: Generate a runtime test to calculate the number of iterations
  316. to be peeled, using the dataref recorded in the field
  317. unaligned_dr. */
  318. int peeling_for_alignment;
  319. /* The mask used to check the alignment of pointers or arrays. */
  320. int ptr_mask;
  321. /* The loop nest in which the data dependences are computed. */
  322. auto_vec<loop_p> loop_nest;
  323. /* Data Dependence Relations defining address ranges that are candidates
  324. for a run-time aliasing check. */
  325. auto_vec<ddr_p> may_alias_ddrs;
  326. /* Data Dependence Relations defining address ranges together with segment
  327. lengths from which the run-time aliasing check is built. */
  328. auto_vec<dr_with_seg_len_pair_t> comp_alias_ddrs;
  329. /* Check that the addresses of each pair of objects is unequal. */
  330. auto_vec<vec_object_pair> check_unequal_addrs;
  331. /* List of values that are required to be nonzero. This is used to check
  332. whether things like "x[i * n] += 1;" are safe and eventually gets added
  333. to the checks for lower bounds below. */
  334. auto_vec<tree> check_nonzero;
  335. /* List of values that need to be checked for a minimum value. */
  336. auto_vec<vec_lower_bound> lower_bounds;
  337. /* Statements in the loop that have data references that are candidates for a
  338. runtime (loop versioning) misalignment check. */
  339. auto_vec<gimple *> may_misalign_stmts;
  340. /* Reduction cycles detected in the loop. Used in loop-aware SLP. */
  341. auto_vec<gimple *> reductions;
  342. /* All reduction chains in the loop, represented by the first
  343. stmt in the chain. */
  344. auto_vec<gimple *> reduction_chains;
  345. /* Cost vector for a single scalar iteration. */
  346. auto_vec<stmt_info_for_cost> scalar_cost_vec;
  347. /* Map of IV base/step expressions to inserted name in the preheader. */
  348. hash_map<tree_operand_hash, tree> *ivexpr_map;
  349. /* The unrolling factor needed to SLP the loop. In case of that pure SLP is
  350. applied to the loop, i.e., no unrolling is needed, this is 1. */
  351. poly_uint64 slp_unrolling_factor;
  352. /* Cost of a single scalar iteration. */
  353. int single_scalar_iteration_cost;
  354. /* Is the loop vectorizable? */
  355. bool vectorizable;
  356. /* Records whether we still have the option of using a fully-masked loop. */
  357. bool can_fully_mask_p;
  358. /* True if have decided to use a fully-masked loop. */
  359. bool fully_masked_p;
  360. /* When we have grouped data accesses with gaps, we may introduce invalid
  361. memory accesses. We peel the last iteration of the loop to prevent
  362. this. */
  363. bool peeling_for_gaps;
  364. /* When the number of iterations is not a multiple of the vector size
  365. we need to peel off iterations at the end to form an epilogue loop. */
  366. bool peeling_for_niter;
  367. /* Reductions are canonicalized so that the last operand is the reduction
  368. operand. If this places a constant into RHS1, this decanonicalizes
  369. GIMPLE for other phases, so we must track when this has occurred and
  370. fix it up. */
  371. bool operands_swapped;
  372. /* True if there are no loop carried data dependencies in the loop.
  373. If loop->safelen <= 1, then this is always true, either the loop
  374. didn't have any loop carried data dependencies, or the loop is being
  375. vectorized guarded with some runtime alias checks, or couldn't
  376. be vectorized at all, but then this field shouldn't be used.
  377. For loop->safelen >= 2, the user has asserted that there are no
  378. backward dependencies, but there still could be loop carried forward
  379. dependencies in such loops. This flag will be false if normal
  380. vectorizer data dependency analysis would fail or require versioning
  381. for alias, but because of loop->safelen >= 2 it has been vectorized
  382. even without versioning for alias. E.g. in:
  383. #pragma omp simd
  384. for (int i = 0; i < m; i++)
  385. a[i] = a[i + k] * c;
  386. (or #pragma simd or #pragma ivdep) we can vectorize this and it will
  387. DTRT even for k > 0 && k < m, but without safelen we would not
  388. vectorize this, so this field would be false. */
  389. bool no_data_dependencies;
  390. /* Mark loops having masked stores. */
  391. bool has_mask_store;
  392. /* If if-conversion versioned this loop before conversion, this is the
  393. loop version without if-conversion. */
  394. struct loop *scalar_loop;
  395. /* For loops being epilogues of already vectorized loops
  396. this points to the original vectorized loop. Otherwise NULL. */
  397. _loop_vec_info *orig_loop_info;
  398. } *loop_vec_info;
  399. /* Access Functions. */
  400. #define LOOP_VINFO_LOOP(L) (L)->loop
  401. #define LOOP_VINFO_BBS(L) (L)->bbs
  402. #define LOOP_VINFO_NITERSM1(L) (L)->num_itersm1
  403. #define LOOP_VINFO_NITERS(L) (L)->num_iters
  404. /* Since LOOP_VINFO_NITERS and LOOP_VINFO_NITERSM1 can change after
  405. prologue peeling retain total unchanged scalar loop iterations for
  406. cost model. */
  407. #define LOOP_VINFO_NITERS_UNCHANGED(L) (L)->num_iters_unchanged
  408. #define LOOP_VINFO_NITERS_ASSUMPTIONS(L) (L)->num_iters_assumptions
  409. #define LOOP_VINFO_COST_MODEL_THRESHOLD(L) (L)->th
  410. #define LOOP_VINFO_VERSIONING_THRESHOLD(L) (L)->versioning_threshold
  411. #define LOOP_VINFO_VECTORIZABLE_P(L) (L)->vectorizable
  412. #define LOOP_VINFO_CAN_FULLY_MASK_P(L) (L)->can_fully_mask_p
  413. #define LOOP_VINFO_FULLY_MASKED_P(L) (L)->fully_masked_p
  414. #define LOOP_VINFO_VECT_FACTOR(L) (L)->vectorization_factor
  415. #define LOOP_VINFO_MAX_VECT_FACTOR(L) (L)->max_vectorization_factor
  416. #define LOOP_VINFO_MASKS(L) (L)->masks
  417. #define LOOP_VINFO_MASK_SKIP_NITERS(L) (L)->mask_skip_niters
  418. #define LOOP_VINFO_MASK_COMPARE_TYPE(L) (L)->mask_compare_type
  419. #define LOOP_VINFO_PTR_MASK(L) (L)->ptr_mask
  420. #define LOOP_VINFO_LOOP_NEST(L) (L)->loop_nest
  421. #define LOOP_VINFO_DATAREFS(L) (L)->datarefs
  422. #define LOOP_VINFO_DDRS(L) (L)->ddrs
  423. #define LOOP_VINFO_INT_NITERS(L) (TREE_INT_CST_LOW ((L)->num_iters))
  424. #define LOOP_VINFO_PEELING_FOR_ALIGNMENT(L) (L)->peeling_for_alignment
  425. #define LOOP_VINFO_UNALIGNED_DR(L) (L)->unaligned_dr
  426. #define LOOP_VINFO_MAY_MISALIGN_STMTS(L) (L)->may_misalign_stmts
  427. #define LOOP_VINFO_MAY_ALIAS_DDRS(L) (L)->may_alias_ddrs
  428. #define LOOP_VINFO_COMP_ALIAS_DDRS(L) (L)->comp_alias_ddrs
  429. #define LOOP_VINFO_CHECK_UNEQUAL_ADDRS(L) (L)->check_unequal_addrs
  430. #define LOOP_VINFO_CHECK_NONZERO(L) (L)->check_nonzero
  431. #define LOOP_VINFO_LOWER_BOUNDS(L) (L)->lower_bounds
  432. #define LOOP_VINFO_GROUPED_STORES(L) (L)->grouped_stores
  433. #define LOOP_VINFO_SLP_INSTANCES(L) (L)->slp_instances
  434. #define LOOP_VINFO_SLP_UNROLLING_FACTOR(L) (L)->slp_unrolling_factor
  435. #define LOOP_VINFO_REDUCTIONS(L) (L)->reductions
  436. #define LOOP_VINFO_REDUCTION_CHAINS(L) (L)->reduction_chains
  437. #define LOOP_VINFO_TARGET_COST_DATA(L) (L)->target_cost_data
  438. #define LOOP_VINFO_PEELING_FOR_GAPS(L) (L)->peeling_for_gaps
  439. #define LOOP_VINFO_OPERANDS_SWAPPED(L) (L)->operands_swapped
  440. #define LOOP_VINFO_PEELING_FOR_NITER(L) (L)->peeling_for_niter
  441. #define LOOP_VINFO_NO_DATA_DEPENDENCIES(L) (L)->no_data_dependencies
  442. #define LOOP_VINFO_SCALAR_LOOP(L) (L)->scalar_loop
  443. #define LOOP_VINFO_HAS_MASK_STORE(L) (L)->has_mask_store
  444. #define LOOP_VINFO_SCALAR_ITERATION_COST(L) (L)->scalar_cost_vec
  445. #define LOOP_VINFO_SINGLE_SCALAR_ITERATION_COST(L) (L)->single_scalar_iteration_cost
  446. #define LOOP_VINFO_ORIG_LOOP_INFO(L) (L)->orig_loop_info
  447. #define LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT(L) \
  448. ((L)->may_misalign_stmts.length () > 0)
  449. #define LOOP_REQUIRES_VERSIONING_FOR_ALIAS(L) \
  450. ((L)->comp_alias_ddrs.length () > 0 \
  451. || (L)->check_unequal_addrs.length () > 0 \
  452. || (L)->lower_bounds.length () > 0)
  453. #define LOOP_REQUIRES_VERSIONING_FOR_NITERS(L) \
  454. (LOOP_VINFO_NITERS_ASSUMPTIONS (L))
  455. #define LOOP_REQUIRES_VERSIONING(L) \
  456. (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (L) \
  457. || LOOP_REQUIRES_VERSIONING_FOR_ALIAS (L) \
  458. || LOOP_REQUIRES_VERSIONING_FOR_NITERS (L))
  459. #define LOOP_VINFO_NITERS_KNOWN_P(L) \
  460. (tree_fits_shwi_p ((L)->num_iters) && tree_to_shwi ((L)->num_iters) > 0)
  461. #define LOOP_VINFO_EPILOGUE_P(L) \
  462. (LOOP_VINFO_ORIG_LOOP_INFO (L) != NULL)
  463. #define LOOP_VINFO_ORIG_MAX_VECT_FACTOR(L) \
  464. (LOOP_VINFO_MAX_VECT_FACTOR (LOOP_VINFO_ORIG_LOOP_INFO (L)))
  465. static inline loop_vec_info
  466. loop_vec_info_for_loop (struct loop *loop)
  467. {
  468. return (loop_vec_info) loop->aux;
  469. }
  470. static inline bool
  471. nested_in_vect_loop_p (struct loop *loop, gimple *stmt)
  472. {
  473. return (loop->inner
  474. && (loop->inner == (gimple_bb (stmt))->loop_father));
  475. }
  476. typedef struct _bb_vec_info : public vec_info
  477. {
  478. _bb_vec_info (gimple_stmt_iterator, gimple_stmt_iterator);
  479. ~_bb_vec_info ();
  480. basic_block bb;
  481. gimple_stmt_iterator region_begin;
  482. gimple_stmt_iterator region_end;
  483. } *bb_vec_info;
  484. #define BB_VINFO_BB(B) (B)->bb
  485. #define BB_VINFO_GROUPED_STORES(B) (B)->grouped_stores
  486. #define BB_VINFO_SLP_INSTANCES(B) (B)->slp_instances
  487. #define BB_VINFO_DATAREFS(B) (B)->datarefs
  488. #define BB_VINFO_DDRS(B) (B)->ddrs
  489. #define BB_VINFO_TARGET_COST_DATA(B) (B)->target_cost_data
  490. static inline bb_vec_info
  491. vec_info_for_bb (basic_block bb)
  492. {
  493. return (bb_vec_info) bb->aux;
  494. }
  495. /*-----------------------------------------------------------------*/
  496. /* Info on vectorized defs. */
  497. /*-----------------------------------------------------------------*/
  498. enum stmt_vec_info_type {
  499. undef_vec_info_type = 0,
  500. load_vec_info_type,
  501. store_vec_info_type,
  502. shift_vec_info_type,
  503. op_vec_info_type,
  504. call_vec_info_type,
  505. call_simd_clone_vec_info_type,
  506. assignment_vec_info_type,
  507. condition_vec_info_type,
  508. comparison_vec_info_type,
  509. reduc_vec_info_type,
  510. induc_vec_info_type,
  511. type_promotion_vec_info_type,
  512. type_demotion_vec_info_type,
  513. type_conversion_vec_info_type,
  514. loop_exit_ctrl_vec_info_type
  515. };
  516. /* Indicates whether/how a variable is used in the scope of loop/basic
  517. block. */
  518. enum vect_relevant {
  519. vect_unused_in_scope = 0,
  520. /* The def is only used outside the loop. */
  521. vect_used_only_live,
  522. /* The def is in the inner loop, and the use is in the outer loop, and the
  523. use is a reduction stmt. */
  524. vect_used_in_outer_by_reduction,
  525. /* The def is in the inner loop, and the use is in the outer loop (and is
  526. not part of reduction). */
  527. vect_used_in_outer,
  528. /* defs that feed computations that end up (only) in a reduction. These
  529. defs may be used by non-reduction stmts, but eventually, any
  530. computations/values that are affected by these defs are used to compute
  531. a reduction (i.e. don't get stored to memory, for example). We use this
  532. to identify computations that we can change the order in which they are
  533. computed. */
  534. vect_used_by_reduction,
  535. vect_used_in_scope
  536. };
  537. /* The type of vectorization that can be applied to the stmt: regular loop-based
  538. vectorization; pure SLP - the stmt is a part of SLP instances and does not
  539. have uses outside SLP instances; or hybrid SLP and loop-based - the stmt is
  540. a part of SLP instance and also must be loop-based vectorized, since it has
  541. uses outside SLP sequences.
  542. In the loop context the meanings of pure and hybrid SLP are slightly
  543. different. By saying that pure SLP is applied to the loop, we mean that we
  544. exploit only intra-iteration parallelism in the loop; i.e., the loop can be
  545. vectorized without doing any conceptual unrolling, cause we don't pack
  546. together stmts from different iterations, only within a single iteration.
  547. Loop hybrid SLP means that we exploit both intra-iteration and
  548. inter-iteration parallelism (e.g., number of elements in the vector is 4
  549. and the slp-group-size is 2, in which case we don't have enough parallelism
  550. within an iteration, so we obtain the rest of the parallelism from subsequent
  551. iterations by unrolling the loop by 2). */
  552. enum slp_vect_type {
  553. loop_vect = 0,
  554. pure_slp,
  555. hybrid
  556. };
  557. /* Says whether a statement is a load, a store of a vectorized statement
  558. result, or a store of an invariant value. */
  559. enum vec_load_store_type {
  560. VLS_LOAD,
  561. VLS_STORE,
  562. VLS_STORE_INVARIANT
  563. };
  564. /* Describes how we're going to vectorize an individual load or store,
  565. or a group of loads or stores. */
  566. enum vect_memory_access_type {
  567. /* An access to an invariant address. This is used only for loads. */
  568. VMAT_INVARIANT,
  569. /* A simple contiguous access. */
  570. VMAT_CONTIGUOUS,
  571. /* A contiguous access that goes down in memory rather than up,
  572. with no additional permutation. This is used only for stores
  573. of invariants. */
  574. VMAT_CONTIGUOUS_DOWN,
  575. /* A simple contiguous access in which the elements need to be permuted
  576. after loading or before storing. Only used for loop vectorization;
  577. SLP uses separate permutes. */
  578. VMAT_CONTIGUOUS_PERMUTE,
  579. /* A simple contiguous access in which the elements need to be reversed
  580. after loading or before storing. */
  581. VMAT_CONTIGUOUS_REVERSE,
  582. /* An access that uses IFN_LOAD_LANES or IFN_STORE_LANES. */
  583. VMAT_LOAD_STORE_LANES,
  584. /* An access in which each scalar element is loaded or stored
  585. individually. */
  586. VMAT_ELEMENTWISE,
  587. /* A hybrid of VMAT_CONTIGUOUS and VMAT_ELEMENTWISE, used for grouped
  588. SLP accesses. Each unrolled iteration uses a contiguous load
  589. or store for the whole group, but the groups from separate iterations
  590. are combined in the same way as for VMAT_ELEMENTWISE. */
  591. VMAT_STRIDED_SLP,
  592. /* The access uses gather loads or scatter stores. */
  593. VMAT_GATHER_SCATTER
  594. };
  595. typedef struct data_reference *dr_p;
  596. typedef struct _stmt_vec_info {
  597. enum stmt_vec_info_type type;
  598. /* Indicates whether this stmts is part of a computation whose result is
  599. used outside the loop. */
  600. bool live;
  601. /* Stmt is part of some pattern (computation idiom) */
  602. bool in_pattern_p;
  603. /* Is this statement vectorizable or should it be skipped in (partial)
  604. vectorization. */
  605. bool vectorizable;
  606. /* The stmt to which this info struct refers to. */
  607. gimple *stmt;
  608. /* The vec_info with respect to which STMT is vectorized. */
  609. vec_info *vinfo;
  610. /* The vector type to be used for the LHS of this statement. */
  611. tree vectype;
  612. /* The vectorized version of the stmt. */
  613. gimple *vectorized_stmt;
  614. /* The following is relevant only for stmts that contain a non-scalar
  615. data-ref (array/pointer/struct access). A GIMPLE stmt is expected to have
  616. at most one such data-ref. */
  617. /* Information about the data-ref (access function, etc),
  618. relative to the inner-most containing loop. */
  619. struct data_reference *data_ref_info;
  620. /* Information about the data-ref relative to this loop
  621. nest (the loop that is being considered for vectorization). */
  622. innermost_loop_behavior dr_wrt_vec_loop;
  623. /* For loop PHI nodes, the base and evolution part of it. This makes sure
  624. this information is still available in vect_update_ivs_after_vectorizer
  625. where we may not be able to re-analyze the PHI nodes evolution as
  626. peeling for the prologue loop can make it unanalyzable. The evolution
  627. part is still correct after peeling, but the base may have changed from
  628. the version here. */
  629. tree loop_phi_evolution_base_unchanged;
  630. tree loop_phi_evolution_part;
  631. /* Used for various bookkeeping purposes, generally holding a pointer to
  632. some other stmt S that is in some way "related" to this stmt.
  633. Current use of this field is:
  634. If this stmt is part of a pattern (i.e. the field 'in_pattern_p' is
  635. true): S is the "pattern stmt" that represents (and replaces) the
  636. sequence of stmts that constitutes the pattern. Similarly, the
  637. related_stmt of the "pattern stmt" points back to this stmt (which is
  638. the last stmt in the original sequence of stmts that constitutes the
  639. pattern). */
  640. gimple *related_stmt;
  641. /* Used to keep a sequence of def stmts of a pattern stmt if such exists. */
  642. gimple_seq pattern_def_seq;
  643. /* List of datarefs that are known to have the same alignment as the dataref
  644. of this stmt. */
  645. vec<dr_p> same_align_refs;
  646. /* Selected SIMD clone's function info. First vector element
  647. is SIMD clone's function decl, followed by a pair of trees (base + step)
  648. for linear arguments (pair of NULLs for other arguments). */
  649. vec<tree> simd_clone_info;
  650. /* Classify the def of this stmt. */
  651. enum vect_def_type def_type;
  652. /* Whether the stmt is SLPed, loop-based vectorized, or both. */
  653. enum slp_vect_type slp_type;
  654. /* Interleaving and reduction chains info. */
  655. /* First element in the group. */
  656. gimple *first_element;
  657. /* Pointer to the next element in the group. */
  658. gimple *next_element;
  659. /* For data-refs, in case that two or more stmts share data-ref, this is the
  660. pointer to the previously detected stmt with the same dr. */
  661. gimple *same_dr_stmt;
  662. /* The size of the group. */
  663. unsigned int size;
  664. /* For stores, number of stores from this group seen. We vectorize the last
  665. one. */
  666. unsigned int store_count;
  667. /* For loads only, the gap from the previous load. For consecutive loads, GAP
  668. is 1. */
  669. unsigned int gap;
  670. /* The minimum negative dependence distance this stmt participates in
  671. or zero if none. */
  672. unsigned int min_neg_dist;
  673. /* Not all stmts in the loop need to be vectorized. e.g, the increment
  674. of the loop induction variable and computation of array indexes. relevant
  675. indicates whether the stmt needs to be vectorized. */
  676. enum vect_relevant relevant;
  677. /* For loads if this is a gather, for stores if this is a scatter. */
  678. bool gather_scatter_p;
  679. /* True if this is an access with loop-invariant stride. */
  680. bool strided_p;
  681. /* For both loads and stores. */
  682. bool simd_lane_access_p;
  683. /* Classifies how the load or store is going to be implemented
  684. for loop vectorization. */
  685. vect_memory_access_type memory_access_type;
  686. /* For reduction loops, this is the type of reduction. */
  687. enum vect_reduction_type v_reduc_type;
  688. /* For CONST_COND_REDUCTION, record the reduc code. */
  689. enum tree_code const_cond_reduc_code;
  690. /* On a reduction PHI the reduction type as detected by
  691. vect_force_simple_reduction. */
  692. enum vect_reduction_type reduc_type;
  693. /* On a reduction PHI the def returned by vect_force_simple_reduction.
  694. On the def returned by vect_force_simple_reduction the
  695. corresponding PHI. */
  696. gimple *reduc_def;
  697. /* The number of scalar stmt references from active SLP instances. */
  698. unsigned int num_slp_uses;
  699. } *stmt_vec_info;
  700. /* Information about a gather/scatter call. */
  701. struct gather_scatter_info {
  702. /* The internal function to use for the gather/scatter operation,
  703. or IFN_LAST if a built-in function should be used instead. */
  704. internal_fn ifn;
  705. /* The FUNCTION_DECL for the built-in gather/scatter function,
  706. or null if an internal function should be used instead. */
  707. tree decl;
  708. /* The loop-invariant base value. */
  709. tree base;
  710. /* The original scalar offset, which is a non-loop-invariant SSA_NAME. */
  711. tree offset;
  712. /* Each offset element should be multiplied by this amount before
  713. being added to the base. */
  714. int scale;
  715. /* The definition type for the vectorized offset. */
  716. enum vect_def_type offset_dt;
  717. /* The type of the vectorized offset. */
  718. tree offset_vectype;
  719. /* The type of the scalar elements after loading or before storing. */
  720. tree element_type;
  721. /* The type of the scalar elements being loaded or stored. */
  722. tree memory_type;
  723. };
  724. /* Access Functions. */
  725. #define STMT_VINFO_TYPE(S) (S)->type
  726. #define STMT_VINFO_STMT(S) (S)->stmt
  727. inline loop_vec_info
  728. STMT_VINFO_LOOP_VINFO (stmt_vec_info stmt_vinfo)
  729. {
  730. if (loop_vec_info loop_vinfo = dyn_cast <loop_vec_info> (stmt_vinfo->vinfo))
  731. return loop_vinfo;
  732. return NULL;
  733. }
  734. inline bb_vec_info
  735. STMT_VINFO_BB_VINFO (stmt_vec_info stmt_vinfo)
  736. {
  737. if (bb_vec_info bb_vinfo = dyn_cast <bb_vec_info> (stmt_vinfo->vinfo))
  738. return bb_vinfo;
  739. return NULL;
  740. }
  741. #define STMT_VINFO_RELEVANT(S) (S)->relevant
  742. #define STMT_VINFO_LIVE_P(S) (S)->live
  743. #define STMT_VINFO_VECTYPE(S) (S)->vectype
  744. #define STMT_VINFO_VEC_STMT(S) (S)->vectorized_stmt
  745. #define STMT_VINFO_VECTORIZABLE(S) (S)->vectorizable
  746. #define STMT_VINFO_DATA_REF(S) (S)->data_ref_info
  747. #define STMT_VINFO_GATHER_SCATTER_P(S) (S)->gather_scatter_p
  748. #define STMT_VINFO_STRIDED_P(S) (S)->strided_p
  749. #define STMT_VINFO_MEMORY_ACCESS_TYPE(S) (S)->memory_access_type
  750. #define STMT_VINFO_SIMD_LANE_ACCESS_P(S) (S)->simd_lane_access_p
  751. #define STMT_VINFO_VEC_REDUCTION_TYPE(S) (S)->v_reduc_type
  752. #define STMT_VINFO_VEC_CONST_COND_REDUC_CODE(S) (S)->const_cond_reduc_code
  753. #define STMT_VINFO_DR_WRT_VEC_LOOP(S) (S)->dr_wrt_vec_loop
  754. #define STMT_VINFO_DR_BASE_ADDRESS(S) (S)->dr_wrt_vec_loop.base_address
  755. #define STMT_VINFO_DR_INIT(S) (S)->dr_wrt_vec_loop.init
  756. #define STMT_VINFO_DR_OFFSET(S) (S)->dr_wrt_vec_loop.offset
  757. #define STMT_VINFO_DR_STEP(S) (S)->dr_wrt_vec_loop.step
  758. #define STMT_VINFO_DR_BASE_ALIGNMENT(S) (S)->dr_wrt_vec_loop.base_alignment
  759. #define STMT_VINFO_DR_BASE_MISALIGNMENT(S) \
  760. (S)->dr_wrt_vec_loop.base_misalignment
  761. #define STMT_VINFO_DR_OFFSET_ALIGNMENT(S) \
  762. (S)->dr_wrt_vec_loop.offset_alignment
  763. #define STMT_VINFO_DR_STEP_ALIGNMENT(S) \
  764. (S)->dr_wrt_vec_loop.step_alignment
  765. #define STMT_VINFO_IN_PATTERN_P(S) (S)->in_pattern_p
  766. #define STMT_VINFO_RELATED_STMT(S) (S)->related_stmt
  767. #define STMT_VINFO_PATTERN_DEF_SEQ(S) (S)->pattern_def_seq
  768. #define STMT_VINFO_SAME_ALIGN_REFS(S) (S)->same_align_refs
  769. #define STMT_VINFO_SIMD_CLONE_INFO(S) (S)->simd_clone_info
  770. #define STMT_VINFO_DEF_TYPE(S) (S)->def_type
  771. #define STMT_VINFO_GROUP_FIRST_ELEMENT(S) (S)->first_element
  772. #define STMT_VINFO_GROUP_NEXT_ELEMENT(S) (S)->next_element
  773. #define STMT_VINFO_GROUP_SIZE(S) (S)->size
  774. #define STMT_VINFO_GROUP_STORE_COUNT(S) (S)->store_count
  775. #define STMT_VINFO_GROUP_GAP(S) (S)->gap
  776. #define STMT_VINFO_GROUP_SAME_DR_STMT(S) (S)->same_dr_stmt
  777. #define STMT_VINFO_GROUPED_ACCESS(S) ((S)->first_element != NULL && (S)->data_ref_info)
  778. #define STMT_VINFO_LOOP_PHI_EVOLUTION_BASE_UNCHANGED(S) (S)->loop_phi_evolution_base_unchanged
  779. #define STMT_VINFO_LOOP_PHI_EVOLUTION_PART(S) (S)->loop_phi_evolution_part
  780. #define STMT_VINFO_MIN_NEG_DIST(S) (S)->min_neg_dist
  781. #define STMT_VINFO_NUM_SLP_USES(S) (S)->num_slp_uses
  782. #define STMT_VINFO_REDUC_TYPE(S) (S)->reduc_type
  783. #define STMT_VINFO_REDUC_DEF(S) (S)->reduc_def
  784. #define GROUP_FIRST_ELEMENT(S) (S)->first_element
  785. #define GROUP_NEXT_ELEMENT(S) (S)->next_element
  786. #define GROUP_SIZE(S) (S)->size
  787. #define GROUP_STORE_COUNT(S) (S)->store_count
  788. #define GROUP_GAP(S) (S)->gap
  789. #define GROUP_SAME_DR_STMT(S) (S)->same_dr_stmt
  790. #define STMT_VINFO_RELEVANT_P(S) ((S)->relevant != vect_unused_in_scope)
  791. #define HYBRID_SLP_STMT(S) ((S)->slp_type == hybrid)
  792. #define PURE_SLP_STMT(S) ((S)->slp_type == pure_slp)
  793. #define STMT_SLP_TYPE(S) (S)->slp_type
  794. struct dataref_aux {
  795. /* The misalignment in bytes of the reference, or -1 if not known. */
  796. int misalignment;
  797. /* The byte alignment that we'd ideally like the reference to have,
  798. and the value that misalignment is measured against. */
  799. int target_alignment;
  800. /* If true the alignment of base_decl needs to be increased. */
  801. bool base_misaligned;
  802. tree base_decl;
  803. };
  804. #define DR_VECT_AUX(dr) ((dataref_aux *)(dr)->aux)
  805. #define VECT_MAX_COST 1000
  806. /* The maximum number of intermediate steps required in multi-step type
  807. conversion. */
  808. #define MAX_INTERM_CVT_STEPS 3
  809. #define MAX_VECTORIZATION_FACTOR INT_MAX
  810. /* Nonzero if TYPE represents a (scalar) boolean type or type
  811. in the middle-end compatible with it (unsigned precision 1 integral
  812. types). Used to determine which types should be vectorized as
  813. VECTOR_BOOLEAN_TYPE_P. */
  814. #define VECT_SCALAR_BOOLEAN_TYPE_P(TYPE) \
  815. (TREE_CODE (TYPE) == BOOLEAN_TYPE \
  816. || ((TREE_CODE (TYPE) == INTEGER_TYPE \
  817. || TREE_CODE (TYPE) == ENUMERAL_TYPE) \
  818. && TYPE_PRECISION (TYPE) == 1 \
  819. && TYPE_UNSIGNED (TYPE)))
  820. extern vec<stmt_vec_info> stmt_vec_info_vec;
  821. void init_stmt_vec_info_vec (void);
  822. void free_stmt_vec_info_vec (void);
  823. /* Return a stmt_vec_info corresponding to STMT. */
  824. static inline stmt_vec_info
  825. vinfo_for_stmt (gimple *stmt)
  826. {
  827. int uid = gimple_uid (stmt);
  828. if (uid <= 0)
  829. return NULL;
  830. return stmt_vec_info_vec[uid - 1];
  831. }
  832. /* Set vectorizer information INFO for STMT. */
  833. static inline void
  834. set_vinfo_for_stmt (gimple *stmt, stmt_vec_info info)
  835. {
  836. unsigned int uid = gimple_uid (stmt);
  837. if (uid == 0)
  838. {
  839. gcc_checking_assert (info);
  840. uid = stmt_vec_info_vec.length () + 1;
  841. gimple_set_uid (stmt, uid);
  842. stmt_vec_info_vec.safe_push (info);
  843. }
  844. else
  845. {
  846. gcc_checking_assert (info == NULL);
  847. stmt_vec_info_vec[uid - 1] = info;
  848. }
  849. }
  850. /* Return TRUE if a statement represented by STMT_INFO is a part of a
  851. pattern. */
  852. static inline bool
  853. is_pattern_stmt_p (stmt_vec_info stmt_info)
  854. {
  855. gimple *related_stmt;
  856. stmt_vec_info related_stmt_info;
  857. related_stmt = STMT_VINFO_RELATED_STMT (stmt_info);
  858. if (related_stmt
  859. && (related_stmt_info = vinfo_for_stmt (related_stmt))
  860. && STMT_VINFO_IN_PATTERN_P (related_stmt_info))
  861. return true;
  862. return false;
  863. }
  864. /* Return the later statement between STMT1 and STMT2. */
  865. static inline gimple *
  866. get_later_stmt (gimple *stmt1, gimple *stmt2)
  867. {
  868. unsigned int uid1, uid2;
  869. if (stmt1 == NULL)
  870. return stmt2;
  871. if (stmt2 == NULL)
  872. return stmt1;
  873. stmt_vec_info stmt_info1 = vinfo_for_stmt (stmt1);
  874. stmt_vec_info stmt_info2 = vinfo_for_stmt (stmt2);
  875. uid1 = gimple_uid (is_pattern_stmt_p (stmt_info1)
  876. ? STMT_VINFO_RELATED_STMT (stmt_info1) : stmt1);
  877. uid2 = gimple_uid (is_pattern_stmt_p (stmt_info2)
  878. ? STMT_VINFO_RELATED_STMT (stmt_info2) : stmt2);
  879. if (uid1 == 0 || uid2 == 0)
  880. return NULL;
  881. gcc_assert (uid1 <= stmt_vec_info_vec.length ());
  882. gcc_assert (uid2 <= stmt_vec_info_vec.length ());
  883. if (uid1 > uid2)
  884. return stmt1;
  885. else
  886. return stmt2;
  887. }
  888. /* Return true if BB is a loop header. */
  889. static inline bool
  890. is_loop_header_bb_p (basic_block bb)
  891. {
  892. if (bb == (bb->loop_father)->header)
  893. return true;
  894. gcc_checking_assert (EDGE_COUNT (bb->preds) == 1);
  895. return false;
  896. }
  897. /* Return pow2 (X). */
  898. static inline int
  899. vect_pow2 (int x)
  900. {
  901. int i, res = 1;
  902. for (i = 0; i < x; i++)
  903. res *= 2;
  904. return res;
  905. }
  906. /* Alias targetm.vectorize.builtin_vectorization_cost. */
  907. static inline int
  908. builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
  909. tree vectype, int misalign)
  910. {
  911. return targetm.vectorize.builtin_vectorization_cost (type_of_cost,
  912. vectype, misalign);
  913. }
  914. /* Get cost by calling cost target builtin. */
  915. static inline
  916. int vect_get_stmt_cost (enum vect_cost_for_stmt type_of_cost)
  917. {
  918. return builtin_vectorization_cost (type_of_cost, NULL, 0);
  919. }
  920. /* Alias targetm.vectorize.init_cost. */
  921. static inline void *
  922. init_cost (struct loop *loop_info)
  923. {
  924. return targetm.vectorize.init_cost (loop_info);
  925. }
  926. /* Alias targetm.vectorize.add_stmt_cost. */
  927. static inline unsigned
  928. add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind,
  929. stmt_vec_info stmt_info, int misalign,
  930. enum vect_cost_model_location where)
  931. {
  932. return targetm.vectorize.add_stmt_cost (data, count, kind,
  933. stmt_info, misalign, where);
  934. }
  935. /* Alias targetm.vectorize.finish_cost. */
  936. static inline void
  937. finish_cost (void *data, unsigned *prologue_cost,
  938. unsigned *body_cost, unsigned *epilogue_cost)
  939. {
  940. targetm.vectorize.finish_cost (data, prologue_cost, body_cost, epilogue_cost);
  941. }
  942. /* Alias targetm.vectorize.destroy_cost_data. */
  943. static inline void
  944. destroy_cost_data (void *data)
  945. {
  946. targetm.vectorize.destroy_cost_data (data);
  947. }
  948. /*-----------------------------------------------------------------*/
  949. /* Info on data references alignment. */
  950. /*-----------------------------------------------------------------*/
  951. inline void
  952. set_dr_misalignment (struct data_reference *dr, int val)
  953. {
  954. dataref_aux *data_aux = DR_VECT_AUX (dr);
  955. if (!data_aux)
  956. {
  957. data_aux = XCNEW (dataref_aux);
  958. dr->aux = data_aux;
  959. }
  960. data_aux->misalignment = val;
  961. }
  962. inline int
  963. dr_misalignment (struct data_reference *dr)
  964. {
  965. return DR_VECT_AUX (dr)->misalignment;
  966. }
  967. /* Reflects actual alignment of first access in the vectorized loop,
  968. taking into account peeling/versioning if applied. */
  969. #define DR_MISALIGNMENT(DR) dr_misalignment (DR)
  970. #define SET_DR_MISALIGNMENT(DR, VAL) set_dr_misalignment (DR, VAL)
  971. #define DR_MISALIGNMENT_UNKNOWN (-1)
  972. /* Only defined once DR_MISALIGNMENT is defined. */
  973. #define DR_TARGET_ALIGNMENT(DR) DR_VECT_AUX (DR)->target_alignment
  974. /* Return true if data access DR is aligned to its target alignment
  975. (which may be less than a full vector). */
  976. static inline bool
  977. aligned_access_p (struct data_reference *data_ref_info)
  978. {
  979. return (DR_MISALIGNMENT (data_ref_info) == 0);
  980. }
  981. /* Return TRUE if the alignment of the data access is known, and FALSE
  982. otherwise. */
  983. static inline bool
  984. known_alignment_for_access_p (struct data_reference *data_ref_info)
  985. {
  986. return (DR_MISALIGNMENT (data_ref_info) != DR_MISALIGNMENT_UNKNOWN);
  987. }
  988. /* Return the minimum alignment in bytes that the vectorized version
  989. of DR is guaranteed to have. */
  990. static inline unsigned int
  991. vect_known_alignment_in_bytes (struct data_reference *dr)
  992. {
  993. if (DR_MISALIGNMENT (dr) == DR_MISALIGNMENT_UNKNOWN)
  994. return TYPE_ALIGN_UNIT (TREE_TYPE (DR_REF (dr)));
  995. if (DR_MISALIGNMENT (dr) == 0)
  996. return DR_TARGET_ALIGNMENT (dr);
  997. return DR_MISALIGNMENT (dr) & -DR_MISALIGNMENT (dr);
  998. }
  999. /* Return the behavior of DR with respect to the vectorization context
  1000. (which for outer loop vectorization might not be the behavior recorded
  1001. in DR itself). */
  1002. static inline innermost_loop_behavior *
  1003. vect_dr_behavior (data_reference *dr)
  1004. {
  1005. gimple *stmt = DR_STMT (dr);
  1006. stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
  1007. loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
  1008. if (loop_vinfo == NULL
  1009. || !nested_in_vect_loop_p (LOOP_VINFO_LOOP (loop_vinfo), stmt))
  1010. return &DR_INNERMOST (dr);
  1011. else
  1012. return &STMT_VINFO_DR_WRT_VEC_LOOP (stmt_info);
  1013. }
  1014. /* Return true if the vect cost model is unlimited. */
  1015. static inline bool
  1016. unlimited_cost_model (loop_p loop)
  1017. {
  1018. if (loop != NULL && loop->force_vectorize
  1019. && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
  1020. return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
  1021. return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
  1022. }
  1023. /* Return true if the loop described by LOOP_VINFO is fully-masked and
  1024. if the first iteration should use a partial mask in order to achieve
  1025. alignment. */
  1026. static inline bool
  1027. vect_use_loop_mask_for_alignment_p (loop_vec_info loop_vinfo)
  1028. {
  1029. return (LOOP_VINFO_FULLY_MASKED_P (loop_vinfo)
  1030. && LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo));
  1031. }
  1032. /* Return the number of vectors of type VECTYPE that are needed to get
  1033. NUNITS elements. NUNITS should be based on the vectorization factor,
  1034. so it is always a known multiple of the number of elements in VECTYPE. */
  1035. static inline unsigned int
  1036. vect_get_num_vectors (poly_uint64 nunits, tree vectype)
  1037. {
  1038. return exact_div (nunits, TYPE_VECTOR_SUBPARTS (vectype)).to_constant ();
  1039. }
  1040. /* Return the number of copies needed for loop vectorization when
  1041. a statement operates on vectors of type VECTYPE. This is the
  1042. vectorization factor divided by the number of elements in
  1043. VECTYPE and is always known at compile time. */
  1044. static inline unsigned int
  1045. vect_get_num_copies (loop_vec_info loop_vinfo, tree vectype)
  1046. {
  1047. return vect_get_num_vectors (LOOP_VINFO_VECT_FACTOR (loop_vinfo), vectype);
  1048. }
  1049. /* Update maximum unit count *MAX_NUNITS so that it accounts for
  1050. the number of units in vector type VECTYPE. *MAX_NUNITS can be 1
  1051. if we haven't yet recorded any vector types. */
  1052. static inline void
  1053. vect_update_max_nunits (poly_uint64 *max_nunits, tree vectype)
  1054. {
  1055. /* All unit counts have the form current_vector_size * X for some
  1056. rational X, so two unit sizes must have a common multiple.
  1057. Everything is a multiple of the initial value of 1. */
  1058. poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype);
  1059. *max_nunits = force_common_multiple (*max_nunits, nunits);
  1060. }
  1061. /* Return the vectorization factor that should be used for costing
  1062. purposes while vectorizing the loop described by LOOP_VINFO.
  1063. Pick a reasonable estimate if the vectorization factor isn't
  1064. known at compile time. */
  1065. static inline unsigned int
  1066. vect_vf_for_cost (loop_vec_info loop_vinfo)
  1067. {
  1068. return estimated_poly_value (LOOP_VINFO_VECT_FACTOR (loop_vinfo));
  1069. }
  1070. /* Estimate the number of elements in VEC_TYPE for costing purposes.
  1071. Pick a reasonable estimate if the exact number isn't known at
  1072. compile time. */
  1073. static inline unsigned int
  1074. vect_nunits_for_cost (tree vec_type)
  1075. {
  1076. return estimated_poly_value (TYPE_VECTOR_SUBPARTS (vec_type));
  1077. }
  1078. /* Return the maximum possible vectorization factor for LOOP_VINFO. */
  1079. static inline unsigned HOST_WIDE_INT
  1080. vect_max_vf (loop_vec_info loop_vinfo)
  1081. {
  1082. unsigned HOST_WIDE_INT vf;
  1083. if (LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant (&vf))
  1084. return vf;
  1085. return MAX_VECTORIZATION_FACTOR;
  1086. }
  1087. /* Return the size of the value accessed by unvectorized data reference DR.
  1088. This is only valid once STMT_VINFO_VECTYPE has been calculated for the
  1089. associated gimple statement, since that guarantees that DR accesses
  1090. either a scalar or a scalar equivalent. ("Scalar equivalent" here
  1091. includes things like V1SI, which can be vectorized in the same way
  1092. as a plain SI.) */
  1093. inline unsigned int
  1094. vect_get_scalar_dr_size (struct data_reference *dr)
  1095. {
  1096. return tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dr))));
  1097. }
  1098. /* Source location */
  1099. extern source_location vect_location;
  1100. /*-----------------------------------------------------------------*/
  1101. /* Function prototypes. */
  1102. /*-----------------------------------------------------------------*/
  1103. /* Simple loop peeling and versioning utilities for vectorizer's purposes -
  1104. in tree-vect-loop-manip.c. */
  1105. extern void vect_set_loop_condition (struct loop *, loop_vec_info,
  1106. tree, tree, tree, bool);
  1107. extern bool slpeel_can_duplicate_loop_p (const struct loop *, const_edge);
  1108. struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *,
  1109. struct loop *, edge);
  1110. extern void vect_loop_versioning (loop_vec_info, unsigned int, bool,
  1111. poly_uint64);
  1112. extern struct loop *vect_do_peeling (loop_vec_info, tree, tree,
  1113. tree *, tree *, tree *, int, bool, bool);
  1114. extern void vect_prepare_for_masked_peels (loop_vec_info);
  1115. extern source_location find_loop_location (struct loop *);
  1116. extern bool vect_can_advance_ivs_p (loop_vec_info);
  1117. /* In tree-vect-stmts.c. */
  1118. extern poly_uint64 current_vector_size;
  1119. extern tree get_vectype_for_scalar_type (tree);
  1120. extern tree get_vectype_for_scalar_type_and_size (tree, poly_uint64);
  1121. extern tree get_mask_type_for_scalar_type (tree);
  1122. extern tree get_same_sized_vectype (tree, tree);
  1123. extern bool vect_get_loop_mask_type (loop_vec_info);
  1124. extern bool vect_is_simple_use (tree, vec_info *, gimple **,
  1125. enum vect_def_type *);
  1126. extern bool vect_is_simple_use (tree, vec_info *, gimple **,
  1127. enum vect_def_type *, tree *);
  1128. extern bool supportable_widening_operation (enum tree_code, gimple *, tree,
  1129. tree, enum tree_code *,
  1130. enum tree_code *, int *,
  1131. vec<tree> *);
  1132. extern bool supportable_narrowing_operation (enum tree_code, tree, tree,
  1133. enum tree_code *,
  1134. int *, vec<tree> *);
  1135. extern stmt_vec_info new_stmt_vec_info (gimple *stmt, vec_info *);
  1136. extern void free_stmt_vec_info (gimple *stmt);
  1137. extern void vect_model_simple_cost (stmt_vec_info, int, enum vect_def_type *,
  1138. int, stmt_vector_for_cost *,
  1139. stmt_vector_for_cost *);
  1140. extern void vect_model_store_cost (stmt_vec_info, int, vect_memory_access_type,
  1141. vec_load_store_type, slp_tree,
  1142. stmt_vector_for_cost *,
  1143. stmt_vector_for_cost *);
  1144. extern void vect_model_load_cost (stmt_vec_info, int, vect_memory_access_type,
  1145. slp_tree, stmt_vector_for_cost *,
  1146. stmt_vector_for_cost *);
  1147. extern unsigned record_stmt_cost (stmt_vector_for_cost *, int,
  1148. enum vect_cost_for_stmt, stmt_vec_info,
  1149. int, enum vect_cost_model_location);
  1150. extern void vect_finish_replace_stmt (gimple *, gimple *);
  1151. extern void vect_finish_stmt_generation (gimple *, gimple *,
  1152. gimple_stmt_iterator *);
  1153. extern bool vect_mark_stmts_to_be_vectorized (loop_vec_info);
  1154. extern tree vect_get_store_rhs (gimple *);
  1155. extern tree vect_get_vec_def_for_operand_1 (gimple *, enum vect_def_type);
  1156. extern tree vect_get_vec_def_for_operand (tree, gimple *, tree = NULL);
  1157. extern void vect_get_vec_defs (tree, tree, gimple *, vec<tree> *,
  1158. vec<tree> *, slp_tree);
  1159. extern void vect_get_vec_defs_for_stmt_copy (enum vect_def_type *,
  1160. vec<tree> *, vec<tree> *);
  1161. extern tree vect_init_vector (gimple *, tree, tree,
  1162. gimple_stmt_iterator *);
  1163. extern tree vect_get_vec_def_for_stmt_copy (enum vect_def_type, tree);
  1164. extern bool vect_transform_stmt (gimple *, gimple_stmt_iterator *,
  1165. bool *, slp_tree, slp_instance);
  1166. extern void vect_remove_stores (gimple *);
  1167. extern bool vect_analyze_stmt (gimple *, bool *, slp_tree, slp_instance);
  1168. extern bool vectorizable_condition (gimple *, gimple_stmt_iterator *,
  1169. gimple **, tree, int, slp_tree);
  1170. extern void vect_get_load_cost (struct data_reference *, int, bool,
  1171. unsigned int *, unsigned int *,
  1172. stmt_vector_for_cost *,
  1173. stmt_vector_for_cost *, bool);
  1174. extern void vect_get_store_cost (struct data_reference *, int,
  1175. unsigned int *, stmt_vector_for_cost *);
  1176. extern bool vect_supportable_shift (enum tree_code, tree);
  1177. extern tree vect_gen_perm_mask_any (tree, const vec_perm_indices &);
  1178. extern tree vect_gen_perm_mask_checked (tree, const vec_perm_indices &);
  1179. extern void optimize_mask_stores (struct loop*);
  1180. extern gcall *vect_gen_while (tree, tree, tree);
  1181. extern tree vect_gen_while_not (gimple_seq *, tree, tree, tree);
  1182. /* In tree-vect-data-refs.c. */
  1183. extern bool vect_can_force_dr_alignment_p (const_tree, unsigned int);
  1184. extern enum dr_alignment_support vect_supportable_dr_alignment
  1185. (struct data_reference *, bool);
  1186. extern tree vect_get_smallest_scalar_type (gimple *, HOST_WIDE_INT *,
  1187. HOST_WIDE_INT *);
  1188. extern bool vect_analyze_data_ref_dependences (loop_vec_info, unsigned int *);
  1189. extern bool vect_slp_analyze_instance_dependence (slp_instance);
  1190. extern bool vect_enhance_data_refs_alignment (loop_vec_info);
  1191. extern bool vect_analyze_data_refs_alignment (loop_vec_info);
  1192. extern bool vect_verify_datarefs_alignment (loop_vec_info);
  1193. extern bool vect_slp_analyze_and_verify_instance_alignment (slp_instance);
  1194. extern bool vect_analyze_data_ref_accesses (vec_info *);
  1195. extern bool vect_prune_runtime_alias_test_list (loop_vec_info);
  1196. extern bool vect_gather_scatter_fn_p (bool, bool, tree, tree, unsigned int,
  1197. signop, int, internal_fn *, tree *);
  1198. extern bool vect_check_gather_scatter (gimple *, loop_vec_info,
  1199. gather_scatter_info *);
  1200. extern bool vect_analyze_data_refs (vec_info *, poly_uint64 *);
  1201. extern void vect_record_base_alignments (vec_info *);
  1202. extern tree vect_create_data_ref_ptr (gimple *, tree, struct loop *, tree,
  1203. tree *, gimple_stmt_iterator *,
  1204. gimple **, bool, bool *,
  1205. tree = NULL_TREE, tree = NULL_TREE);
  1206. extern tree bump_vector_ptr (tree, gimple *, gimple_stmt_iterator *, gimple *,
  1207. tree);
  1208. extern void vect_copy_ref_info (tree, tree);
  1209. extern tree vect_create_destination_var (tree, tree);
  1210. extern bool vect_grouped_store_supported (tree, unsigned HOST_WIDE_INT);
  1211. extern bool vect_store_lanes_supported (tree, unsigned HOST_WIDE_INT, bool);
  1212. extern bool vect_grouped_load_supported (tree, bool, unsigned HOST_WIDE_INT);
  1213. extern bool vect_load_lanes_supported (tree, unsigned HOST_WIDE_INT, bool);
  1214. extern void vect_permute_store_chain (vec<tree> ,unsigned int, gimple *,
  1215. gimple_stmt_iterator *, vec<tree> *);
  1216. extern tree vect_setup_realignment (gimple *, gimple_stmt_iterator *, tree *,
  1217. enum dr_alignment_support, tree,
  1218. struct loop **);
  1219. extern void vect_transform_grouped_load (gimple *, vec<tree> , int,
  1220. gimple_stmt_iterator *);
  1221. extern void vect_record_grouped_load_vectors (gimple *, vec<tree> );
  1222. extern tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *);
  1223. extern tree vect_get_new_ssa_name (tree, enum vect_var_kind,
  1224. const char * = NULL);
  1225. extern tree vect_create_addr_base_for_vector_ref (gimple *, gimple_seq *,
  1226. tree, tree = NULL_TREE);
  1227. /* In tree-vect-loop.c. */
  1228. /* FORNOW: Used in tree-parloops.c. */
  1229. extern gimple *vect_force_simple_reduction (loop_vec_info, gimple *,
  1230. bool *, bool);
  1231. /* Used in gimple-loop-interchange.c. */
  1232. extern bool check_reduction_path (location_t, loop_p, gphi *, tree,
  1233. enum tree_code);
  1234. /* Drive for loop analysis stage. */
  1235. extern loop_vec_info vect_analyze_loop (struct loop *, loop_vec_info);
  1236. extern tree vect_build_loop_niters (loop_vec_info, bool * = NULL);
  1237. extern void vect_gen_vector_loop_niters (loop_vec_info, tree, tree *,
  1238. tree *, bool);
  1239. extern tree vect_halve_mask_nunits (tree);
  1240. extern tree vect_double_mask_nunits (tree);
  1241. extern void vect_record_loop_mask (loop_vec_info, vec_loop_masks *,
  1242. unsigned int, tree);
  1243. extern tree vect_get_loop_mask (gimple_stmt_iterator *, vec_loop_masks *,
  1244. unsigned int, tree, unsigned int);
  1245. /* Drive for loop transformation stage. */
  1246. extern struct loop *vect_transform_loop (loop_vec_info);
  1247. extern loop_vec_info vect_analyze_loop_form (struct loop *);
  1248. extern bool vectorizable_live_operation (gimple *, gimple_stmt_iterator *,
  1249. slp_tree, int, gimple **);
  1250. extern bool vectorizable_reduction (gimple *, gimple_stmt_iterator *,
  1251. gimple **, slp_tree, slp_instance);
  1252. extern bool vectorizable_induction (gimple *, gimple_stmt_iterator *,
  1253. gimple **, slp_tree);
  1254. extern tree get_initial_def_for_reduction (gimple *, tree, tree *);
  1255. extern bool vect_worthwhile_without_simd_p (vec_info *, tree_code);
  1256. extern int vect_get_known_peeling_cost (loop_vec_info, int, int *,
  1257. stmt_vector_for_cost *,
  1258. stmt_vector_for_cost *,
  1259. stmt_vector_for_cost *);
  1260. extern tree cse_and_gimplify_to_preheader (loop_vec_info, tree);
  1261. /* In tree-vect-slp.c. */
  1262. extern void vect_free_slp_instance (slp_instance);
  1263. extern bool vect_transform_slp_perm_load (slp_tree, vec<tree> ,
  1264. gimple_stmt_iterator *, poly_uint64,
  1265. slp_instance, bool, unsigned *);
  1266. extern bool vect_slp_analyze_operations (vec_info *);
  1267. extern bool vect_schedule_slp (vec_info *);
  1268. extern bool vect_analyze_slp (vec_info *, unsigned);
  1269. extern bool vect_make_slp_decision (loop_vec_info);
  1270. extern void vect_detect_hybrid_slp (loop_vec_info);
  1271. extern void vect_get_slp_defs (vec<tree> , slp_tree, vec<vec<tree> > *);
  1272. extern bool vect_slp_bb (basic_block);
  1273. extern gimple *vect_find_last_scalar_stmt_in_slp (slp_tree);
  1274. extern bool is_simple_and_all_uses_invariant (gimple *, loop_vec_info);
  1275. extern bool can_duplicate_and_interleave_p (unsigned int, machine_mode,
  1276. unsigned int * = NULL,
  1277. tree * = NULL, tree * = NULL);
  1278. extern void duplicate_and_interleave (gimple_seq *, tree, vec<tree>,
  1279. unsigned int, vec<tree> &);
  1280. extern int vect_get_place_in_interleaving_chain (gimple *, gimple *);
  1281. /* In tree-vect-patterns.c. */
  1282. /* Pattern recognition functions.
  1283. Additional pattern recognition functions can (and will) be added
  1284. in the future. */
  1285. typedef gimple *(* vect_recog_func_ptr) (vec<gimple *> *, tree *, tree *);
  1286. #define NUM_PATTERNS 15
  1287. void vect_pattern_recog (vec_info *);
  1288. /* In tree-vectorizer.c. */
  1289. unsigned vectorize_loops (void);
  1290. bool vect_stmt_in_region_p (vec_info *, gimple *);
  1291. void vect_free_loop_info_assumptions (struct loop *);
  1292. #endif /* GCC_TREE_VECTORIZER_H */