This will let us do copy propagation of the VPM reads.
if (inst->op == QOP_MOV &&
inst->dst.file == QFILE_TEMP &&
- (inst->src[0].file != QFILE_TEMP ||
- (defs[inst->src[0].index]->op != QOP_TEX_RESULT &&
- defs[inst->src[0].index]->op != QOP_TLB_COLOR_READ))) {
+ inst->src[0].file != QFILE_VPM &&
+ !(inst->src[0].file == QFILE_TEMP &&
+ (defs[inst->src[0].index]->op == QOP_TEX_RESULT ||
+ defs[inst->src[0].index]->op == QOP_TLB_COLOR_READ))) {
movs[inst->dst.index] = inst->src[0];
}
}
struct qreg vpm_reads[4];
for (int i = 0; i < align(attr_size, 4) / 4; i++) {
- vpm_reads[i] = qir_VPM_READ(c);
+ struct qreg vpm = { QFILE_VPM, attr * 4 + i };
+ vpm_reads[i] = qir_MOV(c, vpm);
c->num_inputs++;
}
return;
for (int i = 0; i < 4; i++) {
- qir_emit(c, qir_inst(QOP_VPM_READ,
- qir_get_temp(c),
- c->undef,
- c->undef));
+ struct qreg vpm = { QFILE_VPM, 0 };
+ (void)qir_MOV(c, vpm);
c->num_inputs++;
}
}
[QOP_PACK_8C_F] = { "pack_8c_f", 1, 2, false, true },
[QOP_PACK_8D_F] = { "pack_8d_f", 1, 2, false, true },
[QOP_PACK_SCALED] = { "pack_scaled", 1, 2, false, 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 },
[QOP_TLB_Z_WRITE] = { "tlb_z", 0, 1, true },
c->input_semantics[inst->src[i].index].semantic == 0xff) {
return true;
}
+
+ if (inst->src[i].file == QFILE_VPM)
+ return true;
}
if (inst->dst.file == QFILE_VPM)
QOP_PACK_8B_F,
QOP_PACK_8C_F,
QOP_PACK_8D_F,
- QOP_VPM_READ,
QOP_TLB_DISCARD_SETUP,
QOP_TLB_STENCIL_SETUP,
QOP_TLB_Z_WRITE,
QIR_ALU0(FRAG_REV_FLAG)
QIR_ALU0(TEX_RESULT)
QIR_ALU0(TLB_COLOR_READ)
-QIR_ALU0(VPM_READ)
QIR_NODST_1(TLB_Z_WRITE)
QIR_NODST_1(TLB_DISCARD_SETUP)
QIR_NODST_1(TLB_STENCIL_SETUP)
uint32_t inputs_remaining = c->num_inputs;
uint32_t vpm_read_fifo_count = 0;
uint32_t vpm_read_offset = 0;
+ int last_vpm_read_index = -1;
bool written_r3 = false;
bool needs_restore;
/* Map from the QIR ops enum order to QPU unpack bits. */
assert(src[i].addr <= 47);
break;
case QFILE_VPM:
- assert(!"not reached");
+ assert((int)qinst->src[i].index >=
+ last_vpm_read_index);
+ last_vpm_read_index = qinst->src[i].index;
+ src[i] = qpu_ra(QPU_R_VPM);
break;
}
}
break;
- case QOP_VPM_READ:
- queue(c, qpu_a_MOV(dst, qpu_ra(QPU_R_VPM)));
- break;
-
case QOP_RCP:
case QOP_RSQ:
case QOP_EXP2: