set_src_raddr(uint64_t inst, struct qpu_reg src)
{
if (src.mux == QPU_MUX_A) {
- /* These asserts could be better, checking to be sure we're
- * not overwriting an actual use of a raddr of 0.
- */
- assert(QPU_GET_FIELD(inst, QPU_RADDR_A) == 0 ||
+ assert(QPU_GET_FIELD(inst, QPU_RADDR_A) == QPU_R_NOP ||
QPU_GET_FIELD(inst, QPU_RADDR_A) == src.addr);
- return inst | QPU_SET_FIELD(src.addr, QPU_RADDR_A);
+ return ((inst & ~QPU_RADDR_A_MASK) |
+ QPU_SET_FIELD(src.addr, QPU_RADDR_A));
}
if (src.mux == QPU_MUX_B) {
- assert(QPU_GET_FIELD(inst, QPU_RADDR_B) == 0 ||
+ assert(QPU_GET_FIELD(inst, QPU_RADDR_B) == QPU_R_NOP ||
QPU_GET_FIELD(inst, QPU_RADDR_B) == src.addr);
- return inst | QPU_SET_FIELD(src.addr, QPU_RADDR_B);
+ return ((inst & ~QPU_RADDR_B_MASK) |
+ QPU_SET_FIELD(src.addr, QPU_RADDR_B));
}
return inst;
/* Note: These field values are actually non-zero */
inst |= QPU_SET_FIELD(QPU_W_NOP, QPU_WADDR_ADD);
inst |= QPU_SET_FIELD(QPU_W_NOP, QPU_WADDR_MUL);
+ inst |= QPU_SET_FIELD(QPU_R_NOP, QPU_RADDR_A);
+ inst |= QPU_SET_FIELD(QPU_R_NOP, QPU_RADDR_B);
inst |= QPU_SET_FIELD(QPU_SIG_NONE, QPU_SIG);
return inst;
uint64_t inst = 0;
inst |= QPU_SET_FIELD(QPU_A_OR, QPU_OP_ADD);
+ inst |= QPU_SET_FIELD(QPU_R_NOP, QPU_RADDR_A);
+ inst |= QPU_SET_FIELD(QPU_R_NOP, QPU_RADDR_B);
inst |= qpu_a_dst(dst);
inst |= QPU_SET_FIELD(QPU_COND_ALWAYS, QPU_COND_ADD);
inst |= QPU_SET_FIELD(src.mux, QPU_ADD_A);
inst |= QPU_SET_FIELD(src.mux, QPU_ADD_B);
- inst |= set_src_raddr(inst, src);
+ inst = set_src_raddr(inst, src);
inst |= QPU_SET_FIELD(QPU_SIG_NONE, QPU_SIG);
inst |= QPU_SET_FIELD(QPU_W_NOP, QPU_WADDR_MUL);
uint64_t inst = 0;
inst |= QPU_SET_FIELD(QPU_M_V8MIN, QPU_OP_MUL);
+ inst |= QPU_SET_FIELD(QPU_R_NOP, QPU_RADDR_A);
+ inst |= QPU_SET_FIELD(QPU_R_NOP, QPU_RADDR_B);
inst |= qpu_m_dst(dst);
inst |= QPU_SET_FIELD(QPU_COND_ALWAYS, QPU_COND_MUL);
inst |= QPU_SET_FIELD(src.mux, QPU_MUL_A);
inst |= QPU_SET_FIELD(src.mux, QPU_MUL_B);
- inst |= set_src_raddr(inst, src);
+ inst = set_src_raddr(inst, src);
inst |= QPU_SET_FIELD(QPU_SIG_NONE, QPU_SIG);
inst |= QPU_SET_FIELD(QPU_W_NOP, QPU_WADDR_ADD);
uint64_t inst = 0;
inst |= QPU_SET_FIELD(op, QPU_OP_ADD);
+ inst |= QPU_SET_FIELD(QPU_R_NOP, QPU_RADDR_A);
+ inst |= QPU_SET_FIELD(QPU_R_NOP, QPU_RADDR_B);
inst |= qpu_a_dst(dst);
inst |= QPU_SET_FIELD(QPU_COND_ALWAYS, QPU_COND_ADD);
inst |= QPU_SET_FIELD(src0.mux, QPU_ADD_A);
- inst |= set_src_raddr(inst, src0);
+ inst = set_src_raddr(inst, src0);
inst |= QPU_SET_FIELD(src1.mux, QPU_ADD_B);
- inst |= set_src_raddr(inst, src1);
+ inst = set_src_raddr(inst, src1);
inst |= QPU_SET_FIELD(QPU_SIG_NONE, QPU_SIG);
inst |= QPU_SET_FIELD(QPU_W_NOP, QPU_WADDR_MUL);
{
uint64_t inst = 0;
- set_src_raddr(inst, src0);
- set_src_raddr(inst, src1);
-
inst |= QPU_SET_FIELD(op, QPU_OP_MUL);
+ inst |= QPU_SET_FIELD(QPU_R_NOP, QPU_RADDR_A);
+ inst |= QPU_SET_FIELD(QPU_R_NOP, QPU_RADDR_B);
inst |= qpu_m_dst(dst);
inst |= QPU_SET_FIELD(QPU_COND_ALWAYS, QPU_COND_MUL);
inst |= QPU_SET_FIELD(src0.mux, QPU_MUL_A);
- inst |= set_src_raddr(inst, src0);
+ inst = set_src_raddr(inst, src0);
inst |= QPU_SET_FIELD(src1.mux, QPU_MUL_B);
- inst |= set_src_raddr(inst, src1);
+ inst = set_src_raddr(inst, src1);
inst |= QPU_SET_FIELD(QPU_SIG_NONE, QPU_SIG);
inst |= QPU_SET_FIELD(QPU_W_NOP, QPU_WADDR_ADD);
merge = merge_fields(merge, add, mul, QPU_SIG_MASK,
QPU_SET_FIELD(QPU_SIG_NONE, QPU_SIG));
+ merge = merge_fields(merge, add, mul, QPU_RADDR_A_MASK,
+ QPU_SET_FIELD(QPU_R_NOP, QPU_RADDR_A));
+ merge = merge_fields(merge, add, mul, QPU_RADDR_B_MASK,
+ QPU_SET_FIELD(QPU_R_NOP, QPU_RADDR_B));
+
return merge;
}