mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-24 13:40:37 +02:00
ir3: Directly use shared registers when possible
Avoid unnecessary copies. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22075>
This commit is contained in:
parent
3bec9e684d
commit
17cb1c78bd
3 changed files with 6 additions and 5 deletions
|
|
@ -3554,7 +3554,7 @@ emit_phi(struct ir3_context *ctx, nir_phi_instr *nphi)
|
|||
nir_phi_src *src = list_entry(exec_list_get_head(&nphi->srcs),
|
||||
nir_phi_src, node);
|
||||
if (nphi->def.divergent == src->src.ssa->divergent) {
|
||||
dst[0] = ir3_get_src(ctx, &src->src)[0];
|
||||
dst[0] = ir3_get_src_maybe_shared(ctx, &src->src)[0];
|
||||
ir3_put_def(ctx, &nphi->def);
|
||||
return;
|
||||
}
|
||||
|
|
@ -4022,7 +4022,7 @@ emit_conditional_branch(struct ir3_context *ctx, nir_if *nif)
|
|||
static void
|
||||
emit_if(struct ir3_context *ctx, nir_if *nif)
|
||||
{
|
||||
struct ir3_instruction *condition = ir3_get_src(ctx, &nif->condition)[0];
|
||||
struct ir3_instruction *condition = ir3_get_src_maybe_shared(ctx, &nif->condition)[0];
|
||||
|
||||
if (condition->opc == OPC_ANY_MACRO && condition->block == ctx->block) {
|
||||
struct ir3_instruction *pred = ssa(condition->srcs[0]);
|
||||
|
|
|
|||
|
|
@ -528,12 +528,14 @@ ir3_get_predicate(struct ir3_context *ctx, struct ir3_instruction *src)
|
|||
|
||||
/* NOTE: we use cpms.s.ne x, 0 to move x into a predicate register */
|
||||
struct ir3_instruction *zero =
|
||||
create_immed_typed(b, 0, is_half(src) ? TYPE_U16 : TYPE_U32);
|
||||
create_immed_typed_shared(b, 0, is_half(src) ? TYPE_U16 : TYPE_U32,
|
||||
src->dsts[0]->flags & IR3_REG_SHARED);
|
||||
cond = ir3_CMPS_S(b, src, 0, zero, 0);
|
||||
cond->cat2.condition = IR3_COND_NE;
|
||||
|
||||
/* condition always goes in predicate register: */
|
||||
cond->dsts[0]->flags |= IR3_REG_PREDICATE;
|
||||
cond->dsts[0]->flags &= ~IR3_REG_SHARED;
|
||||
|
||||
/* phi's should stay first in a block */
|
||||
if (src->opc == OPC_META_PHI)
|
||||
|
|
|
|||
|
|
@ -40,12 +40,11 @@ clone_with_predicate_dst(struct opt_predicates_ctx *ctx,
|
|||
return entry->data;
|
||||
|
||||
assert(instr->dsts_count == 1);
|
||||
assert(!(instr->dsts[0]->flags & IR3_REG_SHARED));
|
||||
|
||||
struct ir3_instruction *clone = ir3_instr_clone(instr);
|
||||
ir3_instr_move_after(clone, instr);
|
||||
clone->dsts[0]->flags |= IR3_REG_PREDICATE;
|
||||
clone->dsts[0]->flags &= ~IR3_REG_HALF;
|
||||
clone->dsts[0]->flags &= ~(IR3_REG_HALF | IR3_REG_SHARED);
|
||||
_mesa_hash_table_insert(ctx->predicate_clones, instr, clone);
|
||||
return clone;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue