ac: add ac_build_tbuffer_store_byte() helper
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 13 Mar 2019 15:08:32 +0000 (16:08 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 21 Mar 2019 08:02:18 +0000 (09:02 +0100)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_llvm_build.c
src/amd/common/ac_llvm_build.h

index 58e4ffaa2edd30a7ddaf7173e8e5efbbd792ad40..b5bb399eef1bf530b9da31b032d9d4d7b94923e1 100644 (file)
@@ -1771,6 +1771,25 @@ ac_build_tbuffer_store_short(struct ac_llvm_context *ctx,
                                   writeonly_memory);
 }
 
+void
+ac_build_tbuffer_store_byte(struct ac_llvm_context *ctx,
+                           LLVMValueRef rsrc,
+                           LLVMValueRef vdata,
+                           LLVMValueRef voffset,
+                           LLVMValueRef soffset,
+                           bool glc,
+                           bool writeonly_memory)
+{
+       unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_8;
+       unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT;
+
+       vdata = LLVMBuildBitCast(ctx->builder, vdata, ctx->i8, "");
+       vdata = LLVMBuildZExt(ctx->builder, vdata, ctx->i32, "");
+
+       ac_build_raw_tbuffer_store(ctx, rsrc, vdata, voffset, soffset,
+                                  ctx->i32_0, 1, dfmt, nfmt, glc, false,
+                                  writeonly_memory);
+}
 /**
  * Set range metadata on an instruction.  This can only be used on load and
  * call instructions.  If you know an instruction can only produce the values
index 0162986e454e26505d5e958719367b6bd82f091a..aa6e913c6c696f9adf8971038d87feb99ea705c0 100644 (file)
@@ -362,6 +362,15 @@ ac_build_tbuffer_store_short(struct ac_llvm_context *ctx,
                             bool glc,
                             bool writeonly_memory);
 
+void
+ac_build_tbuffer_store_byte(struct ac_llvm_context *ctx,
+                           LLVMValueRef rsrc,
+                           LLVMValueRef vdata,
+                           LLVMValueRef voffset,
+                           LLVMValueRef soffset,
+                           bool glc,
+                           bool writeonly_memory);
+
 void
 ac_build_struct_tbuffer_store(struct ac_llvm_context *ctx,
                              LLVMValueRef rsrc,