Module: Mesa Branch: master Commit: 28df8ffde7cf9a53e1ce6cf13e6b495fb4865295 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=28df8ffde7cf9a53e1ce6cf13e6b495fb4865295
Author: jzielins <[email protected]> Date: Mon Sep 7 16:49:35 2020 +0200 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 <[email protected]> Closes: #3490 Fixes: 639605e5ba947bb947313a6584ef7fbb8619e9c2 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6648> --- .../drivers/swr/rasterizer/jitter/builder_misc.cpp | 80 ++++++++++++++-------- .../rasterizer/jitter/functionpasses/lower_x86.cpp | 8 ++- 2 files changed, 55 insertions(+), 33 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp index 530752850c6..fc5d782a55c 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp @@ -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 } diff --git a/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp b/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp index 216121bc51f..7ee22899c12 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp @@ -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); _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
