Skip to content

Commit

Permalink
Remove Xbitmanip from instructions that belong to multiple extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
aswaterman committed Jun 17, 2023
1 parent d015c14 commit 8c0bf05
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 30 deletions.
2 changes: 1 addition & 1 deletion riscv/insns/cmix.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
require_either_extension(EXT_ZBPBO, EXT_XZBT);
require_extension(EXT_ZBPBO);
WRITE_RD((RS1 & RS2) | (RS3 & ~RS2));
3 changes: 2 additions & 1 deletion riscv/insns/fsr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require_either_extension(xlen == 32 ? EXT_ZBPBO : EXT_XZBT, EXT_XZBT);
require_rv32;
require_extension(EXT_ZBPBO);
int shamt = RS2 & (2*xlen-1);
reg_t a = RS1, b = RS3;
if (shamt >= xlen) {
Expand Down
3 changes: 2 additions & 1 deletion riscv/insns/fsri.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require_either_extension(xlen == 32 ? EXT_ZBPBO : EXT_XZBT, EXT_XZBT);
require_rv32;
require_extension(EXT_ZBPBO);
int shamt = SHAMT & (2*xlen-1);
reg_t a = RS1, b = RS3;
if (shamt >= xlen) {
Expand Down
2 changes: 1 addition & 1 deletion riscv/insns/fsrw.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require_rv64;
require_either_extension(EXT_ZBPBO, EXT_XZBT);
require_extension(EXT_ZBPBO);
int shamt = RS2 & 63;
reg_t a = RS1, b = RS3;
if (shamt >= 32) {
Expand Down
3 changes: 1 addition & 2 deletions riscv/insns/gorci.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Zbb contains orc.b but not general gorci
require(((SHAMT == 7) && p->extension_enabled(EXT_ZBB))
|| p->extension_enabled(EXT_XZBP));
require(((SHAMT == 7) && p->extension_enabled(EXT_ZBB)));
require(SHAMT < xlen);
reg_t x = RS1;
int shamt = SHAMT;
Expand Down
3 changes: 1 addition & 2 deletions riscv/insns/grevi.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ int shamt = SHAMT;
require(((shamt == xlen - 8) && (p->extension_enabled(EXT_ZBB) || p->extension_enabled(EXT_ZBKB))) //rev8
|| ((shamt == 7) && p->extension_enabled(EXT_ZBKB)) // rev8.b
|| ((shamt == 8) && p->extension_enabled(EXT_ZPN)) // rev8.h
|| ((shamt == xlen - 1) && p->extension_enabled(EXT_ZPN)) // rev
|| p->extension_enabled(EXT_XZBP));
|| ((shamt == xlen - 1) && p->extension_enabled(EXT_ZPN)));
require(shamt < xlen);
reg_t x = RS1;
if (shamt & 1) x = ((x & 0x5555555555555555LL) << 1) | ((x & 0xAAAAAAAAAAAAAAAALL) >> 1);
Expand Down
6 changes: 1 addition & 5 deletions riscv/insns/pack.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// RV32Zbb contains zext.h but not general pack
require(((xlen == 32) && (insn.rs2() == 0) && p->extension_enabled(EXT_ZBB))
|| p->extension_enabled(EXT_ZPN)
|| p->extension_enabled(EXT_ZBKB)
|| p->extension_enabled(EXT_XZBP)
|| p->extension_enabled(EXT_XZBE)
|| p->extension_enabled(EXT_XZBF)
|| ((xlen == 64) && p->extension_enabled(EXT_XZBM)));
|| p->extension_enabled(EXT_ZBKB));
reg_t lo = zext_xlen(RS1 << (xlen/2)) >> (xlen/2);
reg_t hi = zext_xlen(RS2 << (xlen/2));
WRITE_RD(sext_xlen(lo | hi));
5 changes: 1 addition & 4 deletions riscv/insns/packh.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
require(p->extension_enabled(EXT_ZBKB) ||
p->extension_enabled(EXT_XZBP) ||
p->extension_enabled(EXT_XZBE) ||
p->extension_enabled(EXT_XZBF));
require_extension(EXT_ZBKB);
reg_t lo = zext_xlen(RS1 << (xlen-8)) >> (xlen-8);
reg_t hi = zext_xlen(RS2 << (xlen-8)) >> (xlen-16);
WRITE_RD(sext_xlen(lo | hi));
4 changes: 1 addition & 3 deletions riscv/insns/packu.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
require(p->extension_enabled(EXT_ZPN) ||
p->extension_enabled(EXT_XZBP) ||
((xlen == 64) && p->extension_enabled(EXT_XZBM)));
require_extension(EXT_ZPN);
reg_t lo = zext_xlen(RS1) >> (xlen/2);
reg_t hi = zext_xlen(RS2) >> (xlen/2) << (xlen/2);
WRITE_RD(sext_xlen(lo | hi));
5 changes: 1 addition & 4 deletions riscv/insns/packw.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// RV64Zbb contains zext.h but not general packw
require(((insn.rs2() == 0) && p->extension_enabled(EXT_ZBB))
|| p->extension_enabled(EXT_ZBKB)
|| p->extension_enabled(EXT_XZBP)
|| p->extension_enabled(EXT_XZBE)
|| p->extension_enabled(EXT_XZBF));
|| p->extension_enabled(EXT_ZBKB));
require_rv64;
reg_t lo = zext32(RS1 << 16) >> 16;
reg_t hi = zext32(RS2 << 16);
Expand Down
3 changes: 1 addition & 2 deletions riscv/insns/shfli.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Zbkb contains zip but not general shfli
require(((insn.rs2() == (xlen / 2 - 1)) && p->extension_enabled(EXT_ZBKB))
|| p->extension_enabled(EXT_XZBP));
require(((insn.rs2() == (xlen / 2 - 1)) && p->extension_enabled(EXT_ZBKB)));
require(SHAMT < (xlen/2));
reg_t x = RS1;
int shamt = SHAMT & ((xlen-1) >> 1);
Expand Down
3 changes: 1 addition & 2 deletions riscv/insns/unshfli.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Zbkb contains unzip but not general unshfli
require(((insn.rs2() == (xlen / 2 - 1)) && p->extension_enabled(EXT_ZBKB))
|| p->extension_enabled(EXT_XZBP));
require(((insn.rs2() == (xlen / 2 - 1)) && p->extension_enabled(EXT_ZBKB)));
require(SHAMT < (xlen/2));
reg_t x = RS1;
int shamt = SHAMT & ((xlen-1) >> 1);
Expand Down
2 changes: 1 addition & 1 deletion riscv/insns/xperm4.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
require_either_extension(EXT_ZBKX, EXT_XZBP);
require_extension(EXT_ZBKX);
WRITE_RD(sext_xlen(xperm(RS1, RS2, 2, xlen)));
2 changes: 1 addition & 1 deletion riscv/insns/xperm8.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
require_either_extension(EXT_ZBKX, EXT_XZBP);
require_extension(EXT_ZBKX);
WRITE_RD(sext_xlen(xperm(RS1, RS2, 3, xlen)));

0 comments on commit 8c0bf05

Please sign in to comment.