From 5fbee5e4ef1aa3d247a50ff8792c05318c9ea98c Mon Sep 17 00:00:00 2001 From: George Kyriazis Date: Thu, 15 Mar 2018 12:08:00 -0500 Subject: swr/rast: Add MEM_ADD helper function to Builder. mem[offset] += value This function will be heavily used by all stats intrinsics. Reviewed-by: Bruce Cherniak --- 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(+) (limited to 'src/gallium/drivers/swr') diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp index a825434de73..dee08b81693 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 &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 b5383421465..59b45c1b418 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 &offset, con StoreInst *STORE(Value *Val, Value *BasePtr, const std::initializer_list &offset); StoreInst *STOREV(Value *Val, Value *BasePtr, const std::initializer_list &offset); +Value* MEM_ADD(Value* i32Incr, Value* basePtr, const std::initializer_list &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); -- cgit v1.2.3