From 29416a85993a7352c7c575e43ffd6a70a7d8e3ef Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 30 Jul 2019 12:20:24 -0700 Subject: [PATCH] pan/midgard: De-special-case branching It's not that special. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_compile.c | 15 +++++++++++---- src/panfrost/midgard/midgard_liveness.c | 3 --- src/panfrost/midgard/midgard_opt_dce.c | 2 -- src/panfrost/midgard/midgard_ra.c | 11 ----------- src/panfrost/midgard/midgard_ra_pipeline.c | 5 ----- src/panfrost/midgard/midgard_schedule.c | 5 ----- 6 files changed, 11 insertions(+), 30 deletions(-) diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index a03740acf7d..8126c1e25a6 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -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) { diff --git a/src/panfrost/midgard/midgard_liveness.c b/src/panfrost/midgard/midgard_liveness.c index 899c8eaa00f..1dfe980467b 100644 --- a/src/panfrost/midgard/midgard_liveness.c +++ b/src/panfrost/midgard/midgard_liveness.c @@ -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; diff --git a/src/panfrost/midgard/midgard_opt_dce.c b/src/panfrost/midgard/midgard_opt_dce.c index d0d8b1a1833..0abbf03b551 100644 --- a/src/panfrost/midgard/midgard_opt_dce.c +++ b/src/panfrost/midgard/midgard_opt_dce.c @@ -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; diff --git a/src/panfrost/midgard/midgard_ra.c b/src/panfrost/midgard/midgard_ra.c index 48a8c94bdd7..312759c4a1d 100644 --- a/src/panfrost/midgard/midgard_ra.c +++ b/src/panfrost/midgard/midgard_ra.c @@ -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); } } diff --git a/src/panfrost/midgard/midgard_ra_pipeline.c b/src/panfrost/midgard/midgard_ra_pipeline.c index 7bbf8a93759..a5c1025ee27 100644 --- a/src/panfrost/midgard/midgard_ra_pipeline.c +++ b/src/panfrost/midgard/midgard_ra_pipeline.c @@ -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 */ diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 62135010d98..e4bc6828127 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -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; -- 2.30.2