ac: add ac_build_tbuffer_load_byte() helper
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 13 Mar 2019 14:55:42 +0000 (15:55 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 21 Mar 2019 08:02:14 +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 195fdcb224dab792752a59d391798a7d39b58e53..58e4ffaa2edd30a7ddaf7173e8e5efbbd792ad40 100644 (file)
@@ -1606,6 +1606,24 @@ ac_build_tbuffer_load_short(struct ac_llvm_context *ctx,
        return LLVMBuildTrunc(ctx->builder, res, ctx->i16, "");
 }
 
+LLVMValueRef
+ac_build_tbuffer_load_byte(struct ac_llvm_context *ctx,
+                          LLVMValueRef rsrc,
+                          LLVMValueRef voffset,
+                          LLVMValueRef soffset,
+                          LLVMValueRef immoffset,
+                          bool glc)
+{
+       unsigned dfmt = V_008F0C_BUF_DATA_FORMAT_8;
+       unsigned nfmt = V_008F0C_BUF_NUM_FORMAT_UINT;
+       LLVMValueRef res;
+
+       res = ac_build_raw_tbuffer_load(ctx, rsrc, voffset, soffset,
+                                       immoffset, 1, dfmt, nfmt, glc, false,
+                                       false);
+
+       return LLVMBuildTrunc(ctx->builder, res, ctx->i8, "");
+}
 static void
 ac_build_llvm8_tbuffer_store(struct ac_llvm_context *ctx,
                             LLVMValueRef rsrc,
index f6bf473f6a11636cbb8950afa8a1b6cfd2b65860..0162986e454e26505d5e958719367b6bd82f091a 100644 (file)
@@ -318,6 +318,14 @@ ac_build_tbuffer_load_short(struct ac_llvm_context *ctx,
                            LLVMValueRef immoffset,
                            bool glc);
 
+LLVMValueRef
+ac_build_tbuffer_load_byte(struct ac_llvm_context *ctx,
+                          LLVMValueRef rsrc,
+                          LLVMValueRef voffset,
+                          LLVMValueRef soffset,
+                          LLVMValueRef immoffset,
+                          bool glc);
+
 LLVMValueRef
 ac_build_struct_tbuffer_load(struct ac_llvm_context *ctx,
                             LLVMValueRef rsrc,