From: Rob Clark Date: Fri, 19 Jan 2018 20:45:37 +0000 (-0500) Subject: freedreno/ir3: avoid extra mov's for "arrays" X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ac459a6f7f16dc8a999619fcf12f385ffdbbeda0;p=mesa.git freedreno/ir3: avoid extra mov's for "arrays" Signed-off-by: Rob Clark --- diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c index c043214fca5..009dcb30fa5 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c @@ -348,7 +348,7 @@ create_array_load(struct ir3_context *ctx, struct ir3_array *arr, int n, } /* relative (indirect) if address!=NULL */ -static struct ir3_instruction * +static void create_array_store(struct ir3_context *ctx, struct ir3_array *arr, int n, struct ir3_instruction *src, struct ir3_instruction *address) { @@ -356,6 +356,28 @@ create_array_store(struct ir3_context *ctx, struct ir3_array *arr, int n, struct ir3_instruction *mov; struct ir3_register *dst; + /* if not relative store, don't create an extra mov, since that + * ends up being difficult for cp to remove. + */ + if (!address) { + dst = src->regs[0]; + + src->barrier_class |= IR3_BARRIER_ARRAY_W; + src->barrier_conflict |= IR3_BARRIER_ARRAY_R | IR3_BARRIER_ARRAY_W; + + dst->flags |= IR3_REG_ARRAY; + dst->instr = arr->last_write; + dst->size = arr->length; + dst->array.id = arr->id; + dst->array.offset = n; + + arr->last_write = src; + + array_insert(block, block->keeps, src); + + return; + } + mov = ir3_instr_create(block, OPC_MOV); mov->cat1.src_type = TYPE_U32; mov->cat1.dst_type = TYPE_U32; @@ -379,8 +401,6 @@ create_array_store(struct ir3_context *ctx, struct ir3_array *arr, int n, * pass won't know this.. so keep all array stores: */ array_insert(block, block->keeps, mov); - - return mov; } /* allocate a n element value array (to be populated by caller) and