diff options
author | Hyunjun Ko <[email protected]> | 2019-04-22 06:16:48 +0000 |
---|---|---|
committer | Rob Clark <[email protected]> | 2019-06-03 12:44:03 -0700 |
commit | 43d80a3e20b2ac9b343d1b223eb2816e86248fe7 (patch) | |
tree | 7cb5d3ad46d575d35cd707fac6d88d3b6922cf76 /src | |
parent | cbd1f47433b7d735e3be5c8126f7f2b9343a1cdf (diff) |
freedreno/ir3: adjust the bitsize of regs when an array loading.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/freedreno/ir3/ir3_context.c | 20 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_context.h | 3 |
2 files changed, 16 insertions, 7 deletions
diff --git a/src/freedreno/ir3/ir3_context.c b/src/freedreno/ir3/ir3_context.c index 7cd87de0f29..99997427ec3 100644 --- a/src/freedreno/ir3/ir3_context.c +++ b/src/freedreno/ir3/ir3_context.c @@ -170,7 +170,7 @@ ir3_get_src(struct ir3_context *ctx, nir_src *src) for (unsigned i = 0; i < num_components; i++) { unsigned n = src->reg.base_offset * reg->num_components + i; compile_assert(ctx, n < arr->length); - value[i] = ir3_create_array_load(ctx, arr, n, addr); + value[i] = ir3_create_array_load(ctx, arr, n, addr, reg->bit_size); } return value; @@ -474,20 +474,28 @@ ir3_get_array(struct ir3_context *ctx, nir_register *reg) /* relative (indirect) if address!=NULL */ struct ir3_instruction * ir3_create_array_load(struct ir3_context *ctx, struct ir3_array *arr, int n, - struct ir3_instruction *address) + struct ir3_instruction *address, unsigned bitsize) { struct ir3_block *block = ctx->block; struct ir3_instruction *mov; struct ir3_register *src; + unsigned flags = 0; mov = ir3_instr_create(block, OPC_MOV); - mov->cat1.src_type = TYPE_U32; - mov->cat1.dst_type = TYPE_U32; + if (bitsize < 32) { + mov->cat1.src_type = TYPE_U16; + mov->cat1.dst_type = TYPE_U16; + flags |= IR3_REG_HALF; + } else { + mov->cat1.src_type = TYPE_U32; + mov->cat1.dst_type = TYPE_U32; + } + mov->barrier_class = IR3_BARRIER_ARRAY_R; mov->barrier_conflict = IR3_BARRIER_ARRAY_W; - ir3_reg_create(mov, 0, 0); + ir3_reg_create(mov, 0, flags); src = ir3_reg_create(mov, 0, IR3_REG_ARRAY | - COND(address, IR3_REG_RELATIV)); + COND(address, IR3_REG_RELATIV) | flags); src->instr = arr->last_write; src->size = arr->length; src->array.id = arr->id; diff --git a/src/freedreno/ir3/ir3_context.h b/src/freedreno/ir3/ir3_context.h index 26707b73305..b0d3e98d00a 100644 --- a/src/freedreno/ir3/ir3_context.h +++ b/src/freedreno/ir3/ir3_context.h @@ -163,7 +163,8 @@ struct ir3_instruction * ir3_get_predicate(struct ir3_context *ctx, void ir3_declare_array(struct ir3_context *ctx, nir_register *reg); struct ir3_array * ir3_get_array(struct ir3_context *ctx, nir_register *reg); struct ir3_instruction *ir3_create_array_load(struct ir3_context *ctx, - struct ir3_array *arr, int n, struct ir3_instruction *address); + struct ir3_array *arr, int n, struct ir3_instruction *address, + unsigned bitsize); void ir3_create_array_store(struct ir3_context *ctx, struct ir3_array *arr, int n, struct ir3_instruction *src, struct ir3_instruction *address); |