vc4: Redefine VPM writes as a (destination) QIR register file.
This will let me coalesce the VPM writes into the instructions generating the values.
This commit is contained in:
@@ -74,7 +74,6 @@ static const struct qir_op_info qir_op_info[] = {
|
||||
[QOP_LOG2] = { "log2", 1, 2 },
|
||||
[QOP_PACK_COLORS] = { "pack_colors", 1, 4 },
|
||||
[QOP_PACK_SCALED] = { "pack_scaled", 1, 2 },
|
||||
[QOP_VPM_WRITE] = { "vpm_write", 0, 1, true },
|
||||
[QOP_VPM_READ] = { "vpm_read", 0, 1, true },
|
||||
[QOP_TLB_DISCARD_SETUP] = { "discard", 0, 1, true },
|
||||
[QOP_TLB_STENCIL_SETUP] = { "tlb_stencil_setup", 0, 1, true },
|
||||
@@ -150,6 +149,9 @@ qir_has_side_effects(struct vc4_compile *c, struct qinst *inst)
|
||||
}
|
||||
}
|
||||
|
||||
if (inst->dst.file == QFILE_VPM)
|
||||
return true;
|
||||
|
||||
return qir_op_info[inst->op].has_side_effects;
|
||||
}
|
||||
|
||||
@@ -217,6 +219,8 @@ qir_print_reg(struct vc4_compile *c, struct qreg reg)
|
||||
fprintf(stderr, "%d", reg.index);
|
||||
else
|
||||
fprintf(stderr, "%f", uif(reg.index));
|
||||
} else if (reg.file == QFILE_VPM) {
|
||||
fprintf(stderr, "vpm");
|
||||
} else {
|
||||
fprintf(stderr, "%s%d", files[reg.file], reg.index);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ enum qfile {
|
||||
QFILE_TEMP,
|
||||
QFILE_VARY,
|
||||
QFILE_UNIF,
|
||||
QFILE_VPM,
|
||||
|
||||
/**
|
||||
* Stores an immediate value in the index field that can be turned
|
||||
@@ -100,7 +101,6 @@ enum qop {
|
||||
QOP_VR_SETUP,
|
||||
QOP_PACK_SCALED,
|
||||
QOP_PACK_COLORS,
|
||||
QOP_VPM_WRITE,
|
||||
QOP_VPM_READ,
|
||||
QOP_TLB_DISCARD_SETUP,
|
||||
QOP_TLB_STENCIL_SETUP,
|
||||
@@ -472,7 +472,6 @@ QIR_ALU1(EXP2)
|
||||
QIR_ALU1(LOG2)
|
||||
QIR_ALU2(PACK_SCALED)
|
||||
QIR_ALU1(VARY_ADD_C)
|
||||
QIR_NODST_1(VPM_WRITE)
|
||||
QIR_NODST_2(TEX_S)
|
||||
QIR_NODST_2(TEX_T)
|
||||
QIR_NODST_2(TEX_R)
|
||||
@@ -545,4 +544,11 @@ qir_POW(struct vc4_compile *c, struct qreg x, struct qreg y)
|
||||
qir_LOG2(c, x)));
|
||||
}
|
||||
|
||||
static inline void
|
||||
qir_VPM_WRITE(struct vc4_compile *c, struct qreg val)
|
||||
{
|
||||
static const struct qreg vpm = { QFILE_VPM, 0 };
|
||||
qir_emit(c, qir_inst(QOP_MOV, vpm, val, c->undef));
|
||||
}
|
||||
|
||||
#endif /* VC4_QIR_H */
|
||||
|
||||
@@ -249,6 +249,9 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
|
||||
*/
|
||||
assert(src[i].addr <= 47);
|
||||
break;
|
||||
case QFILE_VPM:
|
||||
assert(!"not reached");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,6 +263,9 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
|
||||
case QFILE_TEMP:
|
||||
dst = temp_registers[qinst->dst.index];
|
||||
break;
|
||||
case QFILE_VPM:
|
||||
dst = qpu_ra(QPU_W_VPM);
|
||||
break;
|
||||
case QFILE_VARY:
|
||||
case QFILE_UNIF:
|
||||
case QFILE_SMALL_IMM:
|
||||
@@ -308,10 +314,6 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
|
||||
|
||||
break;
|
||||
|
||||
case QOP_VPM_WRITE:
|
||||
queue(c, qpu_a_MOV(qpu_ra(QPU_W_VPM), src[0]));
|
||||
break;
|
||||
|
||||
case QOP_VPM_READ:
|
||||
queue(c, qpu_a_MOV(dst, qpu_ra(QPU_R_VPM)));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user