+ rcache_free_tmp(tmp_); \
+}
+
+#define emith_write_sr(srcr) { \
+ int tmp_ = rcache_get_tmp(); \
+ int srr = rcache_get_reg(SHR_SR, RC_GR_RMW); \
+ emith_clear_msb(tmp_, srcr, 20); \
+ emith_bic_r_imm(srr, 0xfff); \
+ emith_or_r_r(srr, tmp_); \
+ rcache_free_tmp(tmp_); \
+}
+
+#define emith_carry_to_t(srr, is_sub) { \
+ int tmp_ = rcache_get_tmp(); \
+ emith_setc(tmp_); \
+ emith_bic_r_imm(srr, 1); \
+ EMIT_OP_MODRM(0x08, 3, tmp_, srr); /* OR srrl, tmpl */ \
+ rcache_free_tmp(tmp_); \
+}
+
+/*
+ * if Q
+ * t = carry(Rn += Rm)
+ * else
+ * t = carry(Rn -= Rm)
+ * T ^= t
+ */
+#define emith_sh2_div1_step(rn, rm, sr) { \
+ u8 *jmp0, *jmp1; \
+ int tmp_ = rcache_get_tmp(); \
+ emith_tst_r_imm(sr, Q); /* if (Q ^ M) */ \
+ JMP8_POS(jmp0); /* je do_sub */ \
+ emith_add_r_r(rn, rm); \
+ JMP8_POS(jmp1); /* jmp done */ \
+ JMP8_EMIT(IOP_JE, jmp0); /* do_sub: */ \
+ emith_sub_r_r(rn, rm); \
+ JMP8_EMIT(IOP_JMP, jmp1);/* done: */ \
+ emith_setc(tmp_); \
+ EMIT_OP_MODRM(0x30, 3, tmp_, sr); /* T = Q1 ^ Q2 (byte) */ \
+ rcache_free_tmp(tmp_); \