This is more accurate. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>tags/17.2-branchpoint
@@ -633,7 +633,7 @@ ac_build_buffer_load(struct ac_llvm_context *ctx, | |||
unsigned inst_offset, | |||
unsigned glc, | |||
unsigned slc, | |||
bool readonly_memory) | |||
bool can_speculate) | |||
{ | |||
unsigned func = CLAMP(num_channels, 1, 3) - 1; | |||
@@ -667,7 +667,7 @@ ac_build_buffer_load(struct ac_llvm_context *ctx, | |||
ARRAY_SIZE(args), | |||
/* READNONE means writes can't affect it, while | |||
* READONLY means that writes can affect it. */ | |||
readonly_memory && HAVE_LLVM >= 0x0400 ? | |||
can_speculate && HAVE_LLVM >= 0x0400 ? | |||
AC_FUNC_ATTR_READNONE : | |||
AC_FUNC_ATTR_READONLY); | |||
} | |||
@@ -676,7 +676,7 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, | |||
LLVMValueRef rsrc, | |||
LLVMValueRef vindex, | |||
LLVMValueRef voffset, | |||
bool readonly_memory) | |||
bool can_speculate) | |||
{ | |||
LLVMValueRef args [] = { | |||
LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""), | |||
@@ -691,7 +691,7 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, | |||
ctx->v4f32, args, ARRAY_SIZE(args), | |||
/* READNONE means writes can't affect it, while | |||
* READONLY means that writes can affect it. */ | |||
readonly_memory && HAVE_LLVM >= 0x0400 ? | |||
can_speculate && HAVE_LLVM >= 0x0400 ? | |||
AC_FUNC_ATTR_READNONE : | |||
AC_FUNC_ATTR_READONLY); | |||
} |
@@ -143,13 +143,13 @@ ac_build_buffer_load(struct ac_llvm_context *ctx, | |||
unsigned inst_offset, | |||
unsigned glc, | |||
unsigned slc, | |||
bool readonly_memory); | |||
bool can_speculate); | |||
LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, | |||
LLVMValueRef rsrc, | |||
LLVMValueRef vindex, | |||
LLVMValueRef voffset, | |||
bool readonly_memory); | |||
bool can_speculate); | |||
LLVMValueRef | |||
ac_get_thread_id(struct ac_llvm_context *ctx); |
@@ -823,7 +823,7 @@ static LLVMValueRef get_tcs_tes_buffer_address_from_reg( | |||
static LLVMValueRef buffer_load(struct lp_build_tgsi_context *bld_base, | |||
enum tgsi_opcode_type type, unsigned swizzle, | |||
LLVMValueRef buffer, LLVMValueRef offset, | |||
LLVMValueRef base, bool readonly_memory) | |||
LLVMValueRef base, bool can_speculate) | |||
{ | |||
struct si_shader_context *ctx = si_shader_context(bld_base); | |||
struct gallivm_state *gallivm = &ctx->gallivm; | |||
@@ -833,14 +833,14 @@ static LLVMValueRef buffer_load(struct lp_build_tgsi_context *bld_base, | |||
if (swizzle == ~0) { | |||
value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, | |||
0, 1, 0, readonly_memory); | |||
0, 1, 0, can_speculate); | |||
return LLVMBuildBitCast(gallivm->builder, value, vec_type, ""); | |||
} | |||
if (!tgsi_type_is_64bit(type)) { | |||
value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, | |||
0, 1, 0, readonly_memory); | |||
0, 1, 0, can_speculate); | |||
value = LLVMBuildBitCast(gallivm->builder, value, vec_type, ""); | |||
return LLVMBuildExtractElement(gallivm->builder, value, | |||
@@ -848,10 +848,10 @@ static LLVMValueRef buffer_load(struct lp_build_tgsi_context *bld_base, | |||
} | |||
value = ac_build_buffer_load(&ctx->ac, buffer, 1, NULL, base, offset, | |||
swizzle * 4, 1, 0, readonly_memory); | |||
swizzle * 4, 1, 0, can_speculate); | |||
value2 = ac_build_buffer_load(&ctx->ac, buffer, 1, NULL, base, offset, | |||
swizzle * 4 + 4, 1, 0, readonly_memory); | |||
swizzle * 4 + 4, 1, 0, can_speculate); | |||
return si_llvm_emit_fetch_64bit(bld_base, type, value, value2); | |||
} |
@@ -393,11 +393,11 @@ static void load_fetch_args( | |||
} | |||
} | |||
static unsigned get_load_intr_attribs(bool readonly_memory) | |||
static unsigned get_load_intr_attribs(bool can_speculate) | |||
{ | |||
/* READNONE means writes can't affect it, while READONLY means that | |||
* writes can affect it. */ | |||
return readonly_memory && HAVE_LLVM >= 0x0400 ? | |||
return can_speculate && HAVE_LLVM >= 0x0400 ? | |||
LP_FUNC_ATTR_READNONE : | |||
LP_FUNC_ATTR_READONLY; | |||
} | |||
@@ -411,7 +411,7 @@ static unsigned get_store_intr_attribs(bool writeonly_memory) | |||
static void load_emit_buffer(struct si_shader_context *ctx, | |||
struct lp_build_emit_data *emit_data, | |||
bool readonly_memory) | |||
bool can_speculate) | |||
{ | |||
const struct tgsi_full_instruction *inst = emit_data->inst; | |||
struct gallivm_state *gallivm = &ctx->gallivm; | |||
@@ -439,7 +439,7 @@ static void load_emit_buffer(struct si_shader_context *ctx, | |||
emit_data->output[emit_data->chan] = lp_build_intrinsic( | |||
builder, intrinsic_name, dst_type, | |||
emit_data->args, emit_data->arg_count, | |||
get_load_intr_attribs(readonly_memory)); | |||
get_load_intr_attribs(can_speculate)); | |||
} | |||
static LLVMValueRef get_memory_ptr(struct si_shader_context *ctx, | |||
@@ -561,7 +561,7 @@ static void load_emit( | |||
const struct tgsi_full_instruction * inst = emit_data->inst; | |||
const struct tgsi_shader_info *info = &ctx->shader->selector->info; | |||
char intrinsic_name[64]; | |||
bool readonly_memory = false; | |||
bool can_speculate = false; | |||
if (inst->Src[0].Register.File == TGSI_FILE_MEMORY) { | |||
load_emit_memory(ctx, emit_data); | |||
@@ -571,7 +571,7 @@ static void load_emit( | |||
if (inst->Memory.Qualifier & TGSI_MEMORY_VOLATILE) | |||
si_emit_waitcnt(ctx, VM_CNT); | |||
readonly_memory = !(inst->Memory.Qualifier & TGSI_MEMORY_VOLATILE) && | |||
can_speculate = !(inst->Memory.Qualifier & TGSI_MEMORY_VOLATILE) && | |||
is_oneway_access_only(inst, info, | |||
info->shader_buffers_store | | |||
info->shader_buffers_atomic, | |||
@@ -579,7 +579,7 @@ static void load_emit( | |||
info->images_atomic); | |||
if (inst->Src[0].Register.File == TGSI_FILE_BUFFER) { | |||
load_emit_buffer(ctx, emit_data, readonly_memory); | |||
load_emit_buffer(ctx, emit_data, can_speculate); | |||
return; | |||
} | |||
@@ -588,7 +588,7 @@ static void load_emit( | |||
lp_build_intrinsic( | |||
builder, "llvm.amdgcn.buffer.load.format.v4f32", emit_data->dst_type, | |||
emit_data->args, emit_data->arg_count, | |||
get_load_intr_attribs(readonly_memory)); | |||
get_load_intr_attribs(can_speculate)); | |||
} else { | |||
ac_get_image_intr_name("llvm.amdgcn.image.load", | |||
emit_data->dst_type, /* vdata */ | |||
@@ -600,7 +600,7 @@ static void load_emit( | |||
lp_build_intrinsic( | |||
builder, intrinsic_name, emit_data->dst_type, | |||
emit_data->args, emit_data->arg_count, | |||
get_load_intr_attribs(readonly_memory)); | |||
get_load_intr_attribs(can_speculate)); | |||
} | |||
} | |||