+#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(); \
+ EMIT_OP(0x0f); \
+ EMIT(0x92, u8); \
+ EMIT_MODRM(3, 0, tmp); /* SETC */ \
+ emith_bic_r_imm(srr, 1); \
+ EMIT_OP_MODRM(0x08, 3, tmp, srr); /* OR srrl, tmpl */ \
+ rcache_free_tmp(tmp); \
+}
+