summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp40
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h6
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp18
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp10
4 files changed, 57 insertions, 17 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
index 96175692259..4b844e3684f 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
@@ -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)); }
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
index 242c98c9353..616c73b254a 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
@@ -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);
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 3c728084afe..f6c09600d99 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp
@@ -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)
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
index 6b9a6b3375f..1bdba9d9acd 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
@@ -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>