{
struct qcompile *c = trans->c;
struct qreg dst = qir_get_temp(c);
- qir_emit(c, qir_inst(op, dst, src[0 * 4 + i], src[1 * 4 + i]));
+ qir_emit(c, qir_inst4(op, dst,
+ src[0 * 4 + i],
+ src[1 * 4 + i],
+ src[2 * 4 + i],
+ c->undef));
return dst;
}
[TGSI_OPCODE_SNE] = { QOP_SNE, tgsi_to_qir_alu },
[TGSI_OPCODE_SGE] = { QOP_SGE, tgsi_to_qir_alu },
[TGSI_OPCODE_SLT] = { QOP_SLT, tgsi_to_qir_alu },
+ [TGSI_OPCODE_CMP] = { QOP_CMP, tgsi_to_qir_alu },
[TGSI_OPCODE_MAD] = { 0, tgsi_to_qir_mad },
[TGSI_OPCODE_DP2] = { 0, tgsi_to_qir_dp2 },
[TGSI_OPCODE_DP3] = { 0, tgsi_to_qir_dp3 },
[QOP_SNE] = { "sne", 1, 2 },
[QOP_SGE] = { "sge", 1, 2 },
[QOP_SLT] = { "slt", 1, 2 },
+ [QOP_CMP] = { "cmp", 1, 3 },
[QOP_FTOI] = { "ftoi", 1, 1 },
[QOP_RCP] = { "rcp", 1, 1 },
}
break;
+ case QOP_CMP:
+ queue(c, qpu_inst(qpu_a_MOV(qpu_ra(QPU_W_NOP),
+ src[0]),
+ qpu_m_NOP()));
+ *last_inst(c) |= QPU_SF;
+
+ if (dst.mux <= QPU_MUX_R3) {
+ fixup_raddr_conflict(c, src[1], &src[2]);
+ queue(c, qpu_inst(qpu_a_MOV(dst, src[1]),
+ qpu_m_MOV(dst, src[2])));
+ *last_inst(c) = ((*last_inst(c) & ~(QPU_COND_ADD_MASK |
+ QPU_COND_MUL_MASK))
+ | QPU_SET_FIELD(QPU_COND_NS,
+ QPU_COND_ADD)
+ | QPU_SET_FIELD(QPU_COND_NC,
+ QPU_COND_MUL));
+ } else {
+ if (dst.mux == src[1].mux &&
+ dst.addr == src[1].addr) {
+ queue(c, qpu_inst(qpu_a_MOV(dst, src[1]),
+ qpu_m_NOP()));
+
+ queue(c, qpu_inst(qpu_a_MOV(dst, src[2]),
+ qpu_m_NOP()));
+ *last_inst(c) = ((*last_inst(c) & ~(QPU_COND_ADD_MASK))
+ | QPU_SET_FIELD(QPU_COND_NC,
+ QPU_COND_ADD));
+ } else {
+ queue(c, qpu_inst(qpu_a_MOV(dst, src[2]),
+ qpu_m_NOP()));
+
+ queue(c, qpu_inst(qpu_a_MOV(dst, src[1]),
+ qpu_m_NOP()));
+ *last_inst(c) = ((*last_inst(c) & ~(QPU_COND_ADD_MASK))
+ | QPU_SET_FIELD(QPU_COND_NS,
+ QPU_COND_ADD));
+ }
+ }
+ break;
+
case QOP_SEQ:
case QOP_SNE:
case QOP_SGE: