aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm12/include/llvm/Transforms/Vectorize.h
blob: e495ca1e62f6c598dd97b920bc238bd200fada13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#pragma once

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif

//===-- Vectorize.h - Vectorization Transformations -------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This header file defines prototypes for accessor functions that expose passes
// in the Vectorize transformations library.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TRANSFORMS_VECTORIZE_H
#define LLVM_TRANSFORMS_VECTORIZE_H

namespace llvm {
class BasicBlock;
class Pass;

//===----------------------------------------------------------------------===//
/// Vectorize configuration.
struct VectorizeConfig {
  //===--------------------------------------------------------------------===//
  // Target architecture related parameters

  /// The size of the native vector registers.
  unsigned VectorBits;

  /// Vectorize boolean values.
  bool VectorizeBools;

  /// Vectorize integer values.
  bool VectorizeInts;

  /// Vectorize floating-point values.
  bool VectorizeFloats;

  /// Vectorize pointer values.
  bool VectorizePointers;

  /// Vectorize casting (conversion) operations.
  bool VectorizeCasts;

  /// Vectorize floating-point math intrinsics.
  bool VectorizeMath;

  /// Vectorize bit intrinsics.
  bool VectorizeBitManipulations;

  /// Vectorize the fused-multiply-add intrinsic.
  bool VectorizeFMA;

  /// Vectorize select instructions.
  bool VectorizeSelect;

  /// Vectorize comparison instructions.
  bool VectorizeCmp;

  /// Vectorize getelementptr instructions.
  bool VectorizeGEP;

  /// Vectorize loads and stores.
  bool VectorizeMemOps;

  /// Only generate aligned loads and stores.
  bool AlignedOnly;

  //===--------------------------------------------------------------------===//
  // Misc parameters

  /// The required chain depth for vectorization.
  unsigned ReqChainDepth;

  /// The maximum search distance for instruction pairs.
  unsigned SearchLimit;

  /// The maximum number of candidate pairs with which to use a full
  ///        cycle check.
  unsigned MaxCandPairsForCycleCheck;

  /// Replicating one element to a pair breaks the chain.
  bool SplatBreaksChain;

  /// The maximum number of pairable instructions per group.
  unsigned MaxInsts;

  /// The maximum number of candidate instruction pairs per group.
  unsigned MaxPairs;

  /// The maximum number of pairing iterations.
  unsigned MaxIter;

  /// Don't try to form odd-length vectors.
  bool Pow2LenOnly;

  /// Don't boost the chain-depth contribution of loads and stores.
  bool NoMemOpBoost;

  /// Use a fast instruction dependency analysis.
  bool FastDep;

  /// Initialize the VectorizeConfig from command line options.
  VectorizeConfig();
};

//===----------------------------------------------------------------------===//
//
// LoopVectorize - Create a loop vectorization pass.
//
Pass *createLoopVectorizePass();
Pass *createLoopVectorizePass(bool InterleaveOnlyWhenForced,
                              bool VectorizeOnlyWhenForced);

//===----------------------------------------------------------------------===//
//
// SLPVectorizer - Create a bottom-up SLP vectorizer pass.
//
Pass *createSLPVectorizerPass();

//===----------------------------------------------------------------------===//
/// Vectorize the BasicBlock.
///
/// @param BB The BasicBlock to be vectorized
/// @param P  The current running pass, should require AliasAnalysis and
///           ScalarEvolution. After the vectorization, AliasAnalysis,
///           ScalarEvolution and CFG are preserved.
///
/// @return True if the BB is changed, false otherwise.
///
bool vectorizeBasicBlock(Pass *P, BasicBlock &BB,
                         const VectorizeConfig &C = VectorizeConfig());

//===----------------------------------------------------------------------===//
//
// LoadStoreVectorizer - Create vector loads and stores, but leave scalar
// operations.
//
Pass *createLoadStoreVectorizerPass();

//===----------------------------------------------------------------------===//
//
// Optimize partial vector operations using target cost models.
//
Pass *createVectorCombinePass();

} // End llvm namespace

#endif

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif