v3d: Add a helper function for getting a nop register.
Just a little refactor to explain what's going on with QFILE_NULL.
This commit is contained in:
@@ -698,7 +698,7 @@ ntq_emit_comparison(struct v3d_compile *c,
|
|||||||
if (nir_op_infos[compare_instr->op].num_inputs > 1)
|
if (nir_op_infos[compare_instr->op].num_inputs > 1)
|
||||||
src1 = ntq_get_alu_src(c, compare_instr, 1);
|
src1 = ntq_get_alu_src(c, compare_instr, 1);
|
||||||
bool cond_invert = false;
|
bool cond_invert = false;
|
||||||
struct qreg nop = vir_reg(QFILE_NULL, 0);
|
struct qreg nop = vir_nop_reg();
|
||||||
|
|
||||||
switch (compare_instr->op) {
|
switch (compare_instr->op) {
|
||||||
case nir_op_feq32:
|
case nir_op_feq32:
|
||||||
@@ -1116,7 +1116,7 @@ emit_frag_end(struct v3d_compile *c)
|
|||||||
struct nir_variable *var = c->output_color_var[0];
|
struct nir_variable *var = c->output_color_var[0];
|
||||||
struct qreg *color = &c->outputs[var->data.driver_location * 4];
|
struct qreg *color = &c->outputs[var->data.driver_location * 4];
|
||||||
|
|
||||||
vir_SETMSF_dest(c, vir_reg(QFILE_NULL, 0),
|
vir_SETMSF_dest(c, vir_nop_reg(),
|
||||||
vir_AND(c,
|
vir_AND(c,
|
||||||
vir_MSF(c),
|
vir_MSF(c),
|
||||||
vir_FTOC(c, color[3])));
|
vir_FTOC(c, color[3])));
|
||||||
@@ -1153,7 +1153,7 @@ emit_frag_end(struct v3d_compile *c)
|
|||||||
|
|
||||||
struct qinst *inst = vir_MOV_dest(c,
|
struct qinst *inst = vir_MOV_dest(c,
|
||||||
vir_reg(QFILE_TLBU, 0),
|
vir_reg(QFILE_TLBU, 0),
|
||||||
vir_reg(QFILE_NULL, 0));
|
vir_nop_reg());
|
||||||
uint8_t tlb_specifier = TLB_TYPE_DEPTH;
|
uint8_t tlb_specifier = TLB_TYPE_DEPTH;
|
||||||
|
|
||||||
if (c->devinfo->ver >= 42) {
|
if (c->devinfo->ver >= 42) {
|
||||||
@@ -1888,11 +1888,11 @@ ntq_emit_intrinsic(struct v3d_compile *c, nir_intrinsic_instr *instr)
|
|||||||
case nir_intrinsic_discard:
|
case nir_intrinsic_discard:
|
||||||
if (c->execute.file != QFILE_NULL) {
|
if (c->execute.file != QFILE_NULL) {
|
||||||
vir_PF(c, c->execute, V3D_QPU_PF_PUSHZ);
|
vir_PF(c, c->execute, V3D_QPU_PF_PUSHZ);
|
||||||
vir_set_cond(vir_SETMSF_dest(c, vir_reg(QFILE_NULL, 0),
|
vir_set_cond(vir_SETMSF_dest(c, vir_nop_reg(),
|
||||||
vir_uniform_ui(c, 0)),
|
vir_uniform_ui(c, 0)),
|
||||||
V3D_QPU_COND_IFA);
|
V3D_QPU_COND_IFA);
|
||||||
} else {
|
} else {
|
||||||
vir_SETMSF_dest(c, vir_reg(QFILE_NULL, 0),
|
vir_SETMSF_dest(c, vir_nop_reg(),
|
||||||
vir_uniform_ui(c, 0));
|
vir_uniform_ui(c, 0));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1908,12 +1908,12 @@ ntq_emit_intrinsic(struct v3d_compile *c, nir_intrinsic_instr *instr)
|
|||||||
*/
|
*/
|
||||||
vir_PF(c, vir_OR(c, c->execute, vir_NOT(c, cond)),
|
vir_PF(c, vir_OR(c, c->execute, vir_NOT(c, cond)),
|
||||||
V3D_QPU_PF_PUSHZ);
|
V3D_QPU_PF_PUSHZ);
|
||||||
vir_set_cond(vir_SETMSF_dest(c, vir_reg(QFILE_NULL, 0),
|
vir_set_cond(vir_SETMSF_dest(c, vir_nop_reg(),
|
||||||
vir_uniform_ui(c, 0)),
|
vir_uniform_ui(c, 0)),
|
||||||
V3D_QPU_COND_IFA);
|
V3D_QPU_COND_IFA);
|
||||||
} else {
|
} else {
|
||||||
vir_PF(c, cond, V3D_QPU_PF_PUSHZ);
|
vir_PF(c, cond, V3D_QPU_PF_PUSHZ);
|
||||||
vir_set_cond(vir_SETMSF_dest(c, vir_reg(QFILE_NULL, 0),
|
vir_set_cond(vir_SETMSF_dest(c, vir_nop_reg(),
|
||||||
vir_uniform_ui(c, 0)),
|
vir_uniform_ui(c, 0)),
|
||||||
V3D_QPU_COND_IFNA);
|
V3D_QPU_COND_IFNA);
|
||||||
}
|
}
|
||||||
@@ -2008,7 +2008,7 @@ ntq_emit_intrinsic(struct v3d_compile *c, nir_intrinsic_instr *instr)
|
|||||||
static void
|
static void
|
||||||
ntq_activate_execute_for_block(struct v3d_compile *c)
|
ntq_activate_execute_for_block(struct v3d_compile *c)
|
||||||
{
|
{
|
||||||
vir_set_pf(vir_XOR_dest(c, vir_reg(QFILE_NULL, 0),
|
vir_set_pf(vir_XOR_dest(c, vir_nop_reg(),
|
||||||
c->execute, vir_uniform_ui(c, c->cur_block->index)),
|
c->execute, vir_uniform_ui(c, c->cur_block->index)),
|
||||||
V3D_QPU_PF_PUSHZ);
|
V3D_QPU_PF_PUSHZ);
|
||||||
|
|
||||||
@@ -2106,8 +2106,7 @@ ntq_emit_nonuniform_if(struct v3d_compile *c, nir_if *if_stmt)
|
|||||||
if (was_top_level) {
|
if (was_top_level) {
|
||||||
cond = v3d_qpu_cond_invert(cond);
|
cond = v3d_qpu_cond_invert(cond);
|
||||||
} else {
|
} else {
|
||||||
struct qinst *inst = vir_MOV_dest(c, vir_reg(QFILE_NULL, 0),
|
struct qinst *inst = vir_MOV_dest(c, vir_nop_reg(), c->execute);
|
||||||
c->execute);
|
|
||||||
if (cond == V3D_QPU_COND_IFA) {
|
if (cond == V3D_QPU_COND_IFA) {
|
||||||
vir_set_uf(inst, V3D_QPU_UF_NORNZ);
|
vir_set_uf(inst, V3D_QPU_UF_NORNZ);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1028,7 +1028,7 @@ insert_scheduled_instruction(struct v3d_compile *c,
|
|||||||
static struct qinst *
|
static struct qinst *
|
||||||
vir_nop()
|
vir_nop()
|
||||||
{
|
{
|
||||||
struct qreg undef = { QFILE_NULL, 0 };
|
struct qreg undef = vir_nop_reg();
|
||||||
struct qinst *qinst = vir_add_inst(V3D_QPU_A_NOP, undef, undef, undef);
|
struct qinst *qinst = vir_add_inst(V3D_QPU_A_NOP, undef, undef, undef);
|
||||||
|
|
||||||
return qinst;
|
return qinst;
|
||||||
|
@@ -105,6 +105,11 @@ static inline struct qreg vir_reg(enum qfile file, uint32_t index)
|
|||||||
return (struct qreg){file, index};
|
return (struct qreg){file, index};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline struct qreg vir_nop_reg(void)
|
||||||
|
{
|
||||||
|
return (struct qreg){QFILE_NULL, 0};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A reference to an actual register at the QPU level, for register
|
* A reference to an actual register at the QPU level, for register
|
||||||
* allocation.
|
* allocation.
|
||||||
|
@@ -401,7 +401,7 @@ vir_branch_inst(enum v3d_qpu_branch_cond cond, struct qreg src)
|
|||||||
inst->qpu.branch.ub = true;
|
inst->qpu.branch.ub = true;
|
||||||
inst->qpu.branch.bdu = V3D_QPU_BRANCH_DEST_REL;
|
inst->qpu.branch.bdu = V3D_QPU_BRANCH_DEST_REL;
|
||||||
|
|
||||||
inst->dst = vir_reg(QFILE_NULL, 0);
|
inst->dst = vir_nop_reg();
|
||||||
inst->src[0] = src;
|
inst->src[0] = src;
|
||||||
inst->uniform = ~0;
|
inst->uniform = ~0;
|
||||||
|
|
||||||
@@ -1098,7 +1098,7 @@ vir_PF(struct v3d_compile *c, struct qreg src, enum v3d_qpu_pf pf)
|
|||||||
last_inst != c->defs[src.index] ||
|
last_inst != c->defs[src.index] ||
|
||||||
!vir_can_set_flags(c, last_inst)) {
|
!vir_can_set_flags(c, last_inst)) {
|
||||||
/* XXX: Make the MOV be the appropriate type */
|
/* XXX: Make the MOV be the appropriate type */
|
||||||
last_inst = vir_MOV_dest(c, vir_reg(QFILE_NULL, 0), src);
|
last_inst = vir_MOV_dest(c, vir_nop_reg(), src);
|
||||||
}
|
}
|
||||||
|
|
||||||
vir_set_pf(last_inst, pf);
|
vir_set_pf(last_inst, pf);
|
||||||
|
@@ -76,7 +76,7 @@ v3d_qpu_nop(void)
|
|||||||
static struct qinst *
|
static struct qinst *
|
||||||
vir_nop(void)
|
vir_nop(void)
|
||||||
{
|
{
|
||||||
struct qreg undef = { QFILE_NULL, 0 };
|
struct qreg undef = vir_nop_reg();
|
||||||
struct qinst *qinst = vir_add_inst(V3D_QPU_A_NOP, undef, undef, undef);
|
struct qinst *qinst = vir_add_inst(V3D_QPU_A_NOP, undef, undef, undef);
|
||||||
|
|
||||||
return qinst;
|
return qinst;
|
||||||
|
Reference in New Issue
Block a user