if (pType->isVectorTy())
{
Type* pContainedType = pType->getContainedType(0);
-#if LLVM_VERSION_MAJOR >= 11
+#if LLVM_VERSION_MAJOR >= 12
+ FixedVectorType* pVectorType = cast<FixedVectorType>(pType);
+#elif LLVM_VERSION_MAJOR >= 11
VectorType* pVectorType = cast<VectorType>(pType);
#endif
if (toupper(tempStr[pos + 1]) == 'X')
Value* Builder::VMOVMSK(Value* mask)
{
#if LLVM_VERSION_MAJOR >= 11
+#if LLVM_VERSION_MAJOR >= 12
+ FixedVectorType* pVectorType = cast<FixedVectorType>(mask->getType());
+#else
VectorType* pVectorType = cast<VectorType>(mask->getType());
+#endif
SWR_ASSERT(pVectorType->getElementType() == mInt1Ty);
uint32_t numLanes = pVectorType->getNumElements();
#else
Constant* cB = dyn_cast<Constant>(b);
assert(cB != nullptr);
// number of 8 bit elements in b
+#if LLVM_VERSION_MAJOR >= 12
+ uint32_t numElms = cast<FixedVectorType>(cB->getType())->getNumElements();
+#else
uint32_t numElms = cast<VectorType>(cB->getType())->getNumElements();
+#endif
// output vector
Value* vShuf = UndefValue::get(getVectorType(mInt8Ty, numElms));
Value* Builder::CVTPH2PS(Value* a, const llvm::Twine& name)
{
// Bitcast Nxint16 to Nxhalf
-#if LLVM_VERSION_MAJOR >= 11
+#if LLVM_VERSION_MAJOR >= 12
+ uint32_t numElems = cast<FixedVectorType>(a->getType())->getNumElements();
+#elif LLVM_VERSION_MAJOR >= 11
uint32_t numElems = cast<VectorType>(a->getType())->getNumElements();
#else
uint32_t numElems = a->getType()->getVectorNumElements();
static uint32_t getBitWidth(VectorType *pVTy)
{
-#if LLVM_VERSION_MAJOR >= 11
+#if LLVM_VERSION_MAJOR >= 12
+ return cast<FixedVectorType>(pVTy)->getNumElements() * pVTy->getElementType()->getPrimitiveSizeInBits();
+#elif LLVM_VERSION_MAJOR >= 11
return pVTy->getNumElements() * pVTy->getElementType()->getPrimitiveSizeInBits();
#else
return pVTy->getBitWidth();
// Convert <N x i1> mask to <N x i32> x86 mask
Value* VectorMask(Value* vi1Mask)
{
-#if LLVM_VERSION_MAJOR >= 11
+#if LLVM_VERSION_MAJOR >= 12
+ uint32_t numElem = cast<FixedVectorType>(vi1Mask->getType())->getNumElements();
+#elif LLVM_VERSION_MAJOR >= 11
uint32_t numElem = cast<VectorType>(vi1Mask->getType())->getNumElements();
#else
uint32_t numElem = vi1Mask->getType()->getVectorNumElements();
else
{
v32Result = UndefValue::get(v32A->getType());
-#if LLVM_VERSION_MAJOR >= 11
+#if LLVM_VERSION_MAJOR >= 12
+ uint32_t numElem = cast<FixedVectorType>(v32A->getType())->getNumElements();
+#elif LLVM_VERSION_MAJOR >= 11
uint32_t numElem = cast<VectorType>(v32A->getType())->getNumElements();
#else
uint32_t numElem = v32A->getType()->getVectorNumElements();
pBase = B->POINTER_CAST(pBase, PointerType::get(B->mInt8Ty, 0));
#if LLVM_VERSION_MAJOR >= 11
+#if LLVM_VERSION_MAJOR >= 12
+ FixedVectorType* pVectorType = cast<FixedVectorType>(vSrc->getType());
+#else
VectorType* pVectorType = cast<VectorType>(vSrc->getType());
+#endif
uint32_t numElem = pVectorType->getNumElements();
auto srcTy = pVectorType->getElementType();
#else
else if (width == W512)
{
// Double pump 4-wide for 64bit elements
-#if LLVM_VERSION_MAJOR >= 11
+#if LLVM_VERSION_MAJOR >= 12
+ if (cast<FixedVectorType>(vSrc->getType())->getElementType() == B->mDoubleTy)
+#elif LLVM_VERSION_MAJOR >= 11
if (cast<VectorType>(vSrc->getType())->getElementType() == B->mDoubleTy)
#else
if (vSrc->getType()->getVectorElementType() == B->mDoubleTy)
#endif
{
auto v64Mask = pThis->VectorMask(vi1Mask);
-#if LLVM_VERSION_MAJOR >= 11
+#if LLVM_VERSION_MAJOR >= 12
+ uint32_t numElem = cast<FixedVectorType>(v64Mask->getType())->getNumElements();
+#elif LLVM_VERSION_MAJOR >= 11
uint32_t numElem = cast<VectorType>(v64Mask->getType())->getNumElements();
#else
uint32_t numElem = v64Mask->getType()->getVectorNumElements();
Value* mask0 = B->VSHUFFLE(v64Mask, v64Mask, B->C({0, 1, 2, 3}));
Value* mask1 = B->VSHUFFLE(v64Mask, v64Mask, B->C({4, 5, 6, 7}));
-#if LLVM_VERSION_MAJOR >= 11
+#if LLVM_VERSION_MAJOR >= 12
+ uint32_t numElemSrc0 = cast<FixedVectorType>(src0->getType())->getNumElements();
+ uint32_t numElemMask0 = cast<FixedVectorType>(mask0->getType())->getNumElements();
+ uint32_t numElemSrc1 = cast<FixedVectorType>(src1->getType())->getNumElements();
+ uint32_t numElemMask1 = cast<FixedVectorType>(mask1->getType())->getNumElements();
+#elif LLVM_VERSION_MAJOR >= 11
uint32_t numElemSrc0 = cast<VectorType>(src0->getType())->getNumElements();
uint32_t numElemMask0 = cast<VectorType>(mask0->getType())->getNumElements();
uint32_t numElemSrc1 = cast<VectorType>(src1->getType())->getNumElements();
auto argType = arg.get()->getType();
if (argType->isVectorTy())
{
-#if LLVM_VERSION_MAJOR >= 11
+#if LLVM_VERSION_MAJOR >= 12
+ uint32_t vecWidth = cast<FixedVectorType>(argType)->getNumElements();
+ auto elemTy = cast<FixedVectorType>(argType)->getElementType();
+#elif LLVM_VERSION_MAJOR >= 11
uint32_t vecWidth = cast<VectorType>(argType)->getNumElements();
auto elemTy = cast<VectorType>(argType)->getElementType();
#else
if (result[0]->getType()->isVectorTy())
{
assert(result[1]->getType()->isVectorTy());
-#if LLVM_VERSION_MAJOR >= 11
+#if LLVM_VERSION_MAJOR >= 12
+ vecWidth = cast<FixedVectorType>(result[0]->getType())->getNumElements() +
+ cast<FixedVectorType>(result[1]->getType())->getNumElements();
+#elif LLVM_VERSION_MAJOR >= 11
vecWidth = cast<VectorType>(result[0]->getType())->getNumElements() +
cast<VectorType>(result[1]->getType())->getNumElements();
#else