freedreno/ir3: propagate dest flags for collect/fanin

We did this properly already for split/fanout.  But collect was missed.
Extract out a helper to share.

This way we avoid copy propagating a mov from high or half reg into an
instruction which cannot consume a high/half reg.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
This commit is contained in:
Rob Clark 2019-10-15 15:46:42 -07:00
parent 49ab94694d
commit 9e211b57b8
1 changed files with 9 additions and 3 deletions

View File

@ -239,6 +239,12 @@ ir3_put_dst(struct ir3_context *ctx, nir_dest *dst)
ctx->last_dst_n = 0;
}
static unsigned
dest_flags(struct ir3_instruction *instr)
{
return instr->regs[0]->flags & (IR3_REG_HALF | IR3_REG_HIGH);
}
struct ir3_instruction *
ir3_create_collect(struct ir3_context *ctx, struct ir3_instruction *const *arr,
unsigned arrsz)
@ -249,7 +255,7 @@ ir3_create_collect(struct ir3_context *ctx, struct ir3_instruction *const *arr,
if (arrsz == 0)
return NULL;
unsigned flags = arr[0]->regs[0]->flags & IR3_REG_HALF;
unsigned flags = dest_flags(arr[0]);
collect = ir3_instr_create2(block, OPC_META_FI, 1 + arrsz);
ir3_reg_create(collect, 0, flags); /* dst */
@ -285,7 +291,7 @@ ir3_create_collect(struct ir3_context *ctx, struct ir3_instruction *const *arr,
elem = ir3_MOV(block, elem, type);
}
compile_assert(ctx, (elem->regs[0]->flags & IR3_REG_HALF) == flags);
compile_assert(ctx, dest_flags(elem) == flags);
ir3_reg_create(collect, 0, IR3_REG_SSA | flags)->instr = elem;
}
@ -308,7 +314,7 @@ ir3_split_dest(struct ir3_block *block, struct ir3_instruction **dst,
return;
}
unsigned flags = src->regs[0]->flags & (IR3_REG_HALF | IR3_REG_HIGH);
unsigned flags = dest_flags(src);
for (int i = 0, j = 0; i < n; i++) {
struct ir3_instruction *split = ir3_instr_create(block, OPC_META_FO);