From f925f5b074b2ed22c44cc715aaacc554df904317 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 26 Oct 2017 14:43:51 +1000 Subject: ac/nir: move lds declaration/load/store into shared code. This was duplicated between both drivers, share here. Reviewed-by: Timothy Arceri Signed-off-by: Dave Airlie --- src/amd/common/ac_llvm_build.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/amd/common/ac_llvm_build.c') diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 80b027e8b08..7e370845f36 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -1748,3 +1748,26 @@ void ac_init_exec_full_mask(struct ac_llvm_context *ctx) "llvm.amdgcn.init.exec", ctx->voidt, &full_mask, 1, AC_FUNC_ATTR_CONVERGENT); } + +void ac_declare_lds_as_pointer(struct ac_llvm_context *ctx) +{ + unsigned lds_size = ctx->chip_class >= CIK ? 65536 : 32768; + ctx->lds = LLVMBuildIntToPtr(ctx->builder, ctx->i32_0, + LLVMPointerType(LLVMArrayType(ctx->i32, lds_size / 4), AC_LOCAL_ADDR_SPACE), + "lds"); +} + +LLVMValueRef ac_lds_load(struct ac_llvm_context *ctx, + LLVMValueRef dw_addr) +{ + return ac_build_load(ctx, ctx->lds, dw_addr); +} + +void ac_lds_store(struct ac_llvm_context *ctx, + LLVMValueRef dw_addr, + LLVMValueRef value) +{ + value = ac_to_integer(ctx, value); + ac_build_indexed_store(ctx, ctx->lds, + dw_addr, value); +} -- cgit v1.2.3