pan/midgard: De-special-case branching
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 30 Jul 2019 19:20:24 +0000 (12:20 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 31 Jul 2019 17:59:18 +0000 (10:59 -0700)
It's not that special.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/midgard_compile.c
src/panfrost/midgard/midgard_liveness.c
src/panfrost/midgard/midgard_opt_dce.c
src/panfrost/midgard/midgard_ra.c
src/panfrost/midgard/midgard_ra_pipeline.c
src/panfrost/midgard/midgard_schedule.c

index a03740acf7d59ab6389461fba3de6f403a616d14..8126c1e25a6abb572c995a092554a98b9b8c4a05 100644 (file)
@@ -193,7 +193,12 @@ v_alu_br_compact_cond(midgard_jmp_writeout_op op, unsigned tag, signed offset, u
                 .unit = ALU_ENAB_BR_COMPACT,
                 .prepacked_branch = true,
                 .compact_branch = true,
-                .br_compact = compact
+                .br_compact = compact,
+                .ssa_args = {
+                        .dest = -1,
+                        .src0 = -1,
+                        .src1 = -1,
+                }
         };
 
         if (op == midgard_jmp_writeout_op_writeout)
@@ -212,6 +217,11 @@ v_branch(bool conditional, bool invert)
                 .branch = {
                         .conditional = conditional,
                         .invert_conditional = invert
+                },
+                .ssa_args = {
+                        .dest = -1,
+                        .src0 = -1,
+                        .src1 = -1
                 }
         };
 
@@ -1744,9 +1754,6 @@ inline_alu_constants(compiler_context *ctx)
                 /* If there is already a constant here, we can do nothing */
                 if (alu->has_constants) continue;
 
-                /* It makes no sense to inline constants on a branch */
-                if (alu->compact_branch || alu->prepacked_branch) continue;
-
                 CONDITIONAL_ATTACH(src0);
 
                 if (!alu->has_constants) {
index 899c8eaa00ffcf6accddf98ee6065bb53b94947c..1dfe980467bbc6b94c2ced415c5a6f420c99fd40 100644 (file)
@@ -31,9 +31,6 @@
 static bool
 midgard_is_live_in_instr(midgard_instruction *ins, int src)
 {
-        if (ins->compact_branch)
-                return false;
-
         if (ins->ssa_args.src0 == src)
                 return true;
 
index d0d8b1a18330041d5166d3c721e319720fad0265..0abbf03b5514378c877e72214ac004d62f6beffa 100644 (file)
@@ -63,8 +63,6 @@ midgard_opt_dead_move_eliminate(compiler_context *ctx, midgard_block *block)
                 bool overwritten = false;
 
                 mir_foreach_instr_in_block_from(block, q, mir_next_op(ins)) {
-                        if (q->compact_branch) continue;
-
                         /* Check if used */
                         if (mir_has_arg(q, ins->ssa_args.dest))
                                 break;
index 48a8c94bdd76242839c50d7e8333d053d2bc9e92..312759c4a1d2a7bf3a672325fffc0bacd5a2bab9 100644 (file)
@@ -418,8 +418,6 @@ mir_lower_special_reads(compiler_context *ctx)
         /* Pass #1 is analysis, a linear scan to fill out the bitfields */
 
         mir_foreach_instr_global(ctx, ins) {
-                if (ins->compact_branch) continue;
-
                 switch (ins->type) {
                 case TAG_ALU_4:
                         mark_node_class(aluw, ins->ssa_args.dest);
@@ -497,7 +495,6 @@ mir_lower_special_reads(compiler_context *ctx)
 
                         /* Insert move after each write */
                         mir_foreach_instr_global_safe(ctx, pre_use) {
-                                if (pre_use->compact_branch) continue;
                                 if (pre_use->ssa_args.dest != i)
                                         continue;
 
@@ -561,7 +558,6 @@ allocate_registers(compiler_context *ctx, bool *spilled)
         unsigned *found_class = calloc(sizeof(unsigned), ctx->temp_count);
 
         mir_foreach_instr_global(ctx, ins) {
-                if (ins->compact_branch) continue;
                 if (ins->ssa_args.dest < 0) continue;
                 if (ins->ssa_args.dest >= SSA_FIXED_MINIMUM) continue;
 
@@ -583,8 +579,6 @@ allocate_registers(compiler_context *ctx, bool *spilled)
          * nodes (TODO) */
 
         mir_foreach_instr_global(ctx, ins) {
-                if (ins->compact_branch) continue;
-
                 /* Check if this operation imposes any classes */
 
                 if (ins->type == TAG_LOAD_STORE_4) {
@@ -608,8 +602,6 @@ allocate_registers(compiler_context *ctx, bool *spilled)
 
         /* Check that the semantics of the class are respected */
         mir_foreach_instr_global(ctx, ins) {
-                if (ins->compact_branch) continue;
-
                 assert(check_write_class(found_class, ins->type, ins->ssa_args.dest));
                 assert(check_read_class(found_class, ins->type, ins->ssa_args.src0));
 
@@ -637,8 +629,6 @@ allocate_registers(compiler_context *ctx, bool *spilled)
 
         mir_foreach_block(ctx, block) {
                 mir_foreach_instr_in_block(block, ins) {
-                        if (ins->compact_branch) continue;
-
                         if (ins->ssa_args.dest < SSA_FIXED_MINIMUM) {
                                 /* If this destination is not yet live, it is
                                  * now since we just wrote it */
@@ -864,7 +854,6 @@ install_registers(compiler_context *ctx, struct ra_graph *g)
 {
         mir_foreach_block(ctx, block) {
                 mir_foreach_instr_in_block(block, ins) {
-                        if (ins->compact_branch) continue;
                         install_registers_instr(ctx, g, ins);
                 }
         }
index 7bbf8a937591a7678d6d456486f0beab2e1c55f1..a5c1025ee275ec6995a4f3158f1bb9859a11c029 100644 (file)
@@ -48,11 +48,6 @@ mir_pipeline_ins(
         midgard_instruction *ins = bundle->instructions[i];
         unsigned dest = ins->ssa_args.dest;
 
-        /* Check to make sure we're legal */
-
-        if (ins->compact_branch)
-                return false;
-
         /* We could be pipelining a register, so we need to make sure that all
          * of the components read in this bundle are written in this bundle,
          * and that no components are written before this bundle */
index 62135010d9892d476be5ac1de4cf6c3ea709195c..e4bc68281278dcce08a1e7ac8b550fef6b0a55c6 100644 (file)
@@ -686,8 +686,6 @@ mir_squeeze_index(compiler_context *ctx)
         ctx->hash_to_temp = _mesa_hash_table_u64_create(NULL);
 
         mir_foreach_instr_global(ctx, ins) {
-                if (ins->compact_branch) continue;
-
                 ins->ssa_args.dest = find_or_allocate_temp(ctx, ins->ssa_args.dest);
                 ins->ssa_args.src0 = find_or_allocate_temp(ctx, ins->ssa_args.src0);
 
@@ -808,7 +806,6 @@ schedule_program(compiler_context *ctx)
 
                         if (!is_special || is_special_w) {
                                 mir_foreach_instr_global_safe(ctx, ins) {
-                                        if (ins->compact_branch) continue;
                                         if (ins->ssa_args.dest != spill_node) continue;
 
                                         midgard_instruction st;
@@ -843,8 +840,6 @@ schedule_program(compiler_context *ctx)
                         unsigned consecutive_index = 0;
 
                         mir_foreach_instr_in_block(block, ins) {
-                                if (ins->compact_branch) continue;
-
                                 /* We can't rewrite the move used to spill in the first place */
                                 if (ins == spill_move) continue;