v3d: Move "does this instruction have flags" from sched to generic helpers.
I wanted to reuse it for DCE of flags updates.
This commit is contained in:
@@ -246,30 +246,6 @@ process_waddr_deps(struct schedule_state *state, struct schedule_node *n,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
process_cond_deps(struct schedule_state *state, struct schedule_node *n,
|
|
||||||
enum v3d_qpu_cond cond)
|
|
||||||
{
|
|
||||||
if (cond != V3D_QPU_COND_NONE)
|
|
||||||
add_read_dep(state, state->last_sf, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
process_pf_deps(struct schedule_state *state, struct schedule_node *n,
|
|
||||||
enum v3d_qpu_pf pf)
|
|
||||||
{
|
|
||||||
if (pf != V3D_QPU_PF_NONE)
|
|
||||||
add_write_dep(state, &state->last_sf, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
process_uf_deps(struct schedule_state *state, struct schedule_node *n,
|
|
||||||
enum v3d_qpu_uf uf)
|
|
||||||
{
|
|
||||||
if (uf != V3D_QPU_UF_NONE)
|
|
||||||
add_write_dep(state, &state->last_sf, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common code for dependencies that need to be tracked both forward and
|
* Common code for dependencies that need to be tracked both forward and
|
||||||
* backward.
|
* backward.
|
||||||
@@ -350,15 +326,6 @@ calculate_deps(struct schedule_state *state, struct schedule_node *n)
|
|||||||
add_write_dep(state, &state->last_tlb, n);
|
add_write_dep(state, &state->last_tlb, n);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case V3D_QPU_A_FLAPUSH:
|
|
||||||
case V3D_QPU_A_FLBPUSH:
|
|
||||||
case V3D_QPU_A_VFLA:
|
|
||||||
case V3D_QPU_A_VFLNA:
|
|
||||||
case V3D_QPU_A_VFLB:
|
|
||||||
case V3D_QPU_A_VFLNB:
|
|
||||||
add_read_dep(state, state->last_sf, n);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -441,12 +408,10 @@ calculate_deps(struct schedule_state *state, struct schedule_node *n)
|
|||||||
if (qinst->uniform != ~0)
|
if (qinst->uniform != ~0)
|
||||||
add_write_dep(state, &state->last_unif, n);
|
add_write_dep(state, &state->last_unif, n);
|
||||||
|
|
||||||
process_cond_deps(state, n, inst->flags.ac);
|
if (v3d_qpu_reads_flags(inst))
|
||||||
process_cond_deps(state, n, inst->flags.mc);
|
add_read_dep(state, state->last_sf, n);
|
||||||
process_pf_deps(state, n, inst->flags.apf);
|
if (v3d_qpu_writes_flags(inst))
|
||||||
process_pf_deps(state, n, inst->flags.mpf);
|
add_write_dep(state, &state->last_sf, n);
|
||||||
process_uf_deps(state, n, inst->flags.auf);
|
|
||||||
process_uf_deps(state, n, inst->flags.muf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -769,7 +769,6 @@ bool vir_is_tex(struct qinst *inst);
|
|||||||
bool vir_is_add(struct qinst *inst);
|
bool vir_is_add(struct qinst *inst);
|
||||||
bool vir_is_mul(struct qinst *inst);
|
bool vir_is_mul(struct qinst *inst);
|
||||||
bool vir_is_float_input(struct qinst *inst);
|
bool vir_is_float_input(struct qinst *inst);
|
||||||
bool vir_depends_on_flags(struct qinst *inst);
|
|
||||||
bool vir_writes_r3(const struct v3d_device_info *devinfo, struct qinst *inst);
|
bool vir_writes_r3(const struct v3d_device_info *devinfo, struct qinst *inst);
|
||||||
bool vir_writes_r4(const struct v3d_device_info *devinfo, struct qinst *inst);
|
bool vir_writes_r4(const struct v3d_device_info *devinfo, struct qinst *inst);
|
||||||
struct qreg vir_follow_movs(struct v3d_compile *c, struct qreg reg);
|
struct qreg vir_follow_movs(struct v3d_compile *c, struct qreg reg);
|
||||||
|
@@ -203,17 +203,6 @@ vir_is_tex(struct qinst *inst)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
vir_depends_on_flags(struct qinst *inst)
|
|
||||||
{
|
|
||||||
if (inst->qpu.type == V3D_QPU_INSTR_TYPE_BRANCH) {
|
|
||||||
return (inst->qpu.branch.cond != V3D_QPU_BRANCH_COND_ALWAYS);
|
|
||||||
} else {
|
|
||||||
return (inst->qpu.flags.ac != V3D_QPU_COND_NONE &&
|
|
||||||
inst->qpu.flags.mc != V3D_QPU_COND_NONE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
vir_writes_r3(const struct v3d_device_info *devinfo, struct qinst *inst)
|
vir_writes_r3(const struct v3d_device_info *devinfo, struct qinst *inst)
|
||||||
{
|
{
|
||||||
|
@@ -47,10 +47,7 @@ dce(struct v3d_compile *c, struct qinst *inst)
|
|||||||
vir_dump_inst(c, inst);
|
vir_dump_inst(c, inst);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
assert(inst->qpu.flags.apf == V3D_QPU_PF_NONE);
|
assert(!v3d_qpu_writes_flags(&inst->qpu));
|
||||||
assert(inst->qpu.flags.mpf == V3D_QPU_PF_NONE);
|
|
||||||
assert(inst->qpu.flags.auf == V3D_QPU_UF_NONE);
|
|
||||||
assert(inst->qpu.flags.muf == V3D_QPU_UF_NONE);
|
|
||||||
vir_remove_instruction(c, inst);
|
vir_remove_instruction(c, inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -809,3 +809,44 @@ v3d_qpu_sig_writes_address(const struct v3d_device_info *devinfo,
|
|||||||
sig->ldtlb ||
|
sig->ldtlb ||
|
||||||
sig->ldtlbu);
|
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;
|
||||||
|
}
|
||||||
|
@@ -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_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_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_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,
|
bool v3d_qpu_sig_writes_address(const struct v3d_device_info *devinfo,
|
||||||
const struct v3d_qpu_sig *sig) ATTRIBUTE_CONST;
|
const struct v3d_qpu_sig *sig) ATTRIBUTE_CONST;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user