Module: Mesa
Branch: master
Commit: 7ef1e42c14fb23592e8e003f7a80db9a43cb9bc9
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ef1e42c14fb23592e8e003f7a80db9a43cb9bc9

Author: Timothy Arceri <tarc...@itsqueeze.com>
Date:   Tue Nov  7 21:27:18 2017 +1100

radeonsi: pass llvm type to si_llvm_emit_fetch_64bit()

v2: use LLVMBuildBitCast() directly

Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/gallium/drivers/radeonsi/si_shader.c            | 11 +++++++----
 src/gallium/drivers/radeonsi/si_shader_internal.h   |  2 +-
 src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 17 ++++++++++-------
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index e8b4ec7b98..c3b5f58cd2 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1063,7 +1063,8 @@ static LLVMValueRef buffer_load(struct 
lp_build_tgsi_context *bld_base,
        value2 = ac_build_buffer_load(&ctx->ac, buffer, 1, NULL, base, offset,
                                   swizzle * 4 + 4, 1, 0, can_speculate, false);
 
-       return si_llvm_emit_fetch_64bit(bld_base, type, value, value2);
+       return si_llvm_emit_fetch_64bit(bld_base, tgsi2llvmtype(bld_base, type),
+                                       value, value2);
 }
 
 /**
@@ -1096,7 +1097,8 @@ static LLVMValueRef lds_load(struct lp_build_tgsi_context 
*bld_base,
 
                lo = lds_load(bld_base, TGSI_TYPE_UNSIGNED, swizzle, dw_addr);
                hi = lds_load(bld_base, TGSI_TYPE_UNSIGNED, swizzle + 1, 
dw_addr);
-               return si_llvm_emit_fetch_64bit(bld_base, type, lo, hi);
+               return si_llvm_emit_fetch_64bit(bld_base, 
tgsi2llvmtype(bld_base, type),
+                                               lo, hi);
        }
 
        dw_addr = lp_build_add(&bld_base->uint_bld, dw_addr,
@@ -1375,7 +1377,7 @@ static LLVMValueRef fetch_input_gs(
                value2 = ac_build_buffer_load(&ctx->ac, ctx->esgs_ring, 1,
                                              ctx->i32_0, vtx_offset, soffset,
                                              0, 1, 0, true, false);
-               return si_llvm_emit_fetch_64bit(bld_base, type,
+               return si_llvm_emit_fetch_64bit(bld_base, 
tgsi2llvmtype(bld_base, type),
                                                value, value2);
        }
        return bitcast(bld_base, type, value);
@@ -1978,7 +1980,8 @@ static LLVMValueRef fetch_constant(
 
                lo = fetch_constant(bld_base, reg, TGSI_TYPE_UNSIGNED, swizzle);
                hi = fetch_constant(bld_base, reg, TGSI_TYPE_UNSIGNED, swizzle 
+ 1);
-               return si_llvm_emit_fetch_64bit(bld_base, type, lo, hi);
+               return si_llvm_emit_fetch_64bit(bld_base, 
tgsi2llvmtype(bld_base, type),
+                                               lo, hi);
        }
 
        idx = reg->Register.Index * 4 + swizzle;
diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h 
b/src/gallium/drivers/radeonsi/si_shader_internal.h
index 4bd128ef56..e7c097c5fc 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -268,7 +268,7 @@ void si_llvm_dispose(struct si_shader_context *ctx);
 void si_llvm_optimize_module(struct si_shader_context *ctx);
 
 LLVMValueRef si_llvm_emit_fetch_64bit(struct lp_build_tgsi_context *bld_base,
-                                     enum tgsi_opcode_type type,
+                                     LLVMTypeRef type,
                                      LLVMValueRef ptr,
                                      LLVMValueRef ptr2);
 
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c 
b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index e965fa7c41..0843b3c63c 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -399,7 +399,7 @@ get_pointer_into_array(struct si_shader_context *ctx,
 
 LLVMValueRef
 si_llvm_emit_fetch_64bit(struct lp_build_tgsi_context *bld_base,
-                        enum tgsi_opcode_type type,
+                        LLVMTypeRef type,
                         LLVMValueRef ptr,
                         LLVMValueRef ptr2)
 {
@@ -416,7 +416,7 @@ si_llvm_emit_fetch_64bit(struct lp_build_tgsi_context 
*bld_base,
                                        result,
                                        ac_to_integer(&ctx->ac, ptr2),
                                        ctx->i32_1, "");
-       return bitcast(bld_base, type, result);
+       return LLVMBuildBitCast(ctx->ac.builder, result, type, "");
 }
 
 static LLVMValueRef
@@ -461,7 +461,8 @@ load_value_from_array(struct lp_build_tgsi_context 
*bld_base,
                        LLVMValueRef ptr_hi, val_hi;
                        ptr_hi = LLVMBuildGEP(builder, ptr, &ctx->i32_1, 1, "");
                        val_hi = LLVMBuildLoad(builder, ptr_hi, "");
-                       val = si_llvm_emit_fetch_64bit(bld_base, type, val, 
val_hi);
+                       val = si_llvm_emit_fetch_64bit(bld_base, 
tgsi2llvmtype(bld_base, type),
+                                                      val, val_hi);
                }
 
                return val;
@@ -609,7 +610,8 @@ LLVMValueRef si_llvm_emit_fetch(struct 
lp_build_tgsi_context *bld_base,
                if (tgsi_type_is_64bit(type)) {
                        ptr = result;
                        ptr2 = input[swizzle + 1];
-                       return si_llvm_emit_fetch_64bit(bld_base, type, ptr, 
ptr2);
+                       return si_llvm_emit_fetch_64bit(bld_base, 
tgsi2llvmtype(bld_base, type),
+                                                       ptr, ptr2);
                }
                break;
        }
@@ -620,7 +622,7 @@ LLVMValueRef si_llvm_emit_fetch(struct 
lp_build_tgsi_context *bld_base,
                ptr = ctx->temps[reg->Register.Index * TGSI_NUM_CHANNELS + 
swizzle];
                if (tgsi_type_is_64bit(type)) {
                        ptr2 = ctx->temps[reg->Register.Index * 
TGSI_NUM_CHANNELS + swizzle + 1];
-                       return si_llvm_emit_fetch_64bit(bld_base, type,
+                       return si_llvm_emit_fetch_64bit(bld_base, 
tgsi2llvmtype(bld_base, type),
                                                        LLVMBuildLoad(builder, 
ptr, ""),
                                                        LLVMBuildLoad(builder, 
ptr2, ""));
                }
@@ -631,7 +633,7 @@ LLVMValueRef si_llvm_emit_fetch(struct 
lp_build_tgsi_context *bld_base,
                ptr = get_output_ptr(bld_base, reg->Register.Index, swizzle);
                if (tgsi_type_is_64bit(type)) {
                        ptr2 = get_output_ptr(bld_base, reg->Register.Index, 
swizzle + 1);
-                       return si_llvm_emit_fetch_64bit(bld_base, type,
+                       return si_llvm_emit_fetch_64bit(bld_base, 
tgsi2llvmtype(bld_base, type),
                                                        LLVMBuildLoad(builder, 
ptr, ""),
                                                        LLVMBuildLoad(builder, 
ptr2, ""));
                }
@@ -664,7 +666,8 @@ static LLVMValueRef fetch_system_value(struct 
lp_build_tgsi_context *bld_base,
                hi = LLVMBuildExtractElement(
                        builder, cval, LLVMConstInt(ctx->i32, swizzle + 1, 0), 
"");
 
-               return si_llvm_emit_fetch_64bit(bld_base, type, lo, hi);
+               return si_llvm_emit_fetch_64bit(bld_base, 
tgsi2llvmtype(bld_base, type),
+                                               lo, hi);
        }
 
        if (LLVMGetTypeKind(LLVMTypeOf(cval)) == LLVMVectorTypeKind) {

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

Reply via email to