summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2015-02-04 13:41:42 -0500
committerRob Clark <[email protected]>2015-03-08 17:42:43 -0400
commitb7703212d8dc2b38407565768ac45d1a307cd810 (patch)
tree3c51ed8069dc49d0ef0dc52df0301d782a360137
parent17754b70d78649f29e25dfe938de91d64dbf5ebf (diff)
freedreno/ir3: split out array_fanin() helper
We'll need this too for relative dst.. Signed-off-by: Rob Clark <[email protected]>
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_compiler.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
index 4b73390fd33..d755babf31b 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler.c
@@ -606,6 +606,35 @@ static int src_array_id(struct ir3_compile_context *ctx,
return fsrc->Indirect.ArrayID + ctx->array_offsets[src->File];
}
+static struct ir3_instruction *
+array_fanin(struct ir3_compile_context *ctx, unsigned aid, unsigned file)
+{
+ struct ir3_instruction *instr;
+
+ if (ctx->array[aid].fanin) {
+ instr = ctx->array[aid].fanin;
+ } else {
+ unsigned first = ctx->array[aid].first;
+ unsigned last = ctx->array[aid].last;
+ unsigned i, j;
+
+ instr = ir3_instr_create2(ctx->block, -1, OPC_META_FI,
+ 1 + (4 * (last + 1 - first)));
+ ir3_reg_create(instr, 0, 0);
+ for (i = first; i <= last; i++) {
+ for (j = 0; j < 4; j++) {
+ unsigned n = regid(i, j);
+ ir3_reg_create(instr, 0, IR3_REG_SSA)->instr =
+ ssa_instr_get(ctx, file, n);
+ }
+ }
+ ctx->array[aid].fanin = instr;
+ ctx->array_dirty |= (1 << aid);
+ }
+
+ return instr;
+}
+
static void
ssa_dst(struct ir3_compile_context *ctx, struct ir3_instruction *instr,
const struct tgsi_dst_register *dst, unsigned chan)
@@ -628,27 +657,11 @@ ssa_src(struct ir3_compile_context *ctx, struct ir3_register *reg,
unsigned first = ctx->array[aid].first;
unsigned last = ctx->array[aid].last;
unsigned off = src->Index - first; /* vec4 offset */
- unsigned i, j;
reg->size = 4 * (1 + last - first);
reg->offset = regid(off, chan);
- if (ctx->array[aid].fanin) {
- instr = ctx->array[aid].fanin;
- } else {
- instr = ir3_instr_create2(ctx->block, -1, OPC_META_FI,
- 1 + (4 * (last + 1 - first)));
- ir3_reg_create(instr, 0, 0);
- for (i = first; i <= last; i++) {
- for (j = 0; j < 4; j++) {
- unsigned n = regid(i, j);
- ir3_reg_create(instr, 0, IR3_REG_SSA)->instr =
- ssa_instr_get(ctx, src->File, n);
- }
- }
- ctx->array[aid].fanin = instr;
- ctx->array_dirty |= (1 << aid);
- }
+ instr = array_fanin(ctx, aid, src->File);
} else {
/* normal case (not relative addressed GPR) */
instr = ssa_instr_get(ctx, src->File, regid(src->Index, chan));