diff options
author | Rob Clark <[email protected]> | 2018-01-19 15:45:37 -0500 |
---|---|---|
committer | Rob Clark <[email protected]> | 2018-02-10 14:54:58 -0500 |
commit | ac459a6f7f16dc8a999619fcf12f385ffdbbeda0 (patch) | |
tree | fad030b0d34069b3ec6d4f900830e4268602ee7a /src | |
parent | 2bc3fb6992b19d55015bd9a9e96f6f0c19af1940 (diff) |
freedreno/ir3: avoid extra mov's for "arrays"
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 26 |
1 files changed, 23 insertions, 3 deletions
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 |