summaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNelson Chu <nelson.chu@sifive.com>2021-07-22 13:47:07 +0800
committerNelson Chu <nelson.chu@sifive.com>2021-12-16 16:04:53 +0800
commit23ff54c27d535727c1c467abdd4bed8fbd46d4a6 (patch)
treeda2e9d4b80b472a0fc4d8c1829859f30d2f720b1 /gas
parent7d554943ba2f60d7562a7f7360b683885313dec8 (diff)
RISC-V: Support svinval extension with frozen version 1.0.
According to the privileged spec, there are five new instructions for svinval extension. Two of them (HINVAL.VVMA and HINVAL.GVMA) need to enable the hypervisor extension. But there is no implementation of hypervisor extension in mainline for now, so let's consider the related issues later. 31..25 24..20 19..15 14..12 11...7 6..2 1..0 sinval.vma 0001011 rs2 rs1 000 00000 11100 11 sfence.w.inval 0001100 00000 00000 000 00000 11100 11 sfence.inval.ir 0001100 00001 00000 000 00000 11100 11 hinval.vvma 0010011 rs2 rs1 000 00000 11100 11 hinval.gvma 0110011 rs2 rs1 000 00000 11100 11 This patch is cherry-picked from the riscv integration branch since the svinval extension is frozen for now. Besides, we fix the funct7 encodings of hinval.vvma and hinval.gvma, from 0x0011011 and 0x0111011 to 0x0010011 and 0x0110011. bfd/ * elfxx-riscv.c (riscv_supported_std_s_ext): Added svinval. (riscv_multi_subset_supports): Handle INSN_CLASS_SVINVAL. gas/ * testsuite/gas/riscv/svinval.d: New testcase. * testsuite/gas/riscv/svinval.s: Likewise. include/ * opcode/riscv-opc.h: Added encodings for svinval. * opcode/riscv.h (enum riscv_insn_class): Added INSN_CLASS_SVINVAL. opcodes/ * riscv-opc.c (riscv_opcodes): Added svinval instructions.
Diffstat (limited to 'gas')
-rw-r--r--gas/testsuite/gas/riscv/svinval.d15
-rw-r--r--gas/testsuite/gas/riscv/svinval.s5
2 files changed, 20 insertions, 0 deletions
diff --git a/gas/testsuite/gas/riscv/svinval.d b/gas/testsuite/gas/riscv/svinval.d
new file mode 100644
index 0000000000..e159f16d59
--- /dev/null
+++ b/gas/testsuite/gas/riscv/svinval.d
@@ -0,0 +1,15 @@
+#as: -march=rv32i_svinval
+#source: svinval.s
+#objdump: -d
+
+.*:[ ]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <.text>:
+[ ]+0:[ ]+16b50073[ ]+sinval.vma[ ]+a0,a1
+[ ]+4:[ ]+18000073[ ]+sfence.w.inval
+[ ]+8:[ ]+18100073[ ]+sfence.inval.ir
+[ ]+c:[ ]+26b50073[ ]+hinval.vvma[ ]+a0,a1
+[ ]+10:[ ]+66b50073[ ]+hinval.gvma[ ]+a0,a1
diff --git a/gas/testsuite/gas/riscv/svinval.s b/gas/testsuite/gas/riscv/svinval.s
new file mode 100644
index 0000000000..629d5ef51b
--- /dev/null
+++ b/gas/testsuite/gas/riscv/svinval.s
@@ -0,0 +1,5 @@
+ sinval.vma a0, a1
+ sfence.w.inval
+ sfence.inval.ir
+ hinval.vvma a0, a1
+ hinval.gvma a0, a1