mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
gallium/swr: use ElementCount type arguments for getSplat()
Reviewed-by: Alok Hota <alok.hota@intel.com> In LLVM11, ConstantVector::getSplat() function definition has changed and the first function argument has now ElementCount type. Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4188> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4188>
This commit is contained in:
parent
a19d8c836f
commit
5e523c9265
4 changed files with 57 additions and 17 deletions
|
|
@ -172,52 +172,92 @@ namespace SwrJit
|
|||
|
||||
Value* Builder::VIMMED1(uint64_t i)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
return ConstantVector::getSplat(ElementCount(mVWidth, false), cast<ConstantInt>(C(i)));
|
||||
#else
|
||||
return ConstantVector::getSplat(mVWidth, cast<ConstantInt>(C(i)));
|
||||
#endif
|
||||
}
|
||||
|
||||
Value* Builder::VIMMED1_16(uint64_t i)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
return ConstantVector::getSplat(ElementCount(mVWidth16, false), cast<ConstantInt>(C(i)));
|
||||
#else
|
||||
return ConstantVector::getSplat(mVWidth16, cast<ConstantInt>(C(i)));
|
||||
#endif
|
||||
}
|
||||
|
||||
Value* Builder::VIMMED1(int i)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
return ConstantVector::getSplat(ElementCount(mVWidth, false), cast<ConstantInt>(C(i)));
|
||||
#else
|
||||
return ConstantVector::getSplat(mVWidth, cast<ConstantInt>(C(i)));
|
||||
#endif
|
||||
}
|
||||
|
||||
Value* Builder::VIMMED1_16(int i)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
return ConstantVector::getSplat(ElementCount(mVWidth16, false), cast<ConstantInt>(C(i)));
|
||||
#else
|
||||
return ConstantVector::getSplat(mVWidth16, cast<ConstantInt>(C(i)));
|
||||
#endif
|
||||
}
|
||||
|
||||
Value* Builder::VIMMED1(uint32_t i)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
return ConstantVector::getSplat(ElementCount(mVWidth, false), cast<ConstantInt>(C(i)));
|
||||
#else
|
||||
return ConstantVector::getSplat(mVWidth, cast<ConstantInt>(C(i)));
|
||||
#endif
|
||||
}
|
||||
|
||||
Value* Builder::VIMMED1_16(uint32_t i)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
return ConstantVector::getSplat(ElementCount(mVWidth16, false), cast<ConstantInt>(C(i)));
|
||||
#else
|
||||
return ConstantVector::getSplat(mVWidth16, cast<ConstantInt>(C(i)));
|
||||
#endif
|
||||
}
|
||||
|
||||
Value* Builder::VIMMED1(float i)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
return ConstantVector::getSplat(ElementCount(mVWidth, false), cast<ConstantFP>(C(i)));
|
||||
#else
|
||||
return ConstantVector::getSplat(mVWidth, cast<ConstantFP>(C(i)));
|
||||
#endif
|
||||
}
|
||||
|
||||
Value* Builder::VIMMED1_16(float i)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
return ConstantVector::getSplat(ElementCount(mVWidth16, false), cast<ConstantFP>(C(i)));
|
||||
#else
|
||||
return ConstantVector::getSplat(mVWidth16, cast<ConstantFP>(C(i)));
|
||||
#endif
|
||||
}
|
||||
|
||||
Value* Builder::VIMMED1(bool i)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
return ConstantVector::getSplat(ElementCount(mVWidth, false), cast<ConstantInt>(C(i)));
|
||||
#else
|
||||
return ConstantVector::getSplat(mVWidth, cast<ConstantInt>(C(i)));
|
||||
#endif
|
||||
}
|
||||
|
||||
Value* Builder::VIMMED1_16(bool i)
|
||||
{
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
return ConstantVector::getSplat(ElementCount(mVWidth16, false), cast<ConstantInt>(C(i)));
|
||||
#else
|
||||
return ConstantVector::getSplat(mVWidth16, cast<ConstantInt>(C(i)));
|
||||
#endif
|
||||
}
|
||||
|
||||
Value* Builder::VUNDEF_IPTR() { return UndefValue::get(VectorType::get(mInt32PtrTy, mVWidth)); }
|
||||
|
|
|
|||
|
|
@ -29,12 +29,6 @@
|
|||
******************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
typedef llvm::Align AlignType;
|
||||
#else
|
||||
typedef unsigned AlignType;
|
||||
#endif
|
||||
|
||||
Constant* C(bool i);
|
||||
Constant* C(char i);
|
||||
Constant* C(uint8_t i);
|
||||
|
|
|
|||
|
|
@ -48,12 +48,6 @@ namespace SwrJit
|
|||
{
|
||||
using namespace llvm;
|
||||
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
typedef unsigned IntrinsicID;
|
||||
#else
|
||||
typedef Intrinsic::ID IntrinsicID;
|
||||
#endif
|
||||
|
||||
enum TargetArch
|
||||
{
|
||||
AVX = 0,
|
||||
|
|
@ -512,10 +506,10 @@ namespace SwrJit
|
|||
auto vi1Mask = pCallInst->getArgOperand(3);
|
||||
auto i8Scale = pCallInst->getArgOperand(4);
|
||||
|
||||
pBase = B->POINTER_CAST(pBase, PointerType::get(B->mInt8Ty, 0));
|
||||
uint32_t numElem = vSrc->getType()->getVectorNumElements();
|
||||
auto i32Scale = B->Z_EXT(i8Scale, B->mInt32Ty);
|
||||
auto srcTy = vSrc->getType()->getVectorElementType();
|
||||
pBase = B->POINTER_CAST(pBase, PointerType::get(B->mInt8Ty, 0));
|
||||
uint32_t numElem = vSrc->getType()->getVectorNumElements();
|
||||
auto i32Scale = B->Z_EXT(i8Scale, B->mInt32Ty);
|
||||
auto srcTy = vSrc->getType()->getVectorElementType();
|
||||
Value* v32Gather = nullptr;
|
||||
if (arch == AVX)
|
||||
{
|
||||
|
|
@ -526,7 +520,11 @@ namespace SwrJit
|
|||
B->STORE(vSrc, pTmp);
|
||||
|
||||
v32Gather = UndefValue::get(vSrc->getType());
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
auto vi32Scale = ConstantVector::getSplat(ElementCount(numElem, false), cast<ConstantInt>(i32Scale));
|
||||
#else
|
||||
auto vi32Scale = ConstantVector::getSplat(numElem, cast<ConstantInt>(i32Scale));
|
||||
#endif
|
||||
auto vi32Offsets = B->MUL(vi32Indices, vi32Scale);
|
||||
|
||||
for (uint32_t i = 0; i < numElem; ++i)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* Copyright (C) 2017-2018 Intel Corporation. All Rights Reserved.
|
||||
* Copyright (C) 2017-2020 Intel Corporation. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -142,6 +142,14 @@ static inline llvm::AttributeSet GetFuncAttribSet(llvm::LLVMContext& ctx,
|
|||
#pragma pop_macro("DEBUG")
|
||||
#endif
|
||||
|
||||
#if LLVM_VERSION_MAJOR > 10
|
||||
typedef unsigned IntrinsicID;
|
||||
typedef llvm::Align AlignType;
|
||||
#else
|
||||
typedef llvm::Intrinsic::ID IntrinsicID;
|
||||
typedef unsigned AlignType;
|
||||
#endif
|
||||
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <unordered_map>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue