add shiftright
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 14 Oct 2018 05:06:43 +0000 (06:06 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 14 Oct 2018 05:06:43 +0000 (06:06 +0100)
riscv/insns/sra.h
riscv/insns/srai.h
riscv/insns/sraiw.h
riscv/insns/sraw.h
riscv/insns/srl.h
riscv/insns/srli.h
riscv/insns/srliw.h
riscv/insns/srlw.h
riscv/sv_insn_redirect.cc
riscv/sv_insn_redirect.h

index 403b9b733a5e3cce36c7885e906a80f4dace1309..f3b4df2ccb1d90431e6c486e69256f599a599f79 100644 (file)
@@ -1 +1 @@
-WRITE_RD(sext_xlen(sext_xlen(RS1) >> (RS2 & (xlen-1))));
+WRITE_RD(sext_xlen(rv_sr(sext_xlen(RS1), (RS2 & (xlen-1)))));
index 7ae1d4e5af36affad7c319225e89508b8bbce504..f089b5b106e24fc373f8ed1f4a57e39a12884d17 100644 (file)
@@ -1,2 +1,2 @@
 require(SHAMT < xlen);
-WRITE_RD(sext_xlen(sext_xlen(RS1) >> SHAMT));
+WRITE_RD(sext_xlen(rv_sr(sext_xlen(RS1), SHAMT)));
index b344459bf423c61a8e04e823ba5052a79e482102..ac9832b4631432bbaa85a88f9fa0382c2926d2fe 100644 (file)
@@ -1,2 +1,2 @@
 require_rv64;
-WRITE_RD(sext32(int32_t(RS1) >> SHAMT));
+WRITE_RD(sext32(rv_sr(int32_t(RS1), SHAMT)));
index ca9c0c76ce8e855cb6fd2cdec9087c84b8b26daf..b197770083a08a78d9884634a6662b0146996ffd 100644 (file)
@@ -1,2 +1,2 @@
 require_rv64;
-WRITE_RD(sext32(int32_t(RS1) >> (RS2 & 0x1F)));
+WRITE_RD(sext32(rv_sr(int32_t(RS1), (RS2 & 0x1F))));
index 0dabe9ecde160c95c58e72248cd78b22918d5d3d..c6f92acbd41f7aa975e3b45e7e5d97575b935320 100644 (file)
@@ -1 +1 @@
-WRITE_RD(sext_xlen(zext_xlen(RS1) >> (RS2 & (xlen-1))));
+WRITE_RD(sext_xlen(rv_sr(zext_xlen(RS1), (RS2 & (xlen-1)))));
index ea0b40d6549b5f1f9ea51b1d8d5988e514ac0ef4..fa4d441c0b692eb3843f855ada5363601314b044 100644 (file)
@@ -1,2 +1,2 @@
 require(SHAMT < xlen);
-WRITE_RD(sext_xlen(zext_xlen(RS1) >> SHAMT));
+WRITE_RD(sext_xlen(rv_sr(zext_xlen(RS1), SHAMT)));
index c657d3da8bbeb078318900619b4eda189086ed1a..d2850e47eb1a03fbde51f05aeb394adbcd0b9564 100644 (file)
@@ -1,2 +1,2 @@
 require_rv64;
-WRITE_RD(sext32((uint32_t)RS1 >> SHAMT));
+WRITE_RD(sext32(rv_sr((uint32_t)RS1, SHAMT)));
index a8eb4519859382c5b0b3a9f93bb34a48b1edceef..45a249471ea1ad954d95aa48c0a24683785269ee 100644 (file)
@@ -1,2 +1,2 @@
 require_rv64;
-WRITE_RD(sext32((uint32_t)RS1 >> (RS2 & 0x1F)));
+WRITE_RD(sext32(rv_sr((uint32_t)RS1, (RS2 & 0x1F))));
index 0cba560499ee10951204a71301368a85ddf1cb3d..30619ddcec8807f5adb0085d6ba3e37b0a441ec5 100644 (file)
@@ -272,6 +272,11 @@ reg_t sv_proc_t::rv_sl(reg_t lhs, reg_t rhs)
     return lhs << rhs;
 }
 
+reg_t sv_proc_t::rv_sr(reg_t lhs, reg_t rhs)
+{
+    return lhs >> rhs;
+}
+
 reg_t sv_proc_t::rv_lt(reg_t lhs, reg_t rhs)
 {
     return lhs < rhs;
index b32d96f94e2617af6b393acfa0c1eb3d45ea3789..81a7ee93e9520f0f90ef85a29412213a7865d276 100644 (file)
@@ -105,6 +105,7 @@ public:
     reg_t rv_or(reg_t lhs, reg_t rhs);
     reg_t rv_xor(reg_t lhs, reg_t rhs);
     reg_t rv_sl(reg_t lhs, reg_t rhs);
+    reg_t rv_sr(reg_t lhs, reg_t rhs);
     reg_t rv_lt(reg_t lhs, reg_t rhs);
     sreg_t rv_lt(sreg_t lhs, sreg_t rhs);