diff --git a/src/broadcom/compiler/qpu_validate.c b/src/broadcom/compiler/qpu_validate.c index e003806261d..3041ed86522 100644 --- a/src/broadcom/compiler/qpu_validate.c +++ b/src/broadcom/compiler/qpu_validate.c @@ -79,7 +79,7 @@ fail_instr(struct v3d_qpu_validate_state *state, const char *msg) static bool in_branch_delay_slots(struct v3d_qpu_validate_state *state) { - return (state->ip - state->last_branch_ip) < 3; + return (state->ip - state->last_branch_ip) < 4; } static bool @@ -128,8 +128,16 @@ qpu_validate_inst(struct v3d_qpu_validate_state *state, struct qinst *qinst) fail_instr(state, "Implicit branch MSF read after TLB Z write"); } - if (inst->type != V3D_QPU_INSTR_TYPE_ALU) + if (inst->type == V3D_QPU_INSTR_TYPE_BRANCH) { + if (in_branch_delay_slots(state)) + fail_instr(state, "branch in a branch delay slot."); + if (in_thrsw_delay_slots(state)) + fail_instr(state, "branch in a THRSW delay slot."); + state->last_branch_ip = state->ip; return; + } + + assert(inst->type == V3D_QPU_INSTR_TYPE_ALU); if (inst->alu.mul.op == V3D_QPU_M_MULTOP) state->rtop_valid = true; @@ -381,14 +389,6 @@ qpu_validate_inst(struct v3d_qpu_validate_state *state, struct qinst *qinst) state->rtop_hazard = true; state->rtop_valid = false; } - - if (inst->type == V3D_QPU_INSTR_TYPE_BRANCH) { - if (in_branch_delay_slots(state)) - fail_instr(state, "branch in a branch delay slot."); - if (in_thrsw_delay_slots(state)) - fail_instr(state, "branch in a THRSW delay slot."); - state->last_branch_ip = state->ip; - } } static void