On 3/19/19 8:24 PM, Bas Nieuwenhuizen wrote:
On Wed, Mar 13, 2019 at 5:38 PM Samuel Pitoiset
<samuel.pitoi...@gmail.com> wrote:
Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
  src/amd/common/ac_nir_to_llvm.c | 35 ++++++---------------------------
  1 file changed, 6 insertions(+), 29 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 7f63b506b93..949a7a74834 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1704,7 +1704,6 @@ static LLVMValueRef visit_load_buffer(struct 
ac_nir_context *ctx,
         int num_components = instr->num_components;
         enum gl_access_qualifier access = nir_intrinsic_access(instr);
         unsigned cache_policy = get_cache_policy(ctx, access, false, false);
-       LLVMValueRef glc = (cache_policy & ac_glc) ? ctx->ac.i1true : 
ctx->ac.i1false;

         LLVMValueRef offset = get_src(ctx, instr->src[1]);
         LLVMValueRef rsrc = ctx->abi->load_ssbo(ctx->abi,
@@ -1734,34 +1733,12 @@ static LLVMValueRef visit_load_buffer(struct 
ac_nir_context *ctx,
                                                           immoffset,
                                                           cache_policy & 
ac_glc);
                 } else {
-                       const char *load_name;
-                       LLVMTypeRef data_type;
-                       switch (load_bytes) {
-                       case 16:
-                       case 12:
-                               load_name = "llvm.amdgcn.buffer.load.v4f32";
-                               data_type = ctx->ac.v4f32;
-                               break;
-                       case 8:
-                       case 6:
-                               load_name = "llvm.amdgcn.buffer.load.v2f32";
-                               data_type = ctx->ac.v2f32;
-                               break;
-                       case 4:
-                               load_name = "llvm.amdgcn.buffer.load.f32";
-                               data_type = ctx->ac.f32;
-                               break;
-                       default:
-                               unreachable("Malformed load buffer.");
-                       }
-                       LLVMValueRef params[] = {
-                               rsrc,
-                               vindex,
-                               LLVMBuildAdd(ctx->ac.builder, offset, immoffset, 
""),
-                               glc,
-                               ctx->ac.i1false,
-                       };
-                       ret = ac_build_intrinsic(&ctx->ac, load_name, 
data_type, params, 5, 0);
+                       int num_channels = util_next_power_of_two(load_bytes) / 
4;
+
+                       ret = ac_build_buffer_load(&ctx->ac, rsrc, num_channels,
+                                                  vindex, offset, immoffset, 0,
immoffset is constant right? Why do we use soffset instead of
inst_offset? (Not blocking anything since pre-existing, just curious)
I don't know, but I assume that using inst_offset would work too.

+                                                  cache_policy & ac_glc, false,
+                                                  false, false);
Change the slc arg to 0? (since it  is unsigned)
Fixed locally.

                 }

                 LLVMTypeRef byte_vec = LLVMVectorType(ctx->ac.i8, 
ac_get_type_size(LLVMTypeOf(ret)));
--
2.21.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to