replace operator * with rv_mul
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 14 Oct 2018 04:42:39 +0000 (05:42 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 14 Oct 2018 04:42:39 +0000 (05:42 +0100)
riscv/insns/mul.h
riscv/insns/mulh.h
riscv/insns/mulhsu.h
riscv/insns/mulhu.h
riscv/sv_insn_redirect.cc
riscv/sv_insn_redirect.h

index 0102d3651009ab274350f142c4376e9d664b994a..d91ab0898c52024b866f0f1f7e75ce0b2c51de93 100644 (file)
@@ -1,2 +1,2 @@
 require_extension('M');
-WRITE_RD(sext_xlen(RS1 * RS2));
+WRITE_RD(sext_xlen(rv_mul(RS1, RS2)));
index 051382a96dec4f6489c7eb02a125567a9a992606..737b9cb657d89b7df58dde6e4b7441c919e336e5 100644 (file)
@@ -2,4 +2,4 @@ require_extension('M');
 if (xlen == 64)
   WRITE_RD(mulh(RS1, RS2));
 else
-  WRITE_RD(sext32((sext32(RS1) * sext32(RS2)) >> 32));
+  WRITE_RD(sext32((rv_mul(sext32(RS1), sext32(RS2))) >> 32));
index c53f90b00118c77326e778d9d0ff4b765bfb2527..6890799e49af90465cd308dedd6993f1df613458 100644 (file)
@@ -2,4 +2,4 @@ require_extension('M');
 if (xlen == 64)
   WRITE_RD(mulhsu(RS1, RS2));
 else
-  WRITE_RD(sext32((sext32(RS1) * reg_t((uint32_t)RS2)) >> 32));
+  WRITE_RD(sext32((rv_mul(sext32(RS1), reg_t((uint32_t)RS2))) >> 32));
index 1ae365080c6c5955f25c406dc2c7e0b76c223770..a9527b27ba559d8d89ed4f25d9b1f6bb02046126 100644 (file)
@@ -2,4 +2,5 @@ require_extension('M');
 if (xlen == 64)
   WRITE_RD(mulhu(RS1, RS2));
 else
-  WRITE_RD(sext32(((uint64_t)(uint32_t)RS1 * (uint64_t)(uint32_t)RS2) >> 32));
+  WRITE_RD(sext32((rv_mul((uint64_t)(uint32_t)RS1,
+                          (uint64_t)(uint32_t)RS2)) >> 32));
index 603defe81506ba1736c523453fa042645a190112..e5be643b476defb3054763b95120af8dd2c53a7e 100644 (file)
@@ -237,3 +237,8 @@ reg_t sv_proc_t::rv_div(reg_t lhs, reg_t rhs)
     return lhs / rhs;
 }
 
+reg_t sv_proc_t::rv_mul(reg_t lhs, reg_t rhs)
+{
+    return lhs * rhs;
+}
+
index 6a029bb9ead8261a2cbd67e8bf8231a746d84ebb..7112dd59ebbcc88058dd765f095b39c09c4c55d1 100644 (file)
@@ -98,6 +98,7 @@ public:
     reg_t rv_sub(reg_t lhs, reg_t rhs);
     reg_t rv_div(reg_t lhs, reg_t rhs);
     sreg_t rv_div(sreg_t lhs, sreg_t rhs);
+    reg_t rv_mul(reg_t lhs, reg_t rhs);
 
 #include "sv_insn_decl.h"
 };