radeonsi: pass llvm type to si_llvm_emit_fetch_64bit()

v2: use LLVMBuildBitCast() directly

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Timothy Arceri 2017-11-07 21:27:18 +11:00
parent e51ecbe980
commit 7ef1e42c14
3 changed files with 18 additions and 12 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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) {