div
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 18 Oct 2018 22:26:40 +0000 (23:26 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 18 Oct 2018 22:26:40 +0000 (23:26 +0100)
riscv/insns/csrrwi.h
riscv/insns/div.h

index 69c547277553600ea6af0b795358e1f529967ac0..eaeecd5290cb2b4d3d22e6119c952d5289c2015c 100644 (file)
@@ -18,5 +18,5 @@ if (csr == CSR_USVVL || csr == CSR_USVMVL)
 reg_t old = p->get_csr(csr);
 p->set_csr(csr, insn.rs1());
 #endif
-WRITE_RD(sext_xlen(old));
+WRITE_RD(sext_xlen(sv_reg_t(old)));
 serialize();
index b4dd9f21124e2e49bae18405e9a2931facbbf9d8..0e44877df441dcb976f7ed9b46a8d33fdb5bb8d4 100644 (file)
@@ -1,9 +1,9 @@
 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(UINT64_MAX);
-else if(lhs == INT64_MIN && rhs == -1)
+else if(lhs == INT64_MIN && rv_eq(rhs, sv_reg_t(-1UL)))
   WRITE_RD(lhs);
 else
   WRITE_RD(sext_xlen(rv_div(lhs, rhs)));