diff options
author | Rob Clark <[email protected]> | 2020-07-16 15:13:53 -0700 |
---|---|---|
committer | Rob Clark <[email protected]> | 2020-07-18 09:14:13 -0700 |
commit | 5be171b8886e9ddea33bfd899609ab13b413ac86 (patch) | |
tree | 5a5dd49648d692e68f1bd19cf73d4e28e14ce0e1 | |
parent | 0472ca2aa5c47cf2b6e0b0c6972d6f5c79ba35a1 (diff) |
freedreno/ir3: set array precision on creation
Signed-off-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5957>
-rw-r--r-- | src/freedreno/ir3/ir3_context.c | 11 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_context.h | 3 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/freedreno/ir3/ir3_context.c b/src/freedreno/ir3/ir3_context.c index 522c6f69aca..4fe61615800 100644 --- a/src/freedreno/ir3/ir3_context.c +++ b/src/freedreno/ir3/ir3_context.c @@ -227,7 +227,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, reg->bit_size); + value[i] = ir3_create_array_load(ctx, arr, n, addr); } return value; @@ -553,6 +553,10 @@ ir3_declare_array(struct ir3_context *ctx, nir_register *reg) arr->length = reg->num_components * MAX2(1, reg->num_array_elems); compile_assert(ctx, arr->length > 0); arr->r = reg; + arr->half = reg->bit_size <= 16; + // HACK one-bit bools still end up as 32b: + if (reg->bit_size == 1) + arr->half = false; list_addtail(&arr->node, &ctx->ir->array_list); } @@ -570,7 +574,7 @@ 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, unsigned bitsize) + struct ir3_instruction *address) { struct ir3_block *block = ctx->block; struct ir3_instruction *mov; @@ -578,11 +582,10 @@ ir3_create_array_load(struct ir3_context *ctx, struct ir3_array *arr, int n, unsigned flags = 0; mov = ir3_instr_create(block, OPC_MOV); - if (bitsize == 16) { + if (arr->half) { mov->cat1.src_type = TYPE_U16; mov->cat1.dst_type = TYPE_U16; flags |= IR3_REG_HALF; - arr->half = true; } else { mov->cat1.src_type = TYPE_U32; mov->cat1.dst_type = TYPE_U32; diff --git a/src/freedreno/ir3/ir3_context.h b/src/freedreno/ir3/ir3_context.h index 6ddf2402fdc..30caf9d7b85 100644 --- a/src/freedreno/ir3/ir3_context.h +++ b/src/freedreno/ir3/ir3_context.h @@ -202,8 +202,7 @@ 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, - unsigned bitsize); + struct ir3_array *arr, int n, struct ir3_instruction *address); void ir3_create_array_store(struct ir3_context *ctx, struct ir3_array *arr, int n, struct ir3_instruction *src, struct ir3_instruction *address); |