Jerin Joy has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/58632 )

 (

3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
 )Change subject: arch-riscv: Added the Zbs bitmanip instructions
......................................................................

arch-riscv: Added the Zbs bitmanip instructions

Added the bclr, bclri, bext, bexti, binv, binvi, bset, bseti
instructions.

Changes based on spec:
https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0.pdf

Change-Id: I126d659d973b250b642bd56b3b149f0ee6a3323e
Signed-off-by: Jerin Joy <j...@rivosinc.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/58632
Reviewed-by: Luming Wang <wlm199...@126.com>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
---
M src/arch/riscv/isa/decoder.isa
1 file changed, 58 insertions(+), 3 deletions(-)

Approvals:
Jason Lowe-Power: Looks good to me, but someone else must approve; Looks good to me, approved
  Luming Wang: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/arch/riscv/isa/decoder.isa b/src/arch/riscv/isa/decoder.isa
index bc3368f..cb46ec5 100644
--- a/src/arch/riscv/isa/decoder.isa
+++ b/src/arch/riscv/isa/decoder.isa
@@ -432,9 +432,23 @@

         0x04: decode FUNCT3 {
             0x1: decode FS3 {
-                0x00: IOp::slli({{
-                    Rd = Rs1 << imm;
-                }}, imm_type = uint64_t, imm_code = {{ imm = SHAMT6; }});
+                format IOp {
+                    0x00: slli({{
+                        Rd = Rs1 << imm;
+ }}, imm_type = uint64_t, imm_code = {{ imm = SHAMT6; }});
+                    0x05: bseti({{
+                        uint64_t index = imm & (64 - 1);
+                        Rd = Rs1 | (UINT64_C(1) << index);
+ }}, imm_type = uint64_t, imm_code = {{ imm = SHAMT6; }});
+                    0x09: bclri({{
+                        uint64_t index = imm & (64 - 1);
+                        Rd = Rs1 & (~(UINT64_C(1) << index));
+ }}, imm_type = uint64_t, imm_code = {{ imm = SHAMT6; }});
+                    0x0d: binvi({{
+                        uint64_t index = imm & (64 - 1);
+                        Rd = Rs1 ^ (UINT64_C(1) << index);
+ }}, imm_type = uint64_t, imm_code = {{ imm = SHAMT6; }});
+                }
                 format ROp {
                     0x0c: decode RS2 {
                         0x00: clz({{
@@ -487,6 +501,10 @@
                     0x8: srai({{
                         Rd_sd = Rs1_sd >> imm;
}}, imm_type = uint64_t, imm_code = {{ imm = SHAMT6; }});
+                    0x9: bexti({{
+                        uint64_t index = imm & (64 - 1);
+                        Rd = (Rs1 >> index) & 0x1;
+ }}, imm_type = uint64_t, imm_code = {{ imm = SHAMT6; }});
                     0xc: rori({{
Rd = (Rs1 >> imm) | (Rs1 << ((64 - imm) & (64 - 1))); }}, imm_type = uint64_t, imm_code = {{ imm = SHAMT6; }});
@@ -784,10 +802,22 @@
                             }
                         }
                     }});
+                    0x14: bset({{
+                        Rs2 &= (64 - 1);
+                        Rd = Rs1 | (UINT64_C(1) << Rs2);
+                    }});
+                    0x24: bclr({{
+                        Rs2 &= (64 - 1);
+                        Rd = Rs1 & (~(UINT64_C(1) << Rs2));
+                    }});
                     0x30: rol({{
                         int shamt = Rs2 & (64 - 1);
Rd = (Rs1 << shamt) | (Rs1 >> ((64 - shamt) & (64 - 1)));
                     }});
+                    0x34: binv({{
+                        Rs2 &= (64 - 1);
+                        Rd = Rs1 ^ (UINT64_C(1) << Rs2);
+                    }});
                 }
                 0x2: decode FUNCT7 {
                     0x0: slt({{
@@ -895,6 +925,10 @@
                     0x5: minu({{
                         Rd = Rs1 < Rs2 ? Rs1 : Rs2;
                     }});
+                    0x24: bext({{
+                        Rs2 &= (64 - 1);
+                        Rd = (Rs1 >> Rs2) & 0x1;
+                    }});
                     0x30: ror({{
                         int shamt = Rs2 & (64 - 1);
Rd = (Rs1 >> shamt) | (Rs1 << ((64 - shamt) & (64 - 1)));

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/58632
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I126d659d973b250b642bd56b3b149f0ee6a3323e
Gerrit-Change-Number: 58632
Gerrit-PatchSet: 5
Gerrit-Owner: Jerin Joy <j...@rivosinc.com>
Gerrit-Reviewer: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Jerin Joy <j...@rivosinc.com>
Gerrit-Reviewer: Luming Wang <wlm199...@126.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to