reg_t tmp = npc;
-set_pc((RS1 + insn.i_imm()) & ~reg_t(1));
+set_pc(rv_and(rv_add(RS1, insn.i_imm()), ~reg_t(1)));
WRITE_RD(tmp);
if (xlen == 64)
WRITE_RD(mulh(RS1, RS2));
else
- WRITE_RD(sext32((rv_mul(sext32(RS1), sext32(RS2))) >> 32));
+ WRITE_RD(sext32(rv_sr(rv_mul(sext32(RS1), sext32(RS2)),
+ sv_reg_t(32U))));
if (xlen == 64)
WRITE_RD(mulhsu(RS1, RS2));
else
- WRITE_RD(sext32((rv_mul(sext32(RS1), reg_t((uint32_t)RS2))) >> 32));
+ WRITE_RD(sext32(rv_sr((rv_mul(sext32(RS1), sv_reg_uint32(RS2))),
+ sv_reg_t(32U))));
if (xlen == 64)
WRITE_RD(mulhu(RS1, RS2));
else
- WRITE_RD(sext32((rv_mul((uint64_t)(uint32_t)RS1,
- (uint64_t)(uint32_t)RS2)) >> 32));
+ WRITE_RD(sext32(rv_sr(rv_mul(sv_reg_uint32(RS1),
+ sv_reg_uint32(RS2)),
+ sv_reg_t(32U))));
require_extension('M');
-sreg_t lhs = sext_xlen(RS1);
-sreg_t rhs = sext_xlen(RS2);
-if(rhs == 0)
+sv_sreg_t lhs = sext_xlen(RS1);
+sv_sreg_t rhs = sext_xlen(RS2);
+if(rv_eq(rhs, sv_reg_t(0)))
WRITE_RD(lhs);
-else if(lhs == INT64_MIN && rhs == -1)
+else if(rv_eq(lhs, sv_reg_t(INT64_MIN)) && rv_eq(rhs, sv_reg_t(-1L)))
WRITE_RD(0);
else
WRITE_RD(sext_xlen(rv_rem(lhs, rhs)));
require_extension('M');
-reg_t lhs = zext_xlen(RS1);
-reg_t rhs = zext_xlen(RS2);
-if(rhs == 0)
+sv_reg_t lhs = zext_xlen(RS1);
+sv_reg_t rhs = zext_xlen(RS2);
+if(rv_eq(rhs, sv_reg_t(0)))
WRITE_RD(sext_xlen(RS1));
else
WRITE_RD(sext_xlen(rv_rem(lhs, rhs)));
require_extension('M');
require_rv64;
-reg_t lhs = zext32(RS1);
-reg_t rhs = zext32(RS2);
-if(rhs == 0)
+sv_reg_t lhs = zext32(RS1);
+sv_reg_t rhs = zext32(RS2);
+if(rv_eq(rhs, sv_reg_t(0)))
WRITE_RD(sext32(lhs));
else
WRITE_RD(sext32(rv_rem(lhs, rhs)));
require_extension('M');
require_rv64;
-sreg_t lhs = sext32(RS1);
-sreg_t rhs = sext32(RS2);
-if(rhs == 0)
+sv_sreg_t lhs = sext32(RS1);
+sv_sreg_t rhs = sext32(RS2);
+if(rv_eq(rhs, sv_reg_t(0)))
WRITE_RD(lhs);
else
WRITE_RD(sext32(rv_rem(lhs, rhs)));