From a0d65d860db892352ee5848ed28c5d5b75798df7 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 30 Dec 2019 19:02:23 -0500 Subject: [PATCH] pan/midgard: Remove prepacked_branch It's an ugly hack that's no longer used. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/compiler.h | 1 - src/panfrost/midgard/midgard_compile.c | 32 ------------------------- src/panfrost/midgard/midgard_emit.c | 2 +- src/panfrost/midgard/midgard_print.c | 4 ++-- src/panfrost/midgard/midgard_schedule.c | 4 ++-- src/panfrost/midgard/mir.c | 2 +- 6 files changed, 6 insertions(+), 39 deletions(-) diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index 92712dde92b..85b7a87405e 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -109,7 +109,6 @@ typedef struct midgard_instruction { bool compact_branch; bool writeout; - bool prepacked_branch; /* Kind of a hack, but hint against aggressive DCE */ bool dont_eliminate; diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 412e5b01c5b..9afe96f0cfc 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -218,35 +218,6 @@ M_STORE(st_vary_32); M_LOAD(ld_cubemap_coords); M_LOAD(ld_compute_id); -static midgard_instruction -v_alu_br_compact_cond(midgard_jmp_writeout_op op, unsigned tag, signed offset, unsigned cond) -{ - midgard_branch_cond branch = { - .op = op, - .dest_tag = tag, - .offset = offset, - .cond = cond - }; - - uint16_t compact; - memcpy(&compact, &branch, sizeof(branch)); - - midgard_instruction ins = { - .type = TAG_ALU_4, - .unit = ALU_ENAB_BR_COMPACT, - .prepacked_branch = true, - .compact_branch = true, - .br_compact = compact, - .dest = ~0, - .src = { ~0, ~0, ~0, ~0 }, - }; - - if (op == midgard_jmp_writeout_op_writeout) - ins.writeout = true; - - return ins; -} - static midgard_instruction v_branch(bool conditional, bool invert) { @@ -2459,7 +2430,6 @@ emit_loop(struct compiler_context *ctx, nir_loop *nloop) mir_foreach_instr_in_block(block, ins) { if (ins->type != TAG_ALU_4) continue; if (!ins->compact_branch) continue; - if (ins->prepacked_branch) continue; /* We found a branch -- check the type to see if we need to do anything */ if (ins->branch.target_type != TARGET_BREAK) continue; @@ -2752,8 +2722,6 @@ midgard_compile_shader_nir(nir_shader *nir, midgard_program *program, bool is_bl if (!midgard_is_branch_unit(ins->unit)) continue; - if (ins->prepacked_branch) continue; - /* Parse some basic branch info */ bool is_compact = ins->unit == ALU_ENAB_BR_COMPACT; bool is_conditional = ins->branch.conditional; diff --git a/src/panfrost/midgard/midgard_emit.c b/src/panfrost/midgard/midgard_emit.c index 2be6ecedc14..d5aba7f8612 100644 --- a/src/panfrost/midgard/midgard_emit.c +++ b/src/panfrost/midgard/midgard_emit.c @@ -325,7 +325,7 @@ emit_alu_bundle(compiler_context *ctx, midgard_instruction *ins = bundle->instructions[i]; /* Check if this instruction has registers */ - if (ins->compact_branch || ins->prepacked_branch) continue; + if (ins->compact_branch) continue; /* Otherwise, just emit the registers */ uint16_t reg_word = 0; diff --git a/src/panfrost/midgard/midgard_print.c b/src/panfrost/midgard/midgard_print.c index 4f3a52ebb91..227b88c7055 100644 --- a/src/panfrost/midgard/midgard_print.c +++ b/src/panfrost/midgard/midgard_print.c @@ -112,7 +112,7 @@ mir_print_instruction(midgard_instruction *ins) "goto", "break", "continue", "discard" }; - if (ins->compact_branch && !ins->prepacked_branch) + if (ins->compact_branch) name = branch_target_names[ins->branch.target_type]; if (ins->unit) @@ -140,7 +140,7 @@ mir_print_instruction(midgard_instruction *ins) assert(0); } - if (ins->invert || (ins->compact_branch && !ins->prepacked_branch && ins->branch.invert_conditional)) + if (ins->invert || (ins->compact_branch && ins->branch.invert_conditional)) printf(".not"); printf(" "); diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 9ee1f3b77c8..d4239157ead 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -551,7 +551,7 @@ mir_choose_instruction( continue; bool conditional = alu && !branch && OP_IS_CSEL(instructions[i]->alu.op); - conditional |= (branch && !instructions[i]->prepacked_branch && instructions[i]->branch.conditional); + conditional |= (branch && instructions[i]->branch.conditional); if (conditional && no_cond) continue; @@ -873,7 +873,7 @@ mir_schedule_alu( mir_update_worklist(worklist, len, instructions, branch); bool writeout = branch && branch->writeout; - if (branch && !branch->prepacked_branch && branch->branch.conditional) { + if (branch && branch->branch.conditional) { midgard_instruction *cond = mir_schedule_condition(ctx, &predicate, worklist, len, instructions, branch); if (cond->unit == UNIT_VADD) diff --git a/src/panfrost/midgard/mir.c b/src/panfrost/midgard/mir.c index eba772e13b1..f892094afce 100644 --- a/src/panfrost/midgard/mir.c +++ b/src/panfrost/midgard/mir.c @@ -482,7 +482,7 @@ mir_bytemask_of_read_components(midgard_instruction *ins, unsigned node) return 0xFFFF; /* Conditional branches read one 32-bit component = 4 bytes (TODO: multi branch??) */ - if (ins->compact_branch && !ins->prepacked_branch && ins->branch.conditional && (i == 0)) + if (ins->compact_branch && ins->branch.conditional && (i == 0)) return 0xF; /* ALU ops act componentwise so we need to pay attention to -- 2.30.2