本文整理汇总了C++中IRBuilder::CreateShuffleVector方法的典型用法代码示例。如果您正苦于以下问题:C++ IRBuilder::CreateShuffleVector方法的具体用法?C++ IRBuilder::CreateShuffleVector怎么用?C++ IRBuilder::CreateShuffleVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRBuilder
的用法示例。
在下文中一共展示了IRBuilder::CreateShuffleVector方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reorderSubVector
static void reorderSubVector(MVT VT, SmallVectorImpl<Value *> &TransposedMatrix,
ArrayRef<Value *> Vec, ArrayRef<uint32_t> VPShuf,
unsigned VecElems, unsigned Stride,
IRBuilder<> Builder) {
if (VecElems == 16) {
for (unsigned i = 0; i < Stride; i++)
TransposedMatrix[i] = Builder.CreateShuffleVector(
Vec[i], UndefValue::get(Vec[i]->getType()), VPShuf);
return;
}
SmallVector<uint32_t, 32> OptimizeShuf;
Value *Temp[8];
for (unsigned i = 0; i < (VecElems / 16) * Stride; i += 2) {
genShuffleBland(VT, VPShuf, OptimizeShuf, (i / Stride) * 16,
(i + 1) / Stride * 16);
Temp[i / 2] = Builder.CreateShuffleVector(
Vec[i % Stride], Vec[(i + 1) % Stride], OptimizeShuf);
OptimizeShuf.clear();
}
if (VecElems == 32) {
std::copy(Temp, Temp + Stride, TransposedMatrix.begin());
return;
}
else
for (unsigned i = 0; i < Stride; i++)
TransposedMatrix[i] =
Builder.CreateShuffleVector(Temp[2 * i], Temp[2 * i + 1], Concat);
}
示例2: concatSubVector
static void concatSubVector(Value **Vec, ArrayRef<Instruction *> InVec,
unsigned VecElems, IRBuilder<> Builder) {
if (VecElems == 16) {
for (int i = 0; i < 3; i++)
Vec[i] = InVec[i];
return;
}
for (unsigned j = 0; j < VecElems / 32; j++)
for (int i = 0; i < 3; i++)
Vec[i + j * 3] = Builder.CreateShuffleVector(
InVec[j * 6 + i], InVec[j * 6 + i + 3], makeArrayRef(Concat, 32));
if (VecElems == 32)
return;
for (int i = 0; i < 3; i++)
Vec[i] = Builder.CreateShuffleVector(Vec[i], Vec[i + 3], Concat);
}