From 7caeee34328efa17868544c4a4b26ffc99af5017 Mon Sep 17 00:00:00 2001 From: George Kyriazis Date: Tue, 24 Apr 2018 16:44:19 -0500 Subject: [PATCH] swr/rast: Small editorial changes Reviewed-by: Bruce Cherniak --- .../swr/rasterizer/jitter/builder_gfx_mem.cpp | 33 +++++++++---------- .../swr/rasterizer/jitter/builder_gfx_mem.h | 1 + .../jitter/functionpasses/lower_x86.cpp | 2 +- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp index 03e34db3181..c6d06190439 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.cpp @@ -55,6 +55,7 @@ namespace SwrJit SWR_ASSERT(!(ptr->getType() == mInt64Ty && usage == MEM_CLIENT_INTERNAL), "Internal memory should not be gfxptr_t."); } + ////////////////////////////////////////////////////////////////////////// /// @brief Generate a masked gather operation in LLVM IR. If not /// supported on the underlying platform, emulate it with loads @@ -63,17 +64,15 @@ namespace SwrJit /// @param vIndices - SIMD wide value of VB byte offsets /// @param vMask - SIMD wide mask that controls whether to access memory or the src values /// @param scale - value to scale indices by - Value *BuilderGfxMem::GATHERPS(Value *vSrc, Value *pBase, Value *vIndices, Value *vMask, uint8_t scale, JIT_MEM_CLIENT usage) + Value* BuilderGfxMem::GATHERPS(Value* vSrc, Value* pBase, Value* vIndices, Value* vMask, uint8_t scale, JIT_MEM_CLIENT usage) { - Value *vGather; - // address may be coming in as 64bit int now so get the pointer if (pBase->getType() == mInt64Ty) { pBase = INT_TO_PTR(pBase, PointerType::get(mInt8Ty, 0)); } - vGather = Builder::GATHERPS(vSrc, pBase, vIndices, vMask, scale); + Value* vGather = Builder::GATHERPS(vSrc, pBase, vIndices, vMask, scale); return vGather; } @@ -85,10 +84,8 @@ namespace SwrJit /// @param vIndices - SIMD wide value of VB byte offsets /// @param vMask - SIMD wide mask that controls whether to access memory or the src values /// @param scale - value to scale indices by - Value *BuilderGfxMem::GATHERDD(Value* vSrc, Value* pBase, Value* vIndices, Value* vMask, uint8_t scale, JIT_MEM_CLIENT usage) + Value* BuilderGfxMem::GATHERDD(Value* vSrc, Value* pBase, Value* vIndices, Value* vMask, uint8_t scale, JIT_MEM_CLIENT usage) { - Value* vGather = VIMMED1(0.0f); - // address may be coming in as 64bit int now so get the pointer if (pBase->getType() == mInt64Ty) @@ -96,7 +93,7 @@ namespace SwrJit pBase = INT_TO_PTR(pBase, PointerType::get(mInt8Ty, 0)); } - vGather = Builder::GATHERDD(vSrc, pBase, vIndices, vMask, scale); + Value* vGather = Builder::GATHERDD(vSrc, pBase, vIndices, vMask, scale); return vGather; } @@ -106,31 +103,31 @@ namespace SwrJit return ADD(base, offset); } - Value *BuilderGfxMem::GEP(Value *Ptr, Value *Idx, Type *Ty, const Twine &Name) + Value* BuilderGfxMem::GEP(Value* Ptr, Value* Idx, Type *Ty, const Twine &Name) { Ptr = TranslationHelper(Ptr, Ty); return Builder::GEP(Ptr, Idx, nullptr, Name); } - Value *BuilderGfxMem::GEP(Type *Ty, Value *Ptr, Value *Idx, const Twine &Name) + Value* BuilderGfxMem::GEP(Type *Ty, Value* Ptr, Value* Idx, const Twine &Name) { Ptr = TranslationHelper(Ptr, Ty); return Builder::GEP(Ty, Ptr, Idx, Name); } - Value *BuilderGfxMem::GEP(Value* Ptr, const std::initializer_list &indexList, Type *Ty) + Value* BuilderGfxMem::GEP(Value* Ptr, const std::initializer_list &indexList, Type *Ty) { Ptr = TranslationHelper(Ptr, Ty); return Builder::GEP(Ptr, indexList); } - Value *BuilderGfxMem::GEP(Value* Ptr, const std::initializer_list &indexList, Type *Ty) + Value* BuilderGfxMem::GEP(Value* Ptr, const std::initializer_list &indexList, Type *Ty) { Ptr = TranslationHelper(Ptr, Ty); return Builder::GEP(Ptr, indexList); } - Value* BuilderGfxMem::TranslationHelper(Value *Ptr, Type *Ty) + Value* BuilderGfxMem::TranslationHelper(Value* Ptr, Type *Ty) { SWR_ASSERT(!(Ptr->getType() == mInt64Ty && Ty == nullptr), "Access of GFX pointers must have non-null type specified."); @@ -144,7 +141,7 @@ namespace SwrJit return Ptr; } - LoadInst* BuilderGfxMem::LOAD(Value *Ptr, const char *Name, Type *Ty, JIT_MEM_CLIENT usage) + LoadInst* BuilderGfxMem::LOAD(Value* Ptr, const char *Name, Type *Ty, JIT_MEM_CLIENT usage) { AssertGFXMemoryParams(Ptr, usage); @@ -152,7 +149,7 @@ namespace SwrJit return Builder::LOAD(Ptr, Name); } - LoadInst* BuilderGfxMem::LOAD(Value *Ptr, const Twine &Name, Type *Ty, JIT_MEM_CLIENT usage) + LoadInst* BuilderGfxMem::LOAD(Value* Ptr, const Twine &Name, Type *Ty, JIT_MEM_CLIENT usage) { AssertGFXMemoryParams(Ptr, usage); @@ -160,7 +157,7 @@ namespace SwrJit return Builder::LOAD(Ptr, Name); } - LoadInst* BuilderGfxMem::LOAD(Value *Ptr, bool isVolatile, const Twine &Name, Type *Ty, JIT_MEM_CLIENT usage) + LoadInst* BuilderGfxMem::LOAD(Value* Ptr, bool isVolatile, const Twine &Name, Type *Ty, JIT_MEM_CLIENT usage) { AssertGFXMemoryParams(Ptr, usage); @@ -168,7 +165,7 @@ namespace SwrJit return Builder::LOAD(Ptr, isVolatile, Name); } - LoadInst *BuilderGfxMem::LOAD(Value *BasePtr, const std::initializer_list &offset, const llvm::Twine& name, Type *Ty, JIT_MEM_CLIENT usage) + LoadInst* BuilderGfxMem::LOAD(Value* BasePtr, const std::initializer_list &offset, const llvm::Twine& name, Type *Ty, JIT_MEM_CLIENT usage) { AssertGFXMemoryParams(BasePtr, usage); @@ -193,7 +190,7 @@ namespace SwrJit return LOAD(BasePtr, name, Ty, usage); } - CallInst* BuilderGfxMem::MASKED_LOAD(Value *Ptr, unsigned Align, Value *Mask, Value *PassThru, const Twine &Name, Type *Ty, JIT_MEM_CLIENT usage) + CallInst* BuilderGfxMem::MASKED_LOAD(Value* Ptr, unsigned Align, Value* Mask, Value* PassThru, const Twine &Name, Type *Ty, JIT_MEM_CLIENT usage) { AssertGFXMemoryParams(Ptr, usage); diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h index d1a25c42acc..b4d4726b218 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_gfx_mem.h @@ -89,6 +89,7 @@ namespace SwrJit Value* GetTranslationFunction() { return mpfnTranslateGfxAddress; } Value* GetParamSimDC() { return mpParamSimDC; } + private: FunctionType* mpTranslationFuncTy; 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 b8c329635c1..3caea67e169 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/functionpasses/lower_x86.cpp @@ -408,7 +408,7 @@ namespace SwrJit auto vi1Mask = pCallInst->getArgOperand(3); auto i8Scale = pCallInst->getArgOperand(4); - pBase = B->INT_TO_PTR(pBase, PointerType::get(B->mInt8Ty, 0)); + 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(); -- 2.30.2