LLVM 17.0.0git
|
Merges shuffle masks and emits final shuffle instruction, if required. More...
Public Member Functions | |
ShuffleInstructionBuilder (IRBuilderBase &Builder, BoUpSLP &R) | |
void | add (Value *V1, Value *V2, ArrayRef< int > Mask) |
Adds 2 input vectors and the mask for their shuffling. | |
void | add (Value *V1, ArrayRef< int > Mask) |
Adds another one input vector and the mask for the shuffling. | |
void | addOrdered (Value *V1, ArrayRef< unsigned > Order) |
Adds another one input vector and the mask for the shuffling. | |
Value * | finalize (ArrayRef< int > ExtMask, unsigned VF=0, function_ref< void(Value *&, SmallVectorImpl< int > &)> Action={}) |
Finalize emission of the shuffles. | |
~ShuffleInstructionBuilder () | |
Merges shuffle masks and emits final shuffle instruction, if required.
It supports shuffling of 2 input vectors. It implements lazy shuffles emission, when the actual shuffle instruction is generated only if this is actually required. Otherwise, the shuffle instruction emission is delayed till the end of the process, to reduce the number of emitted instructions and further analysis/transformations. The class also will look through the previously emitted shuffle instructions and properly mark indices in mask as undef. For example, given the code
and if need to emit shuffle of s1 and s2 with mask <1, 0, 3, 2>, it will look through s1 and s2 and emit
instead. If 2 operands are of different size, the smallest one will be resized and the mask recalculated properly. For example, given the code
and if need to emit shuffle of s1 and s2 with mask <1, 0, 5, 4>, it will look through s1 and s2 and emit
instead.
Definition at line 9035 of file SLPVectorizer.cpp.
|
inline |
Definition at line 9133 of file SLPVectorizer.cpp.
References Builder.
|
inline |
Definition at line 9278 of file SLPVectorizer.cpp.
References assert(), and llvm::SmallVectorBase< Size_T >::empty().
|
inline |
Adds another one input vector and the mask for the shuffling.
Definition at line 9165 of file SLPVectorizer.cpp.
References llvm::SmallVectorImpl< T >::assign(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorBase< Size_T >::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::find(), llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::Value::getType(), Idx, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), and llvm::UndefMaskElem.
|
inline |
Adds 2 input vectors and the mask for their shuffling.
Definition at line 9137 of file SLPVectorizer.cpp.
References assert(), llvm::SmallVectorImpl< T >::assign(), llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::SmallVectorBase< Size_T >::empty(), llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::Value::getType(), Idx, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase< Size_T >::size(), and llvm::UndefMaskElem.
Referenced by llvm::slpvectorizer::BoUpSLP::ShuffleInstructionBuilder::addOrdered(), and llvm::slpvectorizer::BoUpSLP::vectorizeTree().
|
inline |
Adds another one input vector and the mask for the shuffling.
Definition at line 9222 of file SLPVectorizer.cpp.
References llvm::slpvectorizer::BoUpSLP::ShuffleInstructionBuilder::add(), and llvm::inversePermutation().
|
inline |
Finalize emission of the shuffles.
Action | the action (if any) to be performed before final applying of the ExtMask mask. |
Definition at line 9231 of file SLPVectorizer.cpp.
Referenced by llvm::slpvectorizer::BoUpSLP::vectorizeTree().