From ebde5afb93ef4db9fcfc53a561cef7d3e0a630f6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 29 Dec 2018 11:00:25 -0800 Subject: v3d: Move "does this instruction have flags" from sched to generic helpers. I wanted to reuse it for DCE of flags updates. --- src/broadcom/qpu/qpu_instr.c | 41 +++++++++++++++++++++++++++++++++++++++++ src/broadcom/qpu/qpu_instr.h | 2 ++ 2 files changed, 43 insertions(+) (limited to 'src/broadcom/qpu') diff --git a/src/broadcom/qpu/qpu_instr.c b/src/broadcom/qpu/qpu_instr.c index 08f29a40937..338a1887f03 100644 --- a/src/broadcom/qpu/qpu_instr.c +++ b/src/broadcom/qpu/qpu_instr.c @@ -809,3 +809,44 @@ v3d_qpu_sig_writes_address(const struct v3d_device_info *devinfo, sig->ldtlb || sig->ldtlbu); } + +bool +v3d_qpu_reads_flags(const struct v3d_qpu_instr *inst) +{ + if (inst->type == V3D_QPU_INSTR_TYPE_BRANCH) { + return inst->branch.cond != V3D_QPU_BRANCH_COND_ALWAYS; + } else if (inst->type == V3D_QPU_INSTR_TYPE_ALU) { + if (inst->flags.ac != V3D_QPU_COND_NONE || + inst->flags.mc != V3D_QPU_COND_NONE || + inst->flags.auf != V3D_QPU_UF_NONE || + inst->flags.muf != V3D_QPU_UF_NONE) + return true; + + switch (inst->alu.add.op) { + case V3D_QPU_A_VFLA: + case V3D_QPU_A_VFLNA: + case V3D_QPU_A_VFLB: + case V3D_QPU_A_VFLNB: + case V3D_QPU_A_FLAPUSH: + case V3D_QPU_A_FLBPUSH: + return true; + default: + break; + } + } + + return false; +} + +bool +v3d_qpu_writes_flags(const struct v3d_qpu_instr *inst) +{ + if (inst->flags.apf != V3D_QPU_PF_NONE || + inst->flags.mpf != V3D_QPU_PF_NONE || + inst->flags.auf != V3D_QPU_UF_NONE || + inst->flags.muf != V3D_QPU_UF_NONE) { + return true; + } + + return false; +} diff --git a/src/broadcom/qpu/qpu_instr.h b/src/broadcom/qpu/qpu_instr.h index 49d66ee888f..0da61fbb5d5 100644 --- a/src/broadcom/qpu/qpu_instr.h +++ b/src/broadcom/qpu/qpu_instr.h @@ -458,6 +458,8 @@ bool v3d_qpu_uses_mux(const struct v3d_qpu_instr *inst, enum v3d_qpu_mux mux); bool v3d_qpu_uses_vpm(const struct v3d_qpu_instr *inst) ATTRIBUTE_CONST; bool v3d_qpu_reads_vpm(const struct v3d_qpu_instr *inst) ATTRIBUTE_CONST; bool v3d_qpu_writes_vpm(const struct v3d_qpu_instr *inst) ATTRIBUTE_CONST; +bool v3d_qpu_reads_flags(const struct v3d_qpu_instr *inst) ATTRIBUTE_CONST; +bool v3d_qpu_writes_flags(const struct v3d_qpu_instr *inst) ATTRIBUTE_CONST; bool v3d_qpu_sig_writes_address(const struct v3d_device_info *devinfo, const struct v3d_qpu_sig *sig) ATTRIBUTE_CONST; -- cgit v1.2.3