15#ifndef LLVM_LIB_TARGET_RISCV_RISCVVECTORUTILS_H
16#define LLVM_LIB_TARGET_RISCV_RISCVVECTORUTILS_H
23inline bool isAlternating(
const std::array<std::pair<int, int>, 2> &SrcInfo,
25 bool RequiredPolarity) {
26 int NumElts = Mask.size();
27 for (
const auto &[Idx, M] :
enumerate(Mask)) {
30 int Src = M >= NumElts;
31 int Diff = (int)Idx - (M % NumElts);
32 bool C = Src == SrcInfo[1].first && Diff == SrcInfo[1].second;
33 assert(
C != (Src == SrcInfo[0].first && Diff == SrcInfo[0].second) &&
34 "Must match exactly one of the two slides");
35 if (RequiredPolarity != (
C == (Idx / Factor) % 2))
47inline bool isPairEven(
const std::array<std::pair<int, int>, 2> &SrcInfo,
49 Factor = SrcInfo[1].second;
51 Mask.size() % Factor == 0 &&
63inline bool isPairOdd(
const std::array<std::pair<int, int>, 2> &SrcInfo,
65 Factor = -SrcInfo[1].second;
67 Mask.size() % Factor == 0 &&
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
Represent a constant reference to an array (0 or more elements consecutively in memory),...
This is an optimization pass for GlobalISel generic memory operations.
bool isAlternating(const std::array< std::pair< int, int >, 2 > &SrcInfo, ArrayRef< int > Mask, unsigned Factor, bool RequiredPolarity)
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
bool isPairEven(const std::array< std::pair< int, int >, 2 > &SrcInfo, ArrayRef< int > Mask, unsigned &Factor)
Given a shuffle which can be represented as a pair of two slides, see if it is a pair-even idiom.
bool isPairOdd(const std::array< std::pair< int, int >, 2 > &SrcInfo, ArrayRef< int > Mask, unsigned &Factor)
Given a shuffle which can be represented as a pair of two slides, see if it is a pair-odd idiom.
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.