return (inst & ~QPU_SIG_MASK) | QPU_SET_FIELD(sig, QPU_SIG);
}
+uint64_t
+qpu_set_cond_add(uint64_t inst, uint32_t sig)
+{
+ assert(QPU_GET_FIELD(inst, QPU_COND_ADD) == QPU_COND_ALWAYS);
+ return (inst & ~QPU_COND_ADD_MASK) | QPU_SET_FIELD(sig, QPU_COND_ADD);
+}
+
+uint64_t
+qpu_set_cond_mul(uint64_t inst, uint32_t sig)
+{
+ assert(QPU_GET_FIELD(inst, QPU_COND_MUL) == QPU_COND_ALWAYS);
+ return (inst & ~QPU_COND_MUL_MASK) | QPU_SET_FIELD(sig, QPU_COND_MUL);
+}
+
uint64_t qpu_inst(uint64_t add, uint64_t mul);
uint64_t qpu_load_imm_ui(struct qpu_reg dst, uint32_t val);
uint64_t qpu_set_sig(uint64_t inst, uint32_t sig);
+uint64_t qpu_set_cond_add(uint64_t inst, uint32_t cond);
+uint64_t qpu_set_cond_mul(uint64_t inst, uint32_t cond);
static inline uint64_t
qpu_load_imm_f(struct qpu_reg dst, float val)
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));
+ *last_inst(c) = qpu_set_cond_add(*last_inst(c),
+ QPU_COND_NS);
+ *last_inst(c) = qpu_set_cond_mul(*last_inst(c),
+ QPU_COND_NC);
} else {
if (dst.mux == src[1].mux &&
dst.addr == src[1].addr) {
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));
+ *last_inst(c) = qpu_set_cond_add(*last_inst(c),
+ QPU_COND_NC);
} 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));
+ *last_inst(c) = qpu_set_cond_add(*last_inst(c),
+ QPU_COND_NS);
}
}
break;
queue(c, qpu_load_imm_f(dst, 0.0));
queue(c, qpu_load_imm_f(dst, 1.0));
- *last_inst(c) = ((*last_inst(c) & ~QPU_COND_ADD_MASK)
- | QPU_SET_FIELD(compareflags[qinst->op - QOP_SEQ],
- QPU_COND_ADD));
+ *last_inst(c) = qpu_set_cond_add(*last_inst(c),
+ compareflags[qinst->op - QOP_SEQ]);
+
break;