From: Rob Clark Date: Tue, 15 Oct 2019 22:46:42 +0000 (-0700) Subject: freedreno/ir3: propagate dest flags for collect/fanin X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9e211b57b85903d4444880b753f22206da86221c;p=mesa.git 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 Reviewed-by: Kristian H. Kristensen --- diff --git a/src/freedreno/ir3/ir3_context.c b/src/freedreno/ir3/ir3_context.c index 2543991f8d9..bdcf816bd12 100644 --- a/src/freedreno/ir3/ir3_context.c +++ b/src/freedreno/ir3/ir3_context.c @@ -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);