Mesa (master): freedreno/ir3: adjust the bitsize of regs when an array loading.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 3 19:44:34 UTC 2019


Module: Mesa
Branch: master
Commit: 43d80a3e20b2ac9b343d1b223eb2816e86248fe7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=43d80a3e20b2ac9b343d1b223eb2816e86248fe7

Author: Hyunjun Ko <zzoon at igalia.com>
Date:   Mon Apr 22 06:16:48 2019 +0000

freedreno/ir3: adjust the bitsize of regs when an array loading.

Signed-off-by: Rob Clark <robdclark at chromium.org>

---

 src/freedreno/ir3/ir3_context.c | 20 ++++++++++++++------
 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);
 




More information about the mesa-commit mailing list