[Mesa-dev] [PATCH v2 13/45] swr/rast: Add MEM_ADD helper function to Builder.
George Kyriazis
george.kyriazis at intel.com
Wed Apr 18 01:31:53 UTC 2018
mem[offset] += value
This function will be heavily used by all stats intrinsics.
---
src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp | 7 +++++++
src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h | 2 ++
2 files changed, 9 insertions(+)
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
index a825434..dee08b8 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp
@@ -134,6 +134,13 @@ namespace SwrJit
return GEP(base, offset);
}
+ Value* Builder::MEM_ADD(Value* i32Incr, Value* basePtr, const std::initializer_list<uint32_t> &indices, const llvm::Twine& name)
+ {
+ Value* i32Value = LOAD(GEP(basePtr, indices), name);
+ Value* i32Result = ADD(i32Value, i32Incr);
+ return STORE(i32Result, GEP(basePtr, indices));
+ }
+
//////////////////////////////////////////////////////////////////////////
/// @brief Generate a masked gather operation in LLVM IR. If not
/// supported on the underlying platform, emulate it with loads
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h
index b538342..59b45c1 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h
+++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h
@@ -60,6 +60,8 @@ LoadInst *LOADV(Value *BasePtr, const std::initializer_list<Value*> &offset, con
StoreInst *STORE(Value *Val, Value *BasePtr, const std::initializer_list<uint32_t> &offset);
StoreInst *STOREV(Value *Val, Value *BasePtr, const std::initializer_list<Value*> &offset);
+Value* MEM_ADD(Value* i32Incr, Value* basePtr, const std::initializer_list<uint32_t> &indices, const llvm::Twine& name = "");
+
void Gather4(const SWR_FORMAT format, Value* pSrcBase, Value* byteOffsets,
Value* mask, Value* vGatherComponents[], bool bPackedOutput, JIT_MEM_CLIENT usage = MEM_CLIENT_INTERNAL);
--
2.7.4
More information about the mesa-dev
mailing list