swr: Use ElemenCount constructor for LLVM 11

In LLVM 12 ElementCount constructor is private
and instead of using it explicitly, ::get function
should be used, but in LLVM 11, the constructor
is still the way to go.

Reviewed-by: Krzysztof Raszkowski <krzysztof.raszkowski@intel.com>
Closes: #3490
Fixes: 639605e5ba
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6648>
This commit is contained in:
jzielins 2020-09-07 16:49:35 +02:00
parent 6049dc1a9d
commit 28df8ffde7
2 changed files with 55 additions and 33 deletions

View file

@ -133,91 +133,111 @@ namespace SwrJit
Value* Builder::VIMMED1(uint64_t i)
{
#if LLVM_VERSION_MAJOR > 10
return ConstantVector::getSplat(ElementCount::get(mVWidth, false), cast<ConstantInt>(C(i)));
#else
#if LLVM_VERSION_MAJOR <= 10
return ConstantVector::getSplat(mVWidth, cast<ConstantInt>(C(i)));
#elif LLVM_VERSION_MAJOR == 11
return ConstantVector::getSplat(ElementCount(mVWidth, false), cast<ConstantInt>(C(i)));
#else
return ConstantVector::getSplat(ElementCount::get(mVWidth, false), cast<ConstantInt>(C(i)));
#endif
}
Value* Builder::VIMMED1_16(uint64_t i)
{
#if LLVM_VERSION_MAJOR > 10
return ConstantVector::getSplat(ElementCount::get(mVWidth16, false), cast<ConstantInt>(C(i)));
#else
#if LLVM_VERSION_MAJOR <= 10
return ConstantVector::getSplat(mVWidth16, cast<ConstantInt>(C(i)));
#elif LLVM_VERSION_MAJOR == 11
return ConstantVector::getSplat(ElementCount(mVWidth16, false), cast<ConstantInt>(C(i)));
#else
return ConstantVector::getSplat(ElementCount::get(mVWidth16, false), cast<ConstantInt>(C(i)));
#endif
}
Value* Builder::VIMMED1(int i)
{
#if LLVM_VERSION_MAJOR > 10
return ConstantVector::getSplat(ElementCount::get(mVWidth, false), cast<ConstantInt>(C(i)));
#else
#if LLVM_VERSION_MAJOR <= 10
return ConstantVector::getSplat(mVWidth, cast<ConstantInt>(C(i)));
#elif LLVM_VERSION_MAJOR == 11
return ConstantVector::getSplat(ElementCount(mVWidth, false), cast<ConstantInt>(C(i)));
#else
return ConstantVector::getSplat(ElementCount::get(mVWidth, false), cast<ConstantInt>(C(i)));
#endif
}
Value* Builder::VIMMED1_16(int i)
{
#if LLVM_VERSION_MAJOR > 10
return ConstantVector::getSplat(ElementCount::get(mVWidth16, false), cast<ConstantInt>(C(i)));
#else
#if LLVM_VERSION_MAJOR <= 10
return ConstantVector::getSplat(mVWidth16, cast<ConstantInt>(C(i)));
#elif LLVM_VERSION_MAJOR == 11
return ConstantVector::getSplat(ElementCount(mVWidth16, false), cast<ConstantInt>(C(i)));
#else
return ConstantVector::getSplat(ElementCount::get(mVWidth16, false), cast<ConstantInt>(C(i)));
#endif
}
Value* Builder::VIMMED1(uint32_t i)
{
#if LLVM_VERSION_MAJOR > 10
return ConstantVector::getSplat(ElementCount::get(mVWidth, false), cast<ConstantInt>(C(i)));
#else
#if LLVM_VERSION_MAJOR <= 10
return ConstantVector::getSplat(mVWidth, cast<ConstantInt>(C(i)));
#elif LLVM_VERSION_MAJOR == 11
return ConstantVector::getSplat(ElementCount(mVWidth, false), cast<ConstantInt>(C(i)));
#else
return ConstantVector::getSplat(ElementCount::get(mVWidth, false), cast<ConstantInt>(C(i)));
#endif
}
Value* Builder::VIMMED1_16(uint32_t i)
{
#if LLVM_VERSION_MAJOR > 10
return ConstantVector::getSplat(ElementCount::get(mVWidth16, false), cast<ConstantInt>(C(i)));
#else
#if LLVM_VERSION_MAJOR <= 10
return ConstantVector::getSplat(mVWidth16, cast<ConstantInt>(C(i)));
#elif LLVM_VERSION_MAJOR == 11
return ConstantVector::getSplat(ElementCount(mVWidth16, false), cast<ConstantInt>(C(i)));
#else
return ConstantVector::getSplat(ElementCount::get(mVWidth16, false), cast<ConstantInt>(C(i)));
#endif
}
Value* Builder::VIMMED1(float i)
{
#if LLVM_VERSION_MAJOR > 10
return ConstantVector::getSplat(ElementCount::get(mVWidth, false), cast<ConstantFP>(C(i)));
#else
#if LLVM_VERSION_MAJOR <= 10
return ConstantVector::getSplat(mVWidth, cast<ConstantFP>(C(i)));
#elif LLVM_VERSION_MAJOR == 11
return ConstantVector::getSplat(ElementCount(mVWidth, false), cast<ConstantFP>(C(i)));
#else
return ConstantVector::getSplat(ElementCount::get(mVWidth, false), cast<ConstantFP>(C(i)));
#endif
}
Value* Builder::VIMMED1_16(float i)
{
#if LLVM_VERSION_MAJOR > 10
return ConstantVector::getSplat(ElementCount::get(mVWidth16, false), cast<ConstantFP>(C(i)));
#else
#if LLVM_VERSION_MAJOR <= 10
return ConstantVector::getSplat(mVWidth16, cast<ConstantFP>(C(i)));
#elif LLVM_VERSION_MAJOR == 11
return ConstantVector::getSplat(ElementCount(mVWidth16, false), cast<ConstantFP>(C(i)));
#else
return ConstantVector::getSplat(ElementCount::get(mVWidth16, false), cast<ConstantFP>(C(i)));
#endif
}
Value* Builder::VIMMED1(bool i)
{
#if LLVM_VERSION_MAJOR > 10
return ConstantVector::getSplat(ElementCount::get(mVWidth, false), cast<ConstantInt>(C(i)));
#else
#if LLVM_VERSION_MAJOR <= 10
return ConstantVector::getSplat(mVWidth, cast<ConstantInt>(C(i)));
#elif LLVM_VERSION_MAJOR == 11
return ConstantVector::getSplat(ElementCount(mVWidth, false), cast<ConstantInt>(C(i)));
#else
return ConstantVector::getSplat(ElementCount::get(mVWidth, false), cast<ConstantInt>(C(i)));
#endif
}
Value* Builder::VIMMED1_16(bool i)
{
#if LLVM_VERSION_MAJOR > 10
return ConstantVector::getSplat(ElementCount::get(mVWidth16, false), cast<ConstantInt>(C(i)));
#else
#if LLVM_VERSION_MAJOR <= 10
return ConstantVector::getSplat(mVWidth16, cast<ConstantInt>(C(i)));
#elif LLVM_VERSION_MAJOR == 11
return ConstantVector::getSplat(ElementCount(mVWidth16, false), cast<ConstantInt>(C(i)));
#else
return ConstantVector::getSplat(ElementCount::get(mVWidth16, false), cast<ConstantInt>(C(i)));
#endif
}

View file

@ -555,10 +555,12 @@ namespace SwrJit
B->STORE(vSrc, pTmp);
v32Gather = UndefValue::get(vSrc->getType());
#if LLVM_VERSION_MAJOR > 10
auto vi32Scale = ConstantVector::getSplat(ElementCount::get(numElem, false), cast<ConstantInt>(i32Scale));
#else
#if LLVM_VERSION_MAJOR <= 10
auto vi32Scale = ConstantVector::getSplat(numElem, cast<ConstantInt>(i32Scale));
#elif LLVM_VERSION_MAJOR == 11
auto vi32Scale = ConstantVector::getSplat(ElementCount(numElem, false), cast<ConstantInt>(i32Scale));
#else
auto vi32Scale = ConstantVector::getSplat(ElementCount::get(numElem, false), cast<ConstantInt>(i32Scale));
#endif
auto vi32Offsets = B->MUL(vi32Indices, vi32Scale);