freedreno/ir3: fixes for indirect writes
authorRob Clark <robclark@freedesktop.org>
Fri, 26 Jun 2015 14:52:34 +0000 (10:52 -0400)
committerRob Clark <robclark@freedesktop.org>
Tue, 30 Jun 2015 16:13:44 +0000 (12:13 -0400)
Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/ir3/ir3.c
src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
src/gallium/drivers/freedreno/ir3/ir3_ra.c

index a166b67d7cfc31389c45a536de6e06b433f057dc..6f6dad597938716eaf0dd7626f80a12d6dd8b91e 100644 (file)
@@ -669,7 +669,6 @@ struct ir3_instruction * ir3_instr_create(struct ir3_block *block,
        return ir3_instr_create2(block, category, opc, 4);
 }
 
-/* only used by old compiler: */
 struct ir3_instruction * ir3_instr_clone(struct ir3_instruction *instr)
 {
        struct ir3_instruction *new_instr = instr_create(instr->block,
index 53b8a6fb1010fbc9fc9cd3217c843ec77f018843..3b36114a5baaf8eb694a80934d7210fb5244aef8 100644 (file)
@@ -1307,7 +1307,7 @@ emit_intrinisic_store_var(struct ir3_compile *ctx, nir_intrinsic_instr *intr)
                         * store_output_indirect? or move this into
                         * create_indirect_store()?
                         */
-                       for (int j = i; j < arr->length; j += 4) {
+                       for (int j = i; j < arr->length; j += intr->num_components) {
                                struct ir3_instruction *split;
 
                                split = ir3_instr_create(ctx->block, -1, OPC_META_FO);
@@ -1318,6 +1318,13 @@ emit_intrinisic_store_var(struct ir3_compile *ctx, nir_intrinsic_instr *intr)
                                arr->arr[j] = split;
                        }
                }
+               /* fixup fanout/split neighbors: */
+               for (int i = 0; i < arr->length; i++) {
+                       arr->arr[i]->cp.right = (i < (arr->length - 1)) ?
+                                       arr->arr[i+1] : NULL;
+                       arr->arr[i]->cp.left = (i > 0) ?
+                                       arr->arr[i-1] : NULL;
+               }
                break;
        }
        default:
index e5aba859fabdcf834e2e413543a3b50c08fe6cb7..0436e01ab2c53374a894f4171e455bfcc312ebb6 100644 (file)
@@ -291,8 +291,6 @@ is_temp(struct ir3_register *reg)
 {
        if (reg->flags & (IR3_REG_CONST | IR3_REG_IMMED))
                return false;
-       if (reg->flags & IR3_REG_RELATIV) // TODO
-               return false;
        if ((reg->num == regid(REG_A0, 0)) ||
                        (reg->num == regid(REG_P0, 0)))
                return false;
@@ -312,6 +310,10 @@ static struct ir3_instruction *
 get_definer(struct ir3_instruction *instr, int *sz, int *off)
 {
        struct ir3_instruction *d = NULL;
+
+       if (instr->fanin)
+               return get_definer(instr->fanin, sz, off);
+
        if (is_meta(instr) && (instr->opc == OPC_META_FI)) {
                /* What about the case where collect is subset of array, we
                 * need to find the distance between where actual array starts