pan/bi: Handle fmov class ops

We need to lower them to something reasonable (ideally, the modifier
would be attached but we need to do something for the case it's not). We
specifically have to lower pre-sched as well, but we can do the lower
literally at schedule time for now (if this proves annoying, we can move
it earlier, but I want to leave room for modifier-aware copyprop should
that prove interesting).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4396>
This commit is contained in:
Alyssa Rosenzweig 2020-03-31 22:16:55 -04:00 committed by Marge Bot
parent 357b8b5906
commit 12cf9f43f0
3 changed files with 20 additions and 2 deletions

View file

@ -780,7 +780,6 @@ bi_pack_fma(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
return BIFROST_FMA_NOP; return BIFROST_FMA_NOP;
case BI_MOV: case BI_MOV:
return bi_pack_fma_1src(bundle.fma, regs, BIFROST_FMA_OP_MOV); return bi_pack_fma_1src(bundle.fma, regs, BIFROST_FMA_OP_MOV);
case BI_FMOV:
case BI_SHIFT: case BI_SHIFT:
case BI_SWIZZLE: case BI_SWIZZLE:
case BI_ROUND: case BI_ROUND:
@ -989,7 +988,6 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
return bi_pack_add_ld_var_addr(clause, bundle.add, regs); return bi_pack_add_ld_var_addr(clause, bundle.add, regs);
case BI_MINMAX: case BI_MINMAX:
case BI_MOV: case BI_MOV:
case BI_FMOV:
case BI_SHIFT: case BI_SHIFT:
case BI_STORE: case BI_STORE:
return BIFROST_ADD_NOP; return BIFROST_ADD_NOP;

View file

@ -137,6 +137,7 @@ bi_class_name(enum bi_class cl)
case BI_CSEL: return "csel"; case BI_CSEL: return "csel";
case BI_DISCARD: return "discard"; case BI_DISCARD: return "discard";
case BI_FMA: return "fma"; case BI_FMA: return "fma";
case BI_FMOV: return "fmov";
case BI_FREXP: return "frexp"; case BI_FREXP: return "frexp";
case BI_ISUB: return "isub"; case BI_ISUB: return "isub";
case BI_LOAD: return "load"; case BI_LOAD: return "load";

View file

@ -89,6 +89,22 @@ bi_ambiguous_abs(bi_instruction *ins)
return classy && typey && absy; return classy && typey && absy;
} }
/* Lowers FMOV to ADD #0, since FMOV doesn't exist on the h/w and this is the
* latest time it's sane to lower (it's useful to distinguish before, but we'll
* need this handle during scheduling to ensure the ports get modeled
* correctly with respect to the new zero source) */
static void
bi_lower_fmov(bi_instruction *ins)
{
if (ins->type != BI_FMOV)
return;
ins->type = BI_ADD;
ins->src[1] = BIR_INDEX_ZERO;
ins->src_types[1] = ins->src_types[0];
}
/* Eventually, we'll need a proper scheduling, grouping instructions /* Eventually, we'll need a proper scheduling, grouping instructions
* into clauses and ordering/assigning grouped instructions to the * into clauses and ordering/assigning grouped instructions to the
* appropriate FMA/ADD slots. Right now we do the dumbest possible * appropriate FMA/ADD slots. Right now we do the dumbest possible
@ -108,6 +124,9 @@ bi_schedule(bi_context *ctx)
list_inithead(&bblock->clauses); list_inithead(&bblock->clauses);
bi_foreach_instr_in_block(bblock, ins) { bi_foreach_instr_in_block(bblock, ins) {
/* Convenient time to lower */
bi_lower_fmov(ins);
unsigned props = bi_class_props[ins->type]; unsigned props = bi_class_props[ins->type];
bi_clause *u = rzalloc(ctx, bi_clause); bi_clause *u = rzalloc(ctx, bi_clause);