From b59a9219ce4468151a21b3267e54af7533c4e9ef Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 14 Oct 2018 05:24:18 +0100 Subject: [PATCH] redirect subtract through rv_sub --- riscv/insns/sub.h | 2 +- riscv/insns/subw.h | 2 +- riscv/sv_insn_redirect.cc | 5 +++++ riscv/sv_insn_redirect.h | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/riscv/insns/sub.h b/riscv/insns/sub.h index 9ed48f7..ac1a2ff 100644 --- a/riscv/insns/sub.h +++ b/riscv/insns/sub.h @@ -1 +1 @@ -WRITE_RD(sext_xlen(RS1 - RS2)); +WRITE_RD(sext_xlen(rv_sub(RS1, RS2))); diff --git a/riscv/insns/subw.h b/riscv/insns/subw.h index b4168ef..a17092b 100644 --- a/riscv/insns/subw.h +++ b/riscv/insns/subw.h @@ -1,3 +1,3 @@ require_rv64; -WRITE_RD(sext32(RS1 - RS2)); +WRITE_RD(sext32(rv_sub(RS1, RS2))); diff --git a/riscv/sv_insn_redirect.cc b/riscv/sv_insn_redirect.cc index 519248e..f883a7b 100644 --- a/riscv/sv_insn_redirect.cc +++ b/riscv/sv_insn_redirect.cc @@ -222,3 +222,8 @@ reg_t sv_proc_t::rv_add(reg_t lhs, reg_t rhs) return lhs + rhs; } +reg_t sv_proc_t::rv_sub(reg_t lhs, reg_t rhs) +{ + return lhs - rhs; +} + diff --git a/riscv/sv_insn_redirect.h b/riscv/sv_insn_redirect.h index aef52ee..05faf61 100644 --- a/riscv/sv_insn_redirect.h +++ b/riscv/sv_insn_redirect.h @@ -95,6 +95,7 @@ public: reg_t (zext32)(reg_t v); reg_t rv_add(reg_t lhs, reg_t rhs); + reg_t rv_sub(reg_t lhs, reg_t rhs); #include "sv_insn_decl.h" }; -- 2.30.2