ir3: make backend aware of shfl:

- Validation;
- Copy prop: src2 can be shared;
- Legalization: is (ss) producer.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31358>
This commit is contained in:
Job Noorman 2024-09-25 12:04:45 +02:00 committed by Marge Bot
parent 222b46f008
commit d43f39678c
4 changed files with 9 additions and 2 deletions

View file

@ -1359,6 +1359,8 @@ ir3_valid_flags(struct ir3_instruction *instr, unsigned n, unsigned flags)
if (instr->opc == OPC_STC && n == 1)
valid_flags |= IR3_REG_SHARED;
if (instr->opc == OPC_SHFL && n == 1)
valid_flags |= IR3_REG_SHARED;
if (flags & ~valid_flags)
return false;

View file

@ -2062,7 +2062,7 @@ is_ss_producer(struct ir3_instruction *instr)
if (instr->block->in_early_preamble && writes_addr1(instr))
return true;
return is_sfu(instr) || is_local_mem_load(instr);
return is_sfu(instr) || is_local_mem_load(instr) || instr->opc == OPC_SHFL;
}
static inline bool

View file

@ -598,7 +598,7 @@ legalize_block(struct ir3_legalize_ctx *ctx, struct ir3_block *block)
list_addtail(&n->node, &block->instr_list);
}
if (is_sfu(n))
if (is_sfu(n) || n->opc == OPC_SHFL)
regmask_set(&state->needs_ss, n->dsts[0]);
foreach_dst (dst, n) {

View file

@ -434,6 +434,11 @@ validate_instr(struct ir3_validate_ctx *ctx, struct ir3_instruction *instr)
validate_assert(ctx, !(instr->srcs[2]->flags & IR3_REG_HALF));
validate_reg_size(ctx, instr->dsts[0], instr->cat6.type);
break;
case OPC_SHFL:
validate_reg_size(ctx, instr->srcs[0], instr->cat6.type);
validate_assert(ctx, !(instr->srcs[1]->flags & IR3_REG_HALF));
validate_reg_size(ctx, instr->dsts[0], instr->cat6.type);
break;
default:
validate_reg_size(ctx, instr->dsts[0], instr->cat6.type);
validate_assert(ctx, !(instr->srcs[0]->flags & IR3_REG_HALF));