agx: Add and use agx_nir_ssa_index helper
Common subexpression that we'll repeat once more in the next patch. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21431>
This commit is contained in:

committed by
Marge Bot

parent
ad459054ed
commit
eab4d6a96f
@@ -294,8 +294,7 @@ agx_emit_load_const(agx_builder *b, nir_load_const_instr *instr)
|
|||||||
assert(instr->def.num_components == 1);
|
assert(instr->def.num_components == 1);
|
||||||
|
|
||||||
/* Emit move, later passes can inline/push if useful */
|
/* Emit move, later passes can inline/push if useful */
|
||||||
agx_mov_imm_to(b,
|
agx_mov_imm_to(b, agx_nir_ssa_index(&instr->def),
|
||||||
agx_get_index(instr->def.index, agx_size_for_bits(bit_size)),
|
|
||||||
nir_const_value_as_uint(instr->value[0], bit_size));
|
nir_const_value_as_uint(instr->value[0], bit_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -474,22 +474,23 @@ agx_size_for_bits(unsigned bits)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline agx_index
|
||||||
|
agx_nir_ssa_index(nir_ssa_def *ssa)
|
||||||
|
{
|
||||||
|
return agx_get_index(ssa->index, agx_size_for_bits(ssa->bit_size));
|
||||||
|
}
|
||||||
|
|
||||||
static inline agx_index
|
static inline agx_index
|
||||||
agx_src_index(nir_src *src)
|
agx_src_index(nir_src *src)
|
||||||
{
|
{
|
||||||
assert(src->is_ssa);
|
assert(src->is_ssa);
|
||||||
|
return agx_nir_ssa_index(src->ssa);
|
||||||
return agx_get_index(src->ssa->index,
|
|
||||||
agx_size_for_bits(nir_src_bit_size(*src)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline agx_index
|
static inline agx_index
|
||||||
agx_dest_index(nir_dest *dst)
|
agx_dest_index(nir_dest *dst)
|
||||||
{
|
{
|
||||||
assert(dst->is_ssa);
|
return agx_nir_ssa_index(&dst->ssa);
|
||||||
|
|
||||||
return agx_get_index(dst->ssa.index,
|
|
||||||
agx_size_for_bits(nir_dest_bit_size(*dst)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline agx_index
|
static inline agx_index
|
||||||
|
Reference in New Issue
Block a user