[Mesa-dev] [PATCH 10/20] swr/rast: x86 autogenerated macro work
George Kyriazis
george.kyriazis at intel.com
Fri Jan 19 21:47:05 UTC 2018
Add name argument to x86 autogenerated macros.
Add useful variable names for DCL_inputVec implementation.
---
.../swr/rasterizer/codegen/gen_llvm_ir_macros.py | 2 +-
.../swr/rasterizer/codegen/templates/gen_builder.hpp | 2 +-
.../drivers/swr/rasterizer/jitter/builder_misc.cpp | 17 +++++++++--------
.../drivers/swr/rasterizer/jitter/builder_misc.h | 8 ++++----
4 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
index 9544353..3b19cb4 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
@@ -223,7 +223,7 @@ def generate_x86_h(output_dir):
declargs = 'Value* ' + ', Value* '.join(inst[2])
functions.append({
- 'decl' : 'Value* %s(%s)' % (inst[0], declargs),
+ 'decl' : 'Value* %s(%s, const llvm::Twine& name = "")' % (inst[0], declargs),
'args' : ', '.join(inst[2]),
'intrin' : inst[1],
})
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp
index 2e95758..b6cf03e 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp
+++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp
@@ -41,7 +41,7 @@ ${func['decl']}
{
%if isX86:
Function *pFunc = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::${func['intrin']});
- return CALL(pFunc, std::initializer_list<Value*>{${func['args']}});
+ return CALL(pFunc, std::initializer_list<Value*>{${func['args']}}, name);
%else:
return IRB()->${func['intrin']}(${func['args']});
%endif
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
index af9c0e5..f70c8db 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
@@ -267,7 +267,7 @@ namespace SwrJit
return UndefValue::get(VectorType::get(ty, size));
}
- Value *Builder::VBROADCAST(Value *src)
+ Value *Builder::VBROADCAST(Value *src, const llvm::Twine& name)
{
// check if src is already a vector
if (src->getType()->isVectorTy())
@@ -275,7 +275,7 @@ namespace SwrJit
return src;
}
- return VECTOR_SPLAT(mVWidth, src);
+ return VECTOR_SPLAT(mVWidth, src, name);
}
Value *Builder::VBROADCAST_16(Value *src)
@@ -367,12 +367,12 @@ namespace SwrJit
return STORE(val, GEPA(basePtr, valIndices));
}
- CallInst *Builder::CALL(Value *Callee, const std::initializer_list<Value*> &argsList)
+ CallInst *Builder::CALL(Value *Callee, const std::initializer_list<Value*> &argsList, const llvm::Twine& name)
{
std::vector<Value*> args;
for (auto arg : argsList)
args.push_back(arg);
- return CALLA(Callee, args);
+ return CALLA(Callee, args, name);
}
CallInst *Builder::CALL(Value *Callee, Value* arg)
@@ -406,9 +406,9 @@ namespace SwrJit
return CALL(func);
}
- Value *Builder::VRCP(Value *va)
+ Value *Builder::VRCP(Value *va, const llvm::Twine& name)
{
- return FDIV(VIMMED1(1.0f), va); // 1 / a
+ return FDIV(VIMMED1(1.0f), va, name); // 1 / a
}
Value *Builder::VPLANEPS(Value* vA, Value* vB, Value* vC, Value* &vX, Value* &vY)
@@ -990,11 +990,11 @@ namespace SwrJit
/// @brief Generate a VCVTPH2PS operation (float16->float32 conversion)
/// in LLVM IR. If not supported on the underlying platform, emulate it
/// @param a - 128bit SIMD lane(8x16bit) of float16 in int16 format.
- Value *Builder::CVTPH2PS(Value* a)
+ Value *Builder::CVTPH2PS(Value* a, const llvm::Twine& name)
{
if (JM()->mArch.F16C())
{
- return VCVTPH2PS(a);
+ return VCVTPH2PS(a, name);
}
else
{
@@ -1014,6 +1014,7 @@ namespace SwrJit
pResult = VINSERT(pResult, pConv, C(i));
}
+ pResult->setName(name);
return pResult;
}
}
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
index 7eb65f3..609e0b2 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.h
@@ -81,10 +81,10 @@ Value *VUNDEF(Type* ty, uint32_t size);
Value *VUNDEF_IPTR();
-Value *VBROADCAST(Value *src);
+Value *VBROADCAST(Value *src, const llvm::Twine& name = "");
Value *VBROADCAST_16(Value *src);
-Value *VRCP(Value *va);
+Value *VRCP(Value *va, const llvm::Twine& name = "");
Value *VPLANEPS(Value* vA, Value* vB, Value* vC, Value* &vX, Value* &vY);
uint32_t IMMED(Value* i);
@@ -95,7 +95,7 @@ Value *GEP(Value* ptr, const std::initializer_list<uint32_t> &indexList);
Value *IN_BOUNDS_GEP(Value* ptr, const std::initializer_list<Value*> &indexList);
Value *IN_BOUNDS_GEP(Value* ptr, const std::initializer_list<uint32_t> &indexList);
-CallInst *CALL(Value *Callee, const std::initializer_list<Value*> &args);
+CallInst *CALL(Value *Callee, const std::initializer_list<Value*> &args, const llvm::Twine& name = "");
CallInst *CALL(Value *Callee) { return CALLA(Callee); }
CallInst *CALL(Value *Callee, Value* arg);
CallInst *CALL2(Value *Callee, Value* arg1, Value* arg2);
@@ -158,7 +158,7 @@ Value *PMOVSXBD(Value* a);
Value *PMOVSXWD(Value* a);
Value *PERMD(Value* a, Value* idx);
Value *PERMPS(Value* a, Value* idx);
-Value *CVTPH2PS(Value* a);
+Value *CVTPH2PS(Value* a, const llvm::Twine& name = "");
Value *CVTPS2PH(Value* a, Value* rounding);
Value *PMAXSD(Value* a, Value* b);
Value *PMINSD(Value* a, Value* b);
--
2.7.4
More information about the mesa-dev
mailing list