diff options
author | George Kyriazis <[email protected]> | 2018-03-15 12:08:00 -0500 |
---|---|---|
committer | George Kyriazis <[email protected]> | 2018-04-18 10:51:38 -0500 |
commit | 5fbee5e4ef1aa3d247a50ff8792c05318c9ea98c (patch) | |
tree | fb93e263b237085fca311ecece28158b8102bf81 /src | |
parent | 9103119cb36fbcfd591df8c722fa9941aaa9a911 (diff) |
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/builder_mem.cpp | 7 | ||||
-rw-r--r-- | src/gallium/drivers/swr/rasterizer/jitter/builder_mem.h | 2 |
2 files changed, 9 insertions, 0 deletions
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<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 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<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); |