[InstCombine] Signed saturation patterns
[llvm-complete.git] / include / llvm / Transforms / Vectorize.h
blob88a0e49d0fae3e3ca84dacf407b2681911a53a99
1 //===-- Vectorize.h - Vectorization Transformations -------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This header file defines prototypes for accessor functions that expose passes
10 // in the Vectorize transformations library.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TRANSFORMS_VECTORIZE_H
15 #define LLVM_TRANSFORMS_VECTORIZE_H
17 namespace llvm {
18 class BasicBlock;
19 class BasicBlockPass;
20 class Pass;
22 //===----------------------------------------------------------------------===//
23 /// Vectorize configuration.
24 struct VectorizeConfig {
25 //===--------------------------------------------------------------------===//
26 // Target architecture related parameters
28 /// The size of the native vector registers.
29 unsigned VectorBits;
31 /// Vectorize boolean values.
32 bool VectorizeBools;
34 /// Vectorize integer values.
35 bool VectorizeInts;
37 /// Vectorize floating-point values.
38 bool VectorizeFloats;
40 /// Vectorize pointer values.
41 bool VectorizePointers;
43 /// Vectorize casting (conversion) operations.
44 bool VectorizeCasts;
46 /// Vectorize floating-point math intrinsics.
47 bool VectorizeMath;
49 /// Vectorize bit intrinsics.
50 bool VectorizeBitManipulations;
52 /// Vectorize the fused-multiply-add intrinsic.
53 bool VectorizeFMA;
55 /// Vectorize select instructions.
56 bool VectorizeSelect;
58 /// Vectorize comparison instructions.
59 bool VectorizeCmp;
61 /// Vectorize getelementptr instructions.
62 bool VectorizeGEP;
64 /// Vectorize loads and stores.
65 bool VectorizeMemOps;
67 /// Only generate aligned loads and stores.
68 bool AlignedOnly;
70 //===--------------------------------------------------------------------===//
71 // Misc parameters
73 /// The required chain depth for vectorization.
74 unsigned ReqChainDepth;
76 /// The maximum search distance for instruction pairs.
77 unsigned SearchLimit;
79 /// The maximum number of candidate pairs with which to use a full
80 /// cycle check.
81 unsigned MaxCandPairsForCycleCheck;
83 /// Replicating one element to a pair breaks the chain.
84 bool SplatBreaksChain;
86 /// The maximum number of pairable instructions per group.
87 unsigned MaxInsts;
89 /// The maximum number of candidate instruction pairs per group.
90 unsigned MaxPairs;
92 /// The maximum number of pairing iterations.
93 unsigned MaxIter;
95 /// Don't try to form odd-length vectors.
96 bool Pow2LenOnly;
98 /// Don't boost the chain-depth contribution of loads and stores.
99 bool NoMemOpBoost;
101 /// Use a fast instruction dependency analysis.
102 bool FastDep;
104 /// Initialize the VectorizeConfig from command line options.
105 VectorizeConfig();
108 //===----------------------------------------------------------------------===//
110 // LoopVectorize - Create a loop vectorization pass.
112 Pass *createLoopVectorizePass();
113 Pass *createLoopVectorizePass(bool InterleaveOnlyWhenForced,
114 bool VectorizeOnlyWhenForced);
116 //===----------------------------------------------------------------------===//
118 // SLPVectorizer - Create a bottom-up SLP vectorizer pass.
120 Pass *createSLPVectorizerPass();
122 //===----------------------------------------------------------------------===//
123 /// Vectorize the BasicBlock.
125 /// @param BB The BasicBlock to be vectorized
126 /// @param P The current running pass, should require AliasAnalysis and
127 /// ScalarEvolution. After the vectorization, AliasAnalysis,
128 /// ScalarEvolution and CFG are preserved.
130 /// @return True if the BB is changed, false otherwise.
132 bool vectorizeBasicBlock(Pass *P, BasicBlock &BB,
133 const VectorizeConfig &C = VectorizeConfig());
135 //===----------------------------------------------------------------------===//
137 // LoadStoreVectorizer - Create vector loads and stores, but leave scalar
138 // operations.
140 Pass *createLoadStoreVectorizerPass();
142 } // End llvm namespace
144 #endif