swr/rast: Move memory-related JIT functions
[mesa.git] / src / gallium / drivers / swr / rasterizer / jitter / builder_misc.h
index 3df569d2d4652fb6f62ff5bfc7121c73003f8d8c..50d7a1e71fafd680807aa7f565bfcf656d043ab0 100644 (file)
@@ -49,40 +49,52 @@ Constant *C(const std::initializer_list<Ty> &constList)
     return ConstantVector::get(vConsts);
 }
 
+template<typename Ty>
+Constant *CA(LLVMContext& ctx, ArrayRef<Ty> constList)
+{
+    return ConstantDataArray::get(ctx, constList);
+}
+
 Constant *PRED(bool pred);
+
 Value *VIMMED1(int i);
+Value *VIMMED1_16(int i);
+
 Value *VIMMED1(uint32_t i);
+Value *VIMMED1_16(uint32_t i);
+
 Value *VIMMED1(float i);
+Value *VIMMED1_16(float i);
+
 Value *VIMMED1(bool i);
+Value *VIMMED1_16(bool i);
+
 Value *VUNDEF(Type* t);
+
 Value *VUNDEF_F();
+Value *VUNDEF_F_16();
+
 Value *VUNDEF_I();
+Value *VUNDEF_I_16();
+
 Value *VUNDEF(Type* ty, uint32_t size);
+
 Value *VUNDEF_IPTR();
-#if HAVE_LLVM == 0x306
-Value *VINSERT(Value *vec, Value *val, uint64_t index);
-#endif
-Value *VBROADCAST(Value *src);
-Value *VRCP(Value *va);
+
+Value *VBROADCAST(Value *src, const llvm::Twine& name = "");
+Value *VBROADCAST_16(Value *src);
+
+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);
 int32_t S_IMMED(Value* i);
 
-Value *GEP(Value* ptr, const std::initializer_list<Value*> &indexList);
-Value *GEP(Value* ptr, const std::initializer_list<uint32_t> &indexList);
-CallInst *CALL(Value *Callee, const std::initializer_list<Value*> &args);
-#if HAVE_LLVM > 0x306
+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);
 CallInst *CALL3(Value *Callee, Value* arg1, Value* arg2, Value* arg3);
-#endif
-
-LoadInst *LOAD(Value *BasePtr, const std::initializer_list<uint32_t> &offset, const llvm::Twine& name = "");
-LoadInst *LOADV(Value *BasePtr, const std::initializer_list<Value*> &offset, const llvm::Twine& name = "");
-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 *VCMPPS_EQ(Value* a, Value* b)    { return VCMPPS(a, b, C((uint8_t)_CMP_EQ_OQ)); }
 Value *VCMPPS_LT(Value* a, Value* b)    { return VCMPPS(a, b, C((uint8_t)_CMP_LT_OQ)); }
@@ -93,37 +105,26 @@ Value *VCMPPS_GE(Value* a, Value* b)    { return VCMPPS(a, b, C((uint8_t)_CMP_GE
 Value *VCMPPS_GT(Value* a, Value* b)    { return VCMPPS(a, b, C((uint8_t)_CMP_GT_OQ)); }
 Value *VCMPPS_NOTNAN(Value* a, Value* b){ return VCMPPS(a, b, C((uint8_t)_CMP_ORD_Q)); }
 
-Value *MASK(Value* vmask);
-Value *VMASK(Value* mask);
+Value *MASK(Value *vmask);
+Value *MASK_16(Value *vmask);
+
+Value *VMASK(Value *mask);
+Value *VMASK_16(Value *mask);
 
 //////////////////////////////////////////////////////////////////////////
 /// @brief functions that build IR to call x86 intrinsics directly, or
 /// emulate them with other instructions if not available on the host
 //////////////////////////////////////////////////////////////////////////
-Value *MASKLOADD(Value* src, Value* mask);
-
-void Gather4(const SWR_FORMAT format, Value* pSrcBase, Value* byteOffsets,
-                      Value* mask, Value* vGatherComponents[], bool bPackedOutput);
-
-Value *GATHERPS(Value* src, Value* pBase, Value* indices, Value* mask, Value* scale);
-void GATHER4PS(const SWR_FORMAT_INFO &info, Value* pSrcBase, Value* byteOffsets,
-               Value* mask, Value* vGatherComponents[], bool bPackedOutput);
-
-Value *GATHERDD(Value* src, Value* pBase, Value* indices, Value* mask, Value* scale);
-void GATHER4DD(const SWR_FORMAT_INFO &info, Value* pSrcBase, Value* byteOffsets,
-               Value* mask, Value* vGatherComponents[], bool bPackedOutput);
-
-void SCATTERPS(Value* pDst, Value* vSrc, Value* vOffsets, Value* vMask);
 
-void Shuffle8bpcGather4(const SWR_FORMAT_INFO &info, Value* vGatherInput, Value* vGatherOutput[], bool bPackedOutput);
-void Shuffle16bpcGather4(const SWR_FORMAT_INFO &info, Value* vGatherInput[], Value* vGatherOutput[], bool bPackedOutput);
+Value *EXTRACT_16(Value *x, uint32_t imm);
+Value *JOIN_16(Value *a, Value *b);
 
 Value *PSHUFB(Value* a, Value* b);
 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);
@@ -139,18 +140,17 @@ Value *VPCMPGTD(Value* a, Value* b)
     return S_EXT(vIndexMask,VectorType::get(mInt32Ty,JM()->mVWidth));
 }
 
-Value *ICLAMP(Value* src, Value* low, Value* high);
+Value *ICLAMP(Value* src, Value* low, Value* high, const llvm::Twine& name = "");
 Value *FCLAMP(Value* src, Value* low, Value* high);
 Value *FCLAMP(Value* src, float low, float high);
 
 CallInst *PRINT(const std::string &printStr);
 CallInst *PRINT(const std::string &printStr,const std::initializer_list<Value*> &printArgs);
-Value* STACKSAVE();
-void STACKRESTORE(Value* pSaved);
 
 Value* POPCNT(Value* a);
 
-Value* INT3() { return INTERRUPT(C((uint8_t)3)); }
+Value* DEBUGTRAP();
+Value* INT3() { return DEBUGTRAP(); }
 
 
 Value *VEXTRACTI128(Value* a, Constant* imm8);
@@ -161,7 +161,6 @@ void RDTSC_START(Value* pBucketMgr, Value* pId);
 void RDTSC_STOP(Value* pBucketMgr, Value* pId);
 
 Value* CreateEntryAlloca(Function* pFunc, Type* pType);
+Value* CreateEntryAlloca(Function* pFunc, Type* pType, Value* pArraySize);
 
-// Static stack allocations for scatter operations
-Value* pScatterStackSrc{ nullptr };
-Value* pScatterStackOffsets{ nullptr };
\ No newline at end of file
+uint32_t GetTypeSize(Type* pType);