ac/llvm: remove gep_2 and others temporary functions

Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19035>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2022-10-11 10:39:18 +02:00
committed by Marge Bot
parent 7508cdd2ff
commit b31affddf4
10 changed files with 104 additions and 157 deletions

View File

@@ -1090,15 +1090,6 @@ LLVMValueRef ac_build_gep_ptr(struct ac_llvm_context *ctx, LLVMTypeRef type, LLV
return LLVMBuildGEP2(ctx->builder, type, base_ptr, &index, 1, "");
}
LLVMValueRef ac_build_gep0(struct ac_llvm_context *ctx, LLVMValueRef base_ptr, LLVMValueRef index)
{
LLVMValueRef indices[2] = {
ctx->i32_0,
index,
};
return LLVMBuildGEP(ctx->builder, base_ptr, indices, 2, "");
}
LLVMTypeRef ac_build_gep0_type(LLVMTypeRef pointee_type, LLVMValueRef index)
{
switch (LLVMGetTypeKind(pointee_type)) {
@@ -1121,7 +1112,7 @@ LLVMTypeRef ac_build_gep0_type(LLVMTypeRef pointee_type, LLVMValueRef index)
return NULL;
}
LLVMValueRef ac_build_gep0_2(struct ac_llvm_context *ctx, LLVMTypeRef pointee_type, LLVMValueRef value, LLVMValueRef index)
LLVMValueRef ac_build_gep0(struct ac_llvm_context *ctx, LLVMTypeRef pointee_type, LLVMValueRef value, LLVMValueRef index)
{
LLVMValueRef indices[2] = {
ctx->i32_0,
@@ -1136,16 +1127,10 @@ LLVMValueRef ac_build_pointer_add(struct ac_llvm_context *ctx, LLVMTypeRef type,
return LLVMBuildGEP2(ctx->builder, type, ptr, &index, 1, "");
}
void ac_build_indexed_store(struct ac_llvm_context *ctx, LLVMValueRef base_ptr, LLVMValueRef index,
void ac_build_indexed_store(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr, LLVMValueRef index,
LLVMValueRef value)
{
LLVMBuildStore(ctx->builder, value, ac_build_gep0(ctx, base_ptr, index));
}
void ac_build_indexed_store2(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr, LLVMValueRef index,
LLVMValueRef value)
{
LLVMBuildStore(ctx->builder, value, ac_build_gep0_2(ctx, type, base_ptr, index));
LLVMBuildStore(ctx->builder, value, ac_build_gep0(ctx, type, base_ptr, index));
}
/**
@@ -1176,30 +1161,9 @@ void ac_build_indexed_store2(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVM
* ptr2 = LLVMBuildInBoundsGEP(ptr1, 32 / elemsize);
* sampler = load(ptr2); // becomes "s_load ptr1, 32" thanks to InBounds
*/
static LLVMValueRef ac_build_load_custom(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
LLVMValueRef index, bool uniform, bool invariant,
bool no_unsigned_wraparound)
{
LLVMValueRef pointer, result;
if (no_unsigned_wraparound &&
LLVMGetPointerAddressSpace(LLVMTypeOf(base_ptr)) == AC_ADDR_SPACE_CONST_32BIT)
pointer = LLVMBuildInBoundsGEP(ctx->builder, base_ptr, &index, 1, "");
else
pointer = LLVMBuildGEP(ctx->builder, base_ptr, &index, 1, "");
if (uniform)
LLVMSetMetadata(pointer, ctx->uniform_md_kind, ctx->empty_md);
result = LLVMBuildLoad(ctx->builder, pointer, "");
if (invariant)
LLVMSetMetadata(result, ctx->invariant_load_md_kind, ctx->empty_md);
LLVMSetAlignment(result, 4);
return result;
}
static LLVMValueRef ac_build_load_custom2(struct ac_llvm_context *ctx, LLVMTypeRef type,
LLVMValueRef base_ptr, LLVMValueRef index,
bool uniform, bool invariant, bool no_unsigned_wraparound)
static LLVMValueRef ac_build_load_custom(struct ac_llvm_context *ctx, LLVMTypeRef type,
LLVMValueRef base_ptr, LLVMValueRef index,
bool uniform, bool invariant, bool no_unsigned_wraparound)
{
LLVMValueRef pointer, result;
@@ -1220,39 +1184,28 @@ static LLVMValueRef ac_build_load_custom2(struct ac_llvm_context *ctx, LLVMTypeR
LLVMValueRef ac_build_load(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr, LLVMValueRef index)
{
return ac_build_load_custom2(ctx, type, base_ptr, index, false, false, false);
return ac_build_load_custom(ctx, type, base_ptr, index, false, false, false);
}
LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr,
LLVMValueRef index)
{
return ac_build_load_custom2(ctx, type, base_ptr, index, false, true, false);
return ac_build_load_custom(ctx, type, base_ptr, index, false, true, false);
}
/* This assumes that there is no unsigned integer wraparound during the address
* computation, excluding all GEPs within base_ptr. */
LLVMValueRef ac_build_load_to_sgpr(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
LLVMValueRef ac_build_load_to_sgpr(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr,
LLVMValueRef index)
{
return ac_build_load_custom(ctx, base_ptr, index, true, true, true);
}
LLVMValueRef ac_build_load_to_sgpr2(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr,
LLVMValueRef index)
{
return ac_build_load_custom2(ctx, type, base_ptr, index, true, true, true);
return ac_build_load_custom(ctx, type, base_ptr, index, true, true, true);
}
/* See ac_build_load_custom() documentation. */
LLVMValueRef ac_build_load_to_sgpr_uint_wraparound(struct ac_llvm_context *ctx,
LLVMValueRef ac_build_load_to_sgpr_uint_wraparound(struct ac_llvm_context *ctx, LLVMTypeRef type,
LLVMValueRef base_ptr, LLVMValueRef index)
{
return ac_build_load_custom(ctx, base_ptr, index, true, true, false);
}
LLVMValueRef ac_build_load_to_sgpr_uint_wraparound2(struct ac_llvm_context *ctx, LLVMTypeRef type,
LLVMValueRef base_ptr, LLVMValueRef index)
{
return ac_build_load_custom2(ctx, type, base_ptr, index, true, true, false);
return ac_build_load_custom(ctx, type, base_ptr, index, true, true, false);
}
static unsigned get_load_cache_policy(struct ac_llvm_context *ctx, unsigned cache_policy)
@@ -2830,14 +2783,14 @@ void ac_declare_lds_as_pointer(struct ac_llvm_context *ctx)
LLVMValueRef ac_lds_load(struct ac_llvm_context *ctx, LLVMValueRef dw_addr)
{
LLVMValueRef v = ac_build_gep0_2(ctx, ctx->lds.t, ctx->lds.v, dw_addr);
LLVMValueRef v = ac_build_gep0(ctx, ctx->lds.t, ctx->lds.v, dw_addr);
return LLVMBuildLoad2(ctx->builder, ctx->i32, v, "");
}
void ac_lds_store(struct ac_llvm_context *ctx, LLVMValueRef dw_addr, LLVMValueRef value)
{
value = ac_to_integer(ctx, value);
ac_build_indexed_store2(ctx, ctx->lds.t, ctx->lds.v, dw_addr, value);
ac_build_indexed_store(ctx, ctx->lds.t, ctx->lds.v, dw_addr, value);
}
LLVMValueRef ac_find_lsb(struct ac_llvm_context *ctx, LLVMTypeRef dst_type, LLVMValueRef src0)

View File

@@ -254,28 +254,22 @@ LLVMValueRef ac_build_fs_interp_mov(struct ac_llvm_context *ctx, LLVMValueRef pa
LLVMValueRef ac_build_gep_ptr(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr,
LLVMValueRef index);
LLVMValueRef ac_build_gep0(struct ac_llvm_context *ctx, LLVMValueRef value, LLVMValueRef index);
LLVMValueRef ac_build_pointer_add(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef ptr,
LLVMValueRef index);
LLVMTypeRef ac_build_gep0_type(LLVMTypeRef pointee_type, LLVMValueRef index);
LLVMValueRef ac_build_gep0_2(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef value, LLVMValueRef index);
LLVMValueRef ac_build_gep0(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef value, LLVMValueRef index);
void ac_build_indexed_store(struct ac_llvm_context *ctx, LLVMValueRef base_ptr, LLVMValueRef index,
void ac_build_indexed_store(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr, LLVMValueRef index,
LLVMValueRef value);
void ac_build_indexed_store2(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr, LLVMValueRef index,
LLVMValueRef value);
LLVMValueRef ac_build_load(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr, LLVMValueRef index);
LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr,
LLVMValueRef index);
LLVMValueRef ac_build_load_to_sgpr(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
LLVMValueRef ac_build_load_to_sgpr(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr,
LLVMValueRef index);
LLVMValueRef ac_build_load_to_sgpr2(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr,
LLVMValueRef index);
LLVMValueRef ac_build_load_to_sgpr_uint_wraparound(struct ac_llvm_context *ctx,
LLVMValueRef base_ptr, LLVMValueRef index);
LLVMValueRef ac_build_load_to_sgpr_uint_wraparound2(struct ac_llvm_context *ctx, LLVMTypeRef type,
LLVMValueRef ac_build_load_to_sgpr_uint_wraparound(struct ac_llvm_context *ctx, LLVMTypeRef type,
LLVMValueRef base_ptr, LLVMValueRef index);
void ac_build_buffer_store_dword(struct ac_llvm_context *ctx, LLVMValueRef rsrc, LLVMValueRef vdata,

View File

@@ -4115,7 +4115,7 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
break;
case nir_intrinsic_load_scratch: {
LLVMValueRef offset = get_src(ctx, instr->src[0]);
LLVMValueRef ptr = ac_build_gep0_2(&ctx->ac, ctx->scratch.t, ctx->scratch.v, offset);
LLVMValueRef ptr = ac_build_gep0(&ctx->ac, ctx->scratch.t, ctx->scratch.v, offset);
LLVMTypeRef comp_type = LLVMIntTypeInContext(ctx->ac.context, instr->dest.ssa.bit_size);
LLVMTypeRef vec_type = instr->dest.ssa.num_components == 1
? comp_type
@@ -4125,7 +4125,7 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
}
case nir_intrinsic_store_scratch: {
LLVMValueRef offset = get_src(ctx, instr->src[1]);
LLVMValueRef ptr = ac_build_gep0_2(&ctx->ac, ctx->scratch.t, ctx->scratch.v, offset);
LLVMValueRef ptr = ac_build_gep0(&ctx->ac, ctx->scratch.t, ctx->scratch.v, offset);
LLVMTypeRef comp_type = LLVMIntTypeInContext(ctx->ac.context, instr->src[0].ssa->bit_size);
LLVMValueRef src = get_src(ctx, instr->src[0]);
unsigned wrmask = nir_intrinsic_write_mask(instr);
@@ -4154,7 +4154,7 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
LLVMValueRef cond = LLVMBuildICmp(ctx->ac.builder, LLVMIntULT, offset, size, "");
offset = LLVMBuildSelect(ctx->ac.builder, cond, offset, size, "");
LLVMValueRef ptr = ac_build_gep0_2(&ctx->ac, ctx->constant_data.t, ctx->constant_data.v, offset);
LLVMValueRef ptr = ac_build_gep0(&ctx->ac, ctx->constant_data.t, ctx->constant_data.v, offset);
LLVMTypeRef comp_type = LLVMIntTypeInContext(ctx->ac.context, instr->dest.ssa.bit_size);
LLVMTypeRef vec_type = instr->dest.ssa.num_components == 1
? comp_type

View File

@@ -114,7 +114,7 @@ load_descriptor_sets(struct radv_shader_context *ctx)
int i = u_bit_scan(&mask);
ctx->descriptor_sets[i] =
ac_build_load_to_sgpr2(&ctx->ac, type, desc_sets, LLVMConstInt(ctx->ac.i32, i, false));
ac_build_load_to_sgpr(&ctx->ac, type, desc_sets, LLVMConstInt(ctx->ac.i32, i, false));
LLVMSetAlignment(ctx->descriptor_sets[i], 4);
}
} else {
@@ -400,7 +400,7 @@ load_vs_input(struct radv_shader_context *ctx, unsigned driver_location, LLVMTyp
desc_index = util_bitcount(ctx->shader_info->vs.vb_desc_usage_mask &
u_bit_consecutive(0, desc_index));
t_offset = LLVMConstInt(ctx->ac.i32, desc_index, false);
t_list = ac_build_load_to_sgpr2(&ctx->ac, t_list_type, t_list_ptr, t_offset);
t_list = ac_build_load_to_sgpr(&ctx->ac, t_list_type, t_list_ptr, t_offset);
/* Always split typed vertex buffer loads on GFX6 and GFX10+ to avoid any alignment issues that
* triggers memory violations and eventually a GPU hang. This can happen if the stride (static or
@@ -807,7 +807,7 @@ radv_emit_streamout(struct radv_shader_context *ctx, unsigned stream)
LLVMValueRef offset = LLVMConstInt(ctx->ac.i32, i, false);
so_buffers[i] = ac_build_load_to_sgpr2(&ctx->ac, type, buf_ptr, offset);
so_buffers[i] = ac_build_load_to_sgpr(&ctx->ac, type, buf_ptr, offset);
LLVMValueRef so_offset = ac_get_arg(&ctx->ac, ctx->args->ac.streamout_offset[i]);
@@ -1181,11 +1181,11 @@ ac_setup_rings(struct radv_shader_context *ctx)
unsigned ring = ctx->stage == MESA_SHADER_GEOMETRY ? RING_ESGS_GS : RING_ESGS_VS;
LLVMValueRef offset = LLVMConstInt(ctx->ac.i32, ring, false);
ctx->esgs_ring = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.i8, ctx->ring_offsets, offset);
ctx->esgs_ring = ac_build_load_to_sgpr(&ctx->ac, ctx->ac.i8, ctx->ring_offsets, offset);
}
if (ctx->args->is_gs_copy_shader) {
ctx->gsvs_ring[0] = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.i8, ctx->ring_offsets,
ctx->gsvs_ring[0] = ac_build_load_to_sgpr(&ctx->ac, ctx->ac.i8, ctx->ring_offsets,
LLVMConstInt(ctx->ac.i32, RING_GSVS_VS, false));
}
@@ -1203,7 +1203,7 @@ ac_setup_rings(struct radv_shader_context *ctx)
unsigned num_records = ctx->ac.wave_size;
LLVMValueRef base_ring;
base_ring = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.i8, ctx->ring_offsets,
base_ring = ac_build_load_to_sgpr(&ctx->ac, ctx->ac.i8, ctx->ring_offsets,
LLVMConstInt(ctx->ac.i32, RING_GSVS_GS, false));
for (unsigned stream = 0; stream < 4; stream++) {
@@ -1243,9 +1243,9 @@ ac_setup_rings(struct radv_shader_context *ctx)
}
if (ctx->stage == MESA_SHADER_TESS_CTRL || ctx->stage == MESA_SHADER_TESS_EVAL) {
ctx->hs_ring_tess_offchip = ac_build_load_to_sgpr2(
ctx->hs_ring_tess_offchip = ac_build_load_to_sgpr(
&ctx->ac, ctx->ac.i8, ctx->ring_offsets, LLVMConstInt(ctx->ac.i32, RING_HS_TESS_OFFCHIP, false));
ctx->hs_ring_tess_factor = ac_build_load_to_sgpr2(
ctx->hs_ring_tess_factor = ac_build_load_to_sgpr(
&ctx->ac, ctx->ac.i8, ctx->ring_offsets, LLVMConstInt(ctx->ac.i32, RING_HS_TESS_FACTOR, false));
}
}

View File

@@ -67,8 +67,8 @@ static LLVMValueRef ngg_get_query_buf(struct si_shader_context *ctx)
{
LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
return ac_build_load_to_sgpr2(&ctx->ac, type, buf_ptr,
LLVMConstInt(ctx->ac.i32, SI_GS_QUERY_BUF, false));
return ac_build_load_to_sgpr(&ctx->ac, type, buf_ptr,
LLVMConstInt(ctx->ac.i32, SI_GS_QUERY_BUF, false));
}
static LLVMValueRef ngg_get_emulated_counters_buf(struct si_shader_context *ctx)
@@ -76,8 +76,8 @@ static LLVMValueRef ngg_get_emulated_counters_buf(struct si_shader_context *ctx)
LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
return ac_build_load_to_sgpr2(&ctx->ac, type, buf_ptr,
LLVMConstInt(ctx->ac.i32, SI_GS_QUERY_EMULATED_COUNTERS_BUF, false));
return ac_build_load_to_sgpr(&ctx->ac, type, buf_ptr,
LLVMConstInt(ctx->ac.i32, SI_GS_QUERY_EMULATED_COUNTERS_BUF, false));
}
/**
@@ -253,7 +253,7 @@ static void build_streamout_vertex(struct si_shader_context *ctx, LLVMValueRef *
for (unsigned comp = 0; comp < 4; comp++) {
LLVMValueRef idx = LLVMConstInt(ctx->ac.i32, 4 * reg + comp, false);
LLVMValueRef v = ac_build_gep0_2(&ctx->ac, vertexptr.t, vertexptr.v, idx);
LLVMValueRef v = ac_build_gep0(&ctx->ac, vertexptr.t, vertexptr.v, idx);
out.values[comp] = LLVMBuildLoad2(builder, ac_build_gep0_type(vertexptr.t, idx), v, "");
out.vertex_streams = info->output_streams[reg];
}
@@ -327,7 +327,7 @@ static void build_streamout(struct si_shader_context *ctx, struct ngg_streamout
ac_build_writelane(&ctx->ac, prim_stride_dw_vgpr, prim_stride_dw[buffer],
LLVMConstInt(ctx->ac.i32, buffer, false));
so_buffer[buffer] = ac_build_load_to_sgpr2(
so_buffer[buffer] = ac_build_load_to_sgpr(
&ctx->ac, type, buf_ptr, LLVMConstInt(ctx->ac.i32, SI_VS_STREAMOUT_BUF0 + buffer, false));
}
@@ -345,7 +345,7 @@ static void build_streamout(struct si_shader_context *ctx, struct ngg_streamout
ac_build_ifcc(&ctx->ac, tmp, 5210);
{
if (isgs) {
LLVMValueRef vt = ac_build_gep0_2(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v, tid);
LLVMValueRef vt = ac_build_gep0(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v, tid);
tmp = LLVMBuildLoad2(builder, ac_build_gep0_type(ctx->gs_ngg_scratch.t, tid), vt, "");
} else {
tmp = ac_build_writelane(&ctx->ac, ctx->ac.i32_0, ngg_get_prim_cnt(ctx), ctx->ac.i32_0);
@@ -452,7 +452,7 @@ static void build_streamout(struct si_shader_context *ctx, struct ngg_streamout
LLVMBuildStore(builder, tmp, offsets_vgpr);
tmp2 = LLVMBuildAdd(builder, ac_get_thread_id(&ctx->ac), scratch_offset_basev, "");
tmp2 = ac_build_gep0_2(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v, tmp2);
tmp2 = ac_build_gep0(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v, tmp2);
LLVMBuildStore(builder, tmp, tmp2);
}
ac_build_endif(&ctx->ac, 5210);
@@ -546,7 +546,7 @@ static void build_streamout(struct si_shader_context *ctx, struct ngg_streamout
ac_build_ifcc(&ctx->ac, tmp, 5225);
{
tmp = LLVMBuildAdd(builder, ac_get_thread_id(&ctx->ac), scratch_emit_basev, "");
tmp = ac_build_gep0_2(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v, tmp);
tmp = ac_build_gep0(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v, tmp);
LLVMBuildStore(builder, emit_vgpr, tmp);
}
ac_build_endif(&ctx->ac, 5225);
@@ -566,7 +566,7 @@ static void build_streamout(struct si_shader_context *ctx, struct ngg_streamout
primemit_scan[stream].enable_exclusive = true;
primemit_scan[stream].op = nir_op_iadd;
primemit_scan[stream].src = nggso->prim_enable[stream];
primemit_scan[stream].scratch = ac_build_gep0_2(
primemit_scan[stream].scratch = ac_build_gep0(
&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v,
LLVMConstInt(ctx->ac.i32, 12 + 8 * stream, false));
primemit_scan[stream].waveidx = get_wave_id_in_tg(ctx);
@@ -592,7 +592,7 @@ static void build_streamout(struct si_shader_context *ctx, struct ngg_streamout
LLVMValueRef scratch_vgpr;
LLVMValueRef idx = ac_get_thread_id(&ctx->ac);
LLVMValueRef v = ac_build_gep0_2(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v, idx);
LLVMValueRef v = ac_build_gep0(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v, idx);
scratch_vgpr = LLVMBuildLoad2(builder, ac_build_gep0_type(ctx->gs_ngg_scratch.t, idx), v, "");
for (unsigned buffer = 0; buffer < 4; ++buffer) {
@@ -779,7 +779,7 @@ static void load_vertex_counts(struct si_shader_context *ctx, struct ac_llvm_poi
*/
ac_build_ifcc(&ctx->ac, LLVMBuildICmp(builder, LLVMIntULT, tid,
LLVMConstInt(ctx->ac.i32, num_i8vec4, 0), ""), 17771);
LLVMValueRef v = ac_build_gep0_2(&ctx->ac, lds.t, lds.v, tid);
LLVMValueRef v = ac_build_gep0(&ctx->ac, lds.t, lds.v, tid);
LLVMBuildStore(builder, LLVMBuildLoad2(builder, ac_build_gep0_type(lds.t, tid), v, ""), i8vec4_lane);
ac_build_endif(&ctx->ac, 17771);
@@ -956,8 +956,8 @@ static void cull_primitive(struct si_shader_context *ctx,
LLVMValueRef ptr = ac_get_arg(&ctx->ac, ctx->small_prim_cull_info);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->small_prim_cull_info);
/* Lines will always use the non-AA viewport transformation. */
LLVMValueRef vp = ac_build_load_to_sgpr2(&ctx->ac, type, ptr,
prim_is_lines ? ctx->ac.i32_1 : ctx->ac.i32_0);
LLVMValueRef vp = ac_build_load_to_sgpr(&ctx->ac, type, ptr,
prim_is_lines ? ctx->ac.i32_1 : ctx->ac.i32_0);
vp = LLVMBuildBitCast(builder, vp, ctx->ac.v4f32, "");
vp_scale[0] = ac_llvm_extract_elem(&ctx->ac, vp, 0);
vp_scale[1] = ac_llvm_extract_elem(&ctx->ac, vp, 1);
@@ -970,7 +970,7 @@ static void cull_primitive(struct si_shader_context *ctx,
options.cull_w = true;
if (prim_is_lines) {
LLVMValueRef terms = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.v2f32, ptr, LLVMConstInt(ctx->ac.i32, 4, 0));
LLVMValueRef terms = ac_build_load_to_sgpr(&ctx->ac, ctx->ac.v2f32, ptr, LLVMConstInt(ctx->ac.i32, 4, 0));
terms = LLVMBuildBitCast(builder, terms, ctx->ac.v2f32, "");
clip_half_line_width[0] = ac_llvm_extract_elem(&ctx->ac, terms, 0);
clip_half_line_width[1] = ac_llvm_extract_elem(&ctx->ac, terms, 1);
@@ -1062,14 +1062,14 @@ void gfx10_ngg_culling_build_end(struct si_shader_context *ctx)
/* Store Position.W into LDS. */
LLVMBuildStore(
builder, ac_to_integer(&ctx->ac, position[3]),
ac_build_gep0_2(&ctx->ac, es_vtxptr.t, es_vtxptr.v, LLVMConstInt(ctx->ac.i32, lds_pos_cull_w, 0)));
ac_build_gep0(&ctx->ac, es_vtxptr.t, es_vtxptr.v, LLVMConstInt(ctx->ac.i32, lds_pos_cull_w, 0)));
/* Store Position.XY / W into LDS. */
for (unsigned chan = 0; chan < 2; chan++) {
LLVMValueRef val = ac_build_fdiv(&ctx->ac, position[chan], position[3]);
LLVMBuildStore(
builder, ac_to_integer(&ctx->ac, val),
ac_build_gep0_2(&ctx->ac, es_vtxptr.t, es_vtxptr.v, LLVMConstInt(ctx->ac.i32, lds_pos_cull_x_div_w + chan, 0)));
ac_build_gep0(&ctx->ac, es_vtxptr.t, es_vtxptr.v, LLVMConstInt(ctx->ac.i32, lds_pos_cull_x_div_w + chan, 0)));
}
break;
@@ -1111,7 +1111,7 @@ void gfx10_ngg_culling_build_end(struct si_shader_context *ctx)
/* Initialize the packed data. */
LLVMBuildStore(
builder, packed_data,
ac_build_gep0_2(&ctx->ac, es_vtxptr.t, es_vtxptr.v, LLVMConstInt(ctx->ac.i32, lds_packed_data, 0)));
ac_build_gep0(&ctx->ac, es_vtxptr.t, es_vtxptr.v, LLVMConstInt(ctx->ac.i32, lds_packed_data, 0)));
ac_build_endif(&ctx->ac, ctx->merged_wrap_if_label);
ac_build_waitcnt(&ctx->ac, AC_WAIT_LGKM);
@@ -1208,7 +1208,7 @@ void gfx10_ngg_culling_build_end(struct si_shader_context *ctx)
continue;
LLVMValueRef idx = LLVMConstInt(ctx->ac.i32, index, 0);
LLVMValueRef v = ac_build_gep0_2(&ctx->ac, gs_vtxptr[vtx].t, gs_vtxptr[vtx].v, idx);
LLVMValueRef v = ac_build_gep0(&ctx->ac, gs_vtxptr[vtx].t, gs_vtxptr[vtx].v, idx);
pos[vtx][chan] = LLVMBuildLoad2(builder, ac_build_gep0_type(gs_vtxptr[vtx].t, idx), v, "");
pos[vtx][chan] = ac_to_float(&ctx->ac, pos[vtx][chan]);
}
@@ -1305,7 +1305,7 @@ void gfx10_ngg_culling_build_end(struct si_shader_context *ctx)
LLVMBuildStore(
builder, ac_to_integer(&ctx->ac,
LLVMBuildLoad2(builder, ctx->ac.f32, addrs[4 * pos_index + chan], "")),
ac_build_gep0_2(&ctx->ac, new_vtx.t, new_vtx.v, LLVMConstInt(ctx->ac.i32, lds_pos_x + chan, 0)));
ac_build_gep0(&ctx->ac, new_vtx.t, new_vtx.v, LLVMConstInt(ctx->ac.i32, lds_pos_x + chan, 0)));
}
/* Store VertexID and InstanceID into LDS. ES threads will have to load them
@@ -1315,24 +1315,24 @@ void gfx10_ngg_culling_build_end(struct si_shader_context *ctx)
if (ctx->stage == MESA_SHADER_VERTEX) {
LLVMBuildStore(
builder, ctx->abi.vertex_id,
ac_build_gep0_2(&ctx->ac, new_vtx.t, new_vtx.v, LLVMConstInt(ctx->ac.i32, lds_vertex_id, 0)));
ac_build_gep0(&ctx->ac, new_vtx.t, new_vtx.v, LLVMConstInt(ctx->ac.i32, lds_vertex_id, 0)));
if (uses_instance_id) {
LLVMBuildStore(
builder, ctx->abi.instance_id,
ac_build_gep0_2(&ctx->ac, new_vtx.t, new_vtx.v, LLVMConstInt(ctx->ac.i32, lds_instance_id, 0)));
ac_build_gep0(&ctx->ac, new_vtx.t, new_vtx.v, LLVMConstInt(ctx->ac.i32, lds_instance_id, 0)));
}
} else {
assert(ctx->stage == MESA_SHADER_TESS_EVAL);
LLVMBuildStore(builder, ac_to_integer(&ctx->ac, ac_get_arg(&ctx->ac, ctx->args.tes_u)),
ac_build_gep0_2(&ctx->ac, new_vtx.t, new_vtx.v, LLVMConstInt(ctx->ac.i32, lds_tes_u, 0)));
ac_build_gep0(&ctx->ac, new_vtx.t, new_vtx.v, LLVMConstInt(ctx->ac.i32, lds_tes_u, 0)));
LLVMBuildStore(builder, ac_to_integer(&ctx->ac, ac_get_arg(&ctx->ac, ctx->args.tes_v)),
ac_build_gep0_2(&ctx->ac, new_vtx.t, new_vtx.v, LLVMConstInt(ctx->ac.i32, lds_tes_v, 0)));
ac_build_gep0(&ctx->ac, new_vtx.t, new_vtx.v, LLVMConstInt(ctx->ac.i32, lds_tes_v, 0)));
LLVMBuildStore(builder, LLVMBuildTrunc(builder, ac_get_arg(&ctx->ac, ctx->args.tes_rel_patch_id), ctx->ac.i8, ""),
si_build_gep_i8(ctx, new_vtx.value, lds_byte2_tes_rel_patch_id));
if (uses_tes_prim_id) {
LLVMBuildStore(
builder, ac_get_arg(&ctx->ac, ctx->args.tes_patch_id),
ac_build_gep0_2(&ctx->ac, new_vtx.t, new_vtx.v, LLVMConstInt(ctx->ac.i32, lds_tes_patch_id, 0)));
ac_build_gep0(&ctx->ac, new_vtx.t, new_vtx.v, LLVMConstInt(ctx->ac.i32, lds_tes_patch_id, 0)));
}
}
}
@@ -1411,13 +1411,13 @@ void gfx10_ngg_culling_build_end(struct si_shader_context *ctx)
/* Prepare LDS addresses of the new ES input VGPRs. */
LLVMValueRef input_vgpr_addresses[4] = {
ac_build_gep0_2(&ctx->ac, es_vtxptr.t, es_vtxptr.v, LLVMConstInt(ctx->ac.i32, lds_vertex_id, 0)),
ac_build_gep0_2(&ctx->ac, es_vtxptr.t, es_vtxptr.v, LLVMConstInt(ctx->ac.i32, lds_instance_id, 0)),
ac_build_gep0(&ctx->ac, es_vtxptr.t, es_vtxptr.v, LLVMConstInt(ctx->ac.i32, lds_vertex_id, 0)),
ac_build_gep0(&ctx->ac, es_vtxptr.t, es_vtxptr.v, LLVMConstInt(ctx->ac.i32, lds_instance_id, 0)),
};
if (ctx->stage == MESA_SHADER_TESS_EVAL) {
input_vgpr_addresses[2] = si_build_gep_i8(ctx, es_vtxptr.v, lds_byte2_tes_rel_patch_id);
if (uses_tes_prim_id) {
input_vgpr_addresses[3] = ac_build_gep0_2(&ctx->ac, es_vtxptr.t, es_vtxptr.v,
input_vgpr_addresses[3] = ac_build_gep0(&ctx->ac, es_vtxptr.t, es_vtxptr.v,
LLVMConstInt(ctx->ac.i32, lds_tes_patch_id, 0));
}
}
@@ -1545,7 +1545,7 @@ void gfx10_ngg_build_end(struct si_shader_context *ctx)
*/
if (ctx->so.num_outputs) {
LLVMValueRef idx = LLVMConstInt(ctx->ac.i32, 4 * i + j, false);
tmp = ac_build_gep0_2(&ctx->ac, vertex_ptr.t, vertex_ptr.v, idx);
tmp = ac_build_gep0(&ctx->ac, vertex_ptr.t, vertex_ptr.v, idx);
tmp2 = LLVMBuildLoad2(builder, ac_build_gep0_type(vertex_ptr.t, idx), addrs[4 * i + j], "");
LLVMTypeRef type = ac_to_integer_type(&ctx->ac, ctx->ac.f32);
tmp2 = LLVMBuildBitCast(ctx->ac.builder, tmp2, type, "");
@@ -1561,7 +1561,7 @@ void gfx10_ngg_build_end(struct si_shader_context *ctx)
edgeflag = ac_build_umin(&ctx->ac, edgeflag, ctx->ac.i32_1);
tmp = LLVMConstInt(ctx->ac.i32, ngg_nogs_vertex_size(ctx->shader) - 1, 0);
tmp = ac_build_gep0_2(&ctx->ac, vertex_ptr.t, vertex_ptr.v, tmp);
tmp = ac_build_gep0(&ctx->ac, vertex_ptr.t, vertex_ptr.v, tmp);
LLVMBuildStore(builder, edgeflag, tmp);
}
}
@@ -1624,7 +1624,7 @@ void gfx10_ngg_build_end(struct si_shader_context *ctx)
struct ac_llvm_pointer vt = ngg_nogs_vertex_ptr(ctx, vtxindex[i]);
tmp2 = LLVMConstInt(ctx->ac.i32, ngg_nogs_vertex_size(ctx->shader) - 1, 0);
tmp = LLVMBuildLoad2(builder, ac_build_gep0_type(vt.t, tmp2),
ac_build_gep0_2(&ctx->ac, vt.t, vt.v, tmp2), "");
ac_build_gep0(&ctx->ac, vt.t, vt.v, tmp2), "");
tmp = LLVMBuildTrunc(builder, tmp, ctx->ac.i1, "");
user_edgeflags[i] = ac_build_alloca_init(&ctx->ac, tmp, "");
@@ -1655,7 +1655,7 @@ void gfx10_ngg_build_end(struct si_shader_context *ctx)
struct ac_llvm_pointer vertex_ptr = ngg_nogs_vertex_ptr(ctx, provoking_vtx_index);
LLVMBuildStore(builder, ac_get_arg(&ctx->ac, ctx->args.gs_prim_id),
ac_build_gep0_2(&ctx->ac, vertex_ptr.t, vertex_ptr.v, ctx->ac.i32_0));
ac_build_gep0(&ctx->ac, vertex_ptr.t, vertex_ptr.v, ctx->ac.i32_0));
ac_build_endif(&ctx->ac, 5400);
}
@@ -1719,7 +1719,7 @@ void gfx10_ngg_build_end(struct si_shader_context *ctx)
for (unsigned j = 0; j < 4; j++) {
tmp = LLVMConstInt(ctx->ac.i32, lds_pos_x + j, 0);
LLVMValueRef v = ac_build_gep0_2(&ctx->ac, vertex_ptr.t, vertex_ptr.v, tmp);
LLVMValueRef v = ac_build_gep0(&ctx->ac, vertex_ptr.t, vertex_ptr.v, tmp);
tmp = LLVMBuildLoad2(builder, ac_build_gep0_type(vertex_ptr.t, tmp), v, "");
outputs[i].values[j] = LLVMBuildBitCast(ctx->ac.builder, tmp,
ac_to_float_type(&ctx->ac, ctx->ac.f32), "");
@@ -1742,7 +1742,7 @@ void gfx10_ngg_build_end(struct si_shader_context *ctx)
struct ac_llvm_pointer vt = ngg_nogs_vertex_ptr(ctx, gfx10_get_thread_id_in_tg(ctx));
outputs[i].values[0] = LLVMBuildLoad2(
builder, ac_build_gep0_type(vt.t, ctx->ac.i32_0), ac_build_gep0_2(&ctx->ac, vt.t, vt.v, ctx->ac.i32_0), "");
builder, ac_build_gep0_type(vt.t, ctx->ac.i32_0), ac_build_gep0(&ctx->ac, vt.t, vt.v, ctx->ac.i32_0), "");
} else {
assert(ctx->stage == MESA_SHADER_TESS_EVAL);
outputs[i].values[0] = si_get_primitive_id(ctx, 0);
@@ -1821,7 +1821,7 @@ static struct ac_llvm_pointer ngg_gs_vertex_ptr(struct si_shader_context *ctx, L
}
return (struct ac_llvm_pointer) {
.value = ac_build_gep0_2(&ctx->ac, storage.t, storage.v, vertexidx),
.value = ac_build_gep0(&ctx->ac, storage.t, storage.v, vertexidx),
.pointee_type = ac_build_gep0_type(storage.t, vertexidx)
};
}
@@ -1948,7 +1948,7 @@ void gfx10_ngg_gs_emit_begin(struct si_shader_context *ctx)
tmp = LLVMBuildICmp(builder, LLVMIntULT, tid, LLVMConstInt(ctx->ac.i32, 4, false), "");
ac_build_ifcc(&ctx->ac, tmp, 5090);
{
LLVMValueRef ptr = ac_build_gep0_2(&ctx->ac, scratchptr.t, scratchptr.v, tid);
LLVMValueRef ptr = ac_build_gep0(&ctx->ac, scratchptr.t, scratchptr.v, tid);
LLVMBuildStore(builder, ctx->ac.i32_0, ptr);
}
ac_build_endif(&ctx->ac, 5090);
@@ -2033,7 +2033,7 @@ void gfx10_ngg_gs_build_end(struct si_shader_context *ctx)
{
LLVMBuildAtomicRMW(
builder, LLVMAtomicRMWBinOpAdd,
ac_build_gep0_2(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v, LLVMConstInt(ctx->ac.i32, stream, false)),
ac_build_gep0(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v, LLVMConstInt(ctx->ac.i32, stream, false)),
numprims, LLVMAtomicOrderingMonotonic, false);
}
ac_build_endif(&ctx->ac, 5105);
@@ -2069,7 +2069,7 @@ void gfx10_ngg_gs_build_end(struct si_shader_context *ctx)
"");
struct ac_llvm_pointer vt = ngg_gs_vertex_ptr(ctx, tmp);
nggso.vertices[i].t = ac_build_gep0_type(vt.t, ctx->ac.i32_0);
nggso.vertices[i].v = ac_build_gep0_2(&ctx->ac, vt.t, vt.v, ctx->ac.i32_0);
nggso.vertices[i].v = ac_build_gep0(&ctx->ac, vt.t, vt.v, ctx->ac.i32_0);
}
build_streamout(ctx, &nggso);
@@ -2097,7 +2097,7 @@ void gfx10_ngg_gs_build_end(struct si_shader_context *ctx)
}
tmp = LLVMBuildLoad2(builder, ctx->ac.i32,
ac_build_gep0_2(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v,
ac_build_gep0(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v,
tid), "");
LLVMValueRef args[] = {
tmp, ngg_get_query_buf(ctx),
@@ -2136,7 +2136,7 @@ void gfx10_ngg_gs_build_end(struct si_shader_context *ctx)
tmp = LLVMBuildSub(builder, tid, LLVMConstInt(ctx->ac.i32, verts_per_prim - i - 1, false), "");
struct ac_llvm_pointer vt = ngg_gs_vertex_ptr(ctx, tmp);
vtxptr[i].t = ac_build_gep0_type(vt.t, ctx->ac.i32_0);
vtxptr[i].v = ac_build_gep0_2(&ctx->ac, vt.t, vt.v, ctx->ac.i32_0);
vtxptr[i].v = ac_build_gep0(&ctx->ac, vt.t, vt.v, ctx->ac.i32_0);
}
for (unsigned i = 0; i < info->num_outputs; i++) {
@@ -2157,7 +2157,7 @@ void gfx10_ngg_gs_build_end(struct si_shader_context *ctx)
continue;
LLVMValueRef idx = LLVMConstInt(ctx->ac.i32, 4 * i + comp, false);
tmp = ac_build_gep0_2(&ctx->ac, vtxptr[vert].t, vtxptr[vert].v, idx);
tmp = ac_build_gep0(&ctx->ac, vtxptr[vert].t, vtxptr[vert].v, idx);
pos[vert][comp] = LLVMBuildLoad2(builder,
ac_build_gep0_type(vtxptr[vert].t, idx),
tmp, "");
@@ -2229,7 +2229,7 @@ void gfx10_ngg_gs_build_end(struct si_shader_context *ctx)
vertlive_scan.enable_reduce = true;
vertlive_scan.enable_exclusive = true;
vertlive_scan.src = vertlive;
vertlive_scan.scratch = ac_build_gep0_2(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v, ctx->ac.i32_0);
vertlive_scan.scratch = ac_build_gep0(&ctx->ac, ctx->gs_ngg_scratch.t, ctx->gs_ngg_scratch.v, ctx->ac.i32_0);
vertlive_scan.waveidx = get_wave_id_in_tg(ctx);
vertlive_scan.numwaves = get_tgsize(ctx);
vertlive_scan.maxwaves = DIV_ROUND_UP(256, ctx->ac.wave_size);

View File

@@ -767,7 +767,7 @@ static LLVMValueRef si_llvm_load_intrinsic(struct ac_shader_abi *abi, nir_intrin
LLVMValueRef slot = LLVMConstInt(ctx->ac.i32, SI_HS_CONST_DEFAULT_TESS_LEVELS, 0);
LLVMValueRef buf = ac_get_arg(&ctx->ac, ctx->internal_bindings);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
buf = ac_build_load_to_sgpr2(&ctx->ac, type, buf, slot);
buf = ac_build_load_to_sgpr(&ctx->ac, type, buf, slot);
int offset = op == nir_intrinsic_load_tess_level_inner_default ? 4 : 0;
LLVMValueRef val[4];
@@ -816,7 +816,7 @@ static LLVMValueRef si_llvm_load_intrinsic(struct ac_shader_abi *abi, nir_intrin
case nir_intrinsic_load_clip_half_line_width_amd: {
LLVMValueRef ptr = ac_get_arg(&ctx->ac, ctx->small_prim_cull_info);
return ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.v2f32, ptr, LLVMConstInt(ctx->ac.i32, 4, 0));
return ac_build_load_to_sgpr(&ctx->ac, ctx->ac.v2f32, ptr, LLVMConstInt(ctx->ac.i32, 4, 0));
}
case nir_intrinsic_load_viewport_xy_scale_and_offset: {
@@ -824,7 +824,7 @@ static LLVMValueRef si_llvm_load_intrinsic(struct ac_shader_abi *abi, nir_intrin
LLVMValueRef ptr = ac_get_arg(&ctx->ac, ctx->small_prim_cull_info);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->small_prim_cull_info);
LLVMValueRef terms =
ac_build_load_to_sgpr2(&ctx->ac, type, ptr, prim_is_lines ? ctx->ac.i32_1 : ctx->ac.i32_0);
ac_build_load_to_sgpr(&ctx->ac, type, ptr, prim_is_lines ? ctx->ac.i32_1 : ctx->ac.i32_0);
return LLVMBuildBitCast(ctx->ac.builder, terms, ctx->ac.v4f32, "");
}
@@ -881,7 +881,7 @@ static LLVMValueRef si_llvm_load_user_clip_plane(struct ac_shader_abi *abi, unsi
LLVMValueRef ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
LLVMValueRef constbuf_index = LLVMConstInt(ctx->ac.i32, SI_VS_CONST_CLIP_PLANES, 0);
LLVMValueRef const_resource = ac_build_load_to_sgpr2(&ctx->ac, type, ptr, constbuf_index);
LLVMValueRef const_resource = ac_build_load_to_sgpr(&ctx->ac, type, ptr, constbuf_index);
LLVMValueRef addr = LLVMConstInt(ctx->ac.i32, ucp_id * 16, 0);
return ac_build_buffer_load(&ctx->ac, const_resource, 4, NULL, addr, NULL,
ctx->ac.f32, 0, true, true);
@@ -893,7 +893,7 @@ static LLVMValueRef si_llvm_load_streamout_buffer(struct ac_shader_abi *abi, uns
LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
return ac_build_load_to_sgpr2(
return ac_build_load_to_sgpr(
&ctx->ac, type, buf_ptr, LLVMConstInt(ctx->ac.i32, SI_VS_STREAMOUT_BUF0 + buffer, false));
}
@@ -933,7 +933,7 @@ bool si_llvm_translate_nir(struct si_shader_context *ctx, struct si_shader *shad
LLVMValueRef buf = ac_get_arg(&ctx->ac, ctx->internal_bindings);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
ctx->instance_divisor_constbuf =
ac_build_load_to_sgpr2(
ac_build_load_to_sgpr(
&ctx->ac, type, buf, LLVMConstInt(ctx->ac.i32, SI_VS_CONST_INSTANCE_DIVISORS, 0));
}
break;

View File

@@ -101,8 +101,8 @@ static LLVMValueRef ngg_get_emulated_counters_buf(struct si_shader_context *ctx)
LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
return ac_build_load_to_sgpr2(&ctx->ac, type, buf_ptr,
LLVMConstInt(ctx->ac.i32, SI_GS_QUERY_EMULATED_COUNTERS_BUF, false));
return ac_build_load_to_sgpr(&ctx->ac, type, buf_ptr,
LLVMConstInt(ctx->ac.i32, SI_GS_QUERY_EMULATED_COUNTERS_BUF, false));
}
void si_llvm_gs_build_end(struct si_shader_context *ctx)
@@ -266,7 +266,7 @@ void si_preload_esgs_ring(struct si_shader_context *ctx)
LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
ctx->esgs_ring = ac_build_load_to_sgpr2(&ctx->ac, type, buf_ptr, offset);
ctx->esgs_ring = ac_build_load_to_sgpr(&ctx->ac, type, buf_ptr, offset);
if (ctx->stage != MESA_SHADER_GEOMETRY) {
LLVMValueRef desc1 = LLVMBuildExtractElement(builder, ctx->esgs_ring, ctx->ac.i32_1, "");
@@ -309,7 +309,7 @@ void si_preload_gs_rings(struct si_shader_context *ctx)
LLVMValueRef offset = LLVMConstInt(ctx->ac.i32, SI_RING_GSVS, 0);
LLVMValueRef buf_ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
LLVMValueRef base_ring = ac_build_load_to_sgpr2(&ctx->ac, type, buf_ptr, offset);
LLVMValueRef base_ring = ac_build_load_to_sgpr(&ctx->ac, type, buf_ptr, offset);
/* The conceptual layout of the GSVS ring is
* v0c0 .. vLv0 v0c1 .. vLc1 ..
@@ -438,7 +438,7 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen,
LLVMValueRef buf_ptr = ac_get_arg(&ctx.ac, ctx.internal_bindings);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx.ac, &ctx.args, ctx.internal_bindings);
ctx.gsvs_ring[0] =
ac_build_load_to_sgpr2(&ctx.ac, type, buf_ptr, LLVMConstInt(ctx.ac.i32, SI_RING_GSVS, 0));
ac_build_load_to_sgpr(&ctx.ac, type, buf_ptr, LLVMConstInt(ctx.ac.i32, SI_RING_GSVS, 0));
LLVMValueRef voffset =
LLVMBuildMul(ctx.ac.builder, ctx.abi.vertex_id, LLVMConstInt(ctx.ac.i32, 4, 0), "");

View File

@@ -37,7 +37,7 @@ static LLVMValueRef load_sample_position(struct ac_shader_abi *abi, LLVMValueRef
LLVMValueRef desc = ac_get_arg(&ctx->ac, ctx->internal_bindings);
LLVMValueRef buf_index = LLVMConstInt(ctx->ac.i32, SI_PS_CONST_SAMPLE_POSITIONS, 0);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
LLVMValueRef resource = ac_build_load_to_sgpr2(&ctx->ac, type, desc, buf_index);
LLVMValueRef resource = ac_build_load_to_sgpr(&ctx->ac, type, desc, buf_index);
/* offset = sample_id * 8 (8 = 2 floats containing samplepos.xy) */
LLVMValueRef offset0 =
@@ -70,7 +70,7 @@ static LLVMValueRef si_nir_emit_fbfetch(struct ac_shader_abi *abi)
ptr =
LLVMBuildPointerCast(ctx->ac.builder, ptr, ac_array_in_const32_addr_space(ctx->ac.v8i32), "");
image =
ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.v8i32, ptr, LLVMConstInt(ctx->ac.i32, SI_PS_IMAGE_COLORBUF0 / 2, 0));
ac_build_load_to_sgpr(&ctx->ac, ctx->ac.v8i32, ptr, LLVMConstInt(ctx->ac.i32, SI_PS_IMAGE_COLORBUF0 / 2, 0));
unsigned chan = 0;
@@ -90,7 +90,7 @@ static LLVMValueRef si_nir_emit_fbfetch(struct ac_shader_abi *abi)
ctx->shader->key.ps.mono.fbfetch_msaa &&
!(ctx->screen->debug_flags & DBG(NO_FMASK))) {
fmask = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.v8i32, ptr,
fmask = ac_build_load_to_sgpr(&ctx->ac, ctx->ac.v8i32, ptr,
LLVMConstInt(ctx->ac.i32, SI_PS_IMAGE_COLORBUF0_FMASK / 2, 0));
ac_apply_fmask_to_sample(&ctx->ac, fmask, args.coords,
@@ -550,7 +550,7 @@ static void si_llvm_emit_polygon_stipple(struct si_shader_context *ctx,
/* Load the buffer descriptor. */
slot = LLVMConstInt(ctx->ac.i32, SI_PS_CONST_POLY_STIPPLE, 0);
desc = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.v4i32, param_internal_bindings, slot);
desc = ac_build_load_to_sgpr(&ctx->ac, ctx->ac.v4i32, param_internal_bindings, slot);
/* The stipple pattern is 32x32, each row has 32 bits. */
offset = LLVMBuildMul(builder, address[1], LLVMConstInt(ctx->ac.i32, 4, 0), "");

View File

@@ -104,10 +104,10 @@ static LLVMValueRef load_ubo(struct ac_shader_abi *abi, LLVMValueRef index)
index =
LLVMBuildAdd(ctx->ac.builder, index, LLVMConstInt(ctx->ac.i32, SI_NUM_SHADER_BUFFERS, 0), "");
return ac_build_load_to_sgpr2(&ctx->ac,
ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->const_and_shader_buffers),
ptr,
index);
return ac_build_load_to_sgpr(&ctx->ac,
ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->const_and_shader_buffers),
ptr,
index);
}
static LLVMValueRef load_ssbo(struct ac_shader_abi *abi, LLVMValueRef index, bool write, bool non_uniform)
@@ -124,9 +124,9 @@ static LLVMValueRef load_ssbo(struct ac_shader_abi *abi, LLVMValueRef index, boo
index = LLVMBuildSub(ctx->ac.builder, LLVMConstInt(ctx->ac.i32, SI_NUM_SHADER_BUFFERS - 1, 0),
index, "");
return ac_build_load_to_sgpr2(&ctx->ac,
ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->const_and_shader_buffers),
rsrc_ptr, index);
return ac_build_load_to_sgpr(&ctx->ac,
ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->const_and_shader_buffers),
rsrc_ptr, index);
}
/**
@@ -197,9 +197,9 @@ static LLVMValueRef si_load_image_desc(struct si_shader_context *ctx, LLVMTypeRe
}
if (bindless)
rsrc = ac_build_load_to_sgpr_uint_wraparound2(&ctx->ac, type, list, index);
rsrc = ac_build_load_to_sgpr_uint_wraparound(&ctx->ac, type, list, index);
else
rsrc = ac_build_load_to_sgpr2(&ctx->ac, type, list, index);
rsrc = ac_build_load_to_sgpr(&ctx->ac, type, list, index);
if (desc_type == AC_DESC_IMAGE)
rsrc = fixup_image_desc(ctx, rsrc, uses_store);
@@ -248,7 +248,7 @@ static LLVMValueRef si_load_sampler_desc(struct si_shader_context *ctx, LLVMType
unreachable("Plane descriptor requested in radeonsi.");
}
return ac_build_load_to_sgpr2(&ctx->ac, list_type, list, index);
return ac_build_load_to_sgpr(&ctx->ac, list_type, list, index);
}
static LLVMValueRef si_nir_load_sampler_desc(struct ac_shader_abi *abi, unsigned descriptor_set,

View File

@@ -169,8 +169,8 @@ static void load_input_vs(struct si_shader_context *ctx, unsigned input_index, L
} else {
unsigned index = input_index - num_vbos_in_user_sgprs;
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->args.vertex_buffers);
vb_desc = ac_build_load_to_sgpr2(&ctx->ac, type, ac_get_arg(&ctx->ac, ctx->args.vertex_buffers),
LLVMConstInt(ctx->ac.i32, index, 0));
vb_desc = ac_build_load_to_sgpr(&ctx->ac, type, ac_get_arg(&ctx->ac, ctx->args.vertex_buffers),
LLVMConstInt(ctx->ac.i32, index, 0));
}
if (ctx->abi.vertex_id_replaced) {
@@ -418,7 +418,7 @@ void si_llvm_emit_streamout(struct si_shader_context *ctx, struct si_shader_outp
LLVMValueRef offset = LLVMConstInt(ctx->ac.i32, SI_VS_STREAMOUT_BUF0 + i, 0);
so_buffers[i] = ac_build_load_to_sgpr2(&ctx->ac, type, buf_ptr, offset);
so_buffers[i] = ac_build_load_to_sgpr(&ctx->ac, type, buf_ptr, offset);
LLVMValueRef so_offset = ac_get_arg(&ctx->ac, ctx->args.streamout_offset[i]);
so_offset = LLVMBuildMul(builder, so_offset, LLVMConstInt(ctx->ac.i32, 4, 0), "");
@@ -454,7 +454,7 @@ void si_llvm_clipvertex_to_clipdist(struct si_shader_context *ctx,
LLVMValueRef ptr = ac_get_arg(&ctx->ac, ctx->internal_bindings);
LLVMTypeRef type = ac_get_arg_pointee_type(&ctx->ac, &ctx->args, ctx->internal_bindings);
LLVMValueRef constbuf_index = LLVMConstInt(ctx->ac.i32, SI_VS_CONST_CLIP_PLANES, 0);
LLVMValueRef const_resource = ac_build_load_to_sgpr2(&ctx->ac, type, ptr, constbuf_index);
LLVMValueRef const_resource = ac_build_load_to_sgpr(&ctx->ac, type, ptr, constbuf_index);
unsigned clipdist_mask = ctx->shader->selector->info.clipdist_mask &
~ctx->shader->key.ge.opt.kill_clip_distances;
@@ -819,8 +819,8 @@ void si_llvm_build_vs_exports(struct si_shader_context *ctx, LLVMValueRef num_ex
LLVMBuildPointerCast(ctx->ac.builder,
ac_get_arg(&ctx->ac, ctx->internal_bindings),
LLVMPointerType(ctx->ac.i32, AC_ADDR_SPACE_CONST_32BIT), "");
attr_address = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.i32, ptr,
LLVMConstInt(ctx->ac.i32, SI_GS_ATTRIBUTE_RING * 4, 0));
attr_address = ac_build_load_to_sgpr(&ctx->ac, ctx->ac.i32, ptr,
LLVMConstInt(ctx->ac.i32, SI_GS_ATTRIBUTE_RING * 4, 0));
} else {
attr_address = ac_get_arg(&ctx->ac, ctx->gs_attr_address);
}
@@ -1039,7 +1039,7 @@ void si_llvm_build_vs_prolog(struct si_shader_context *ctx, union si_shader_part
if (key->vs_prolog.states.instance_divisor_is_fetched) {
LLVMValueRef list = si_prolog_get_internal_bindings(ctx);
LLVMValueRef buf_index = LLVMConstInt(ctx->ac.i32, SI_VS_CONST_INSTANCE_DIVISORS, 0);
instance_divisor_constbuf = ac_build_load_to_sgpr2(&ctx->ac, ctx->ac.v4i32, list, buf_index);
instance_divisor_constbuf = ac_build_load_to_sgpr(&ctx->ac, ctx->ac.v4i32, list, buf_index);
}
for (i = 0; i < key->vs_prolog.num_inputs; i++) {