xref: /openbmc/qemu/target/riscv/insn32.decode (revision b14df228)
1#
2# RISC-V translation routines for the RVXI Base Integer Instruction Set.
3#
4# Copyright (c) 2018 Peer Adelt, peer.adelt@hni.uni-paderborn.de
5#                    Bastian Koppelmann, kbastian@mail.uni-paderborn.de
6#
7# This program is free software; you can redistribute it and/or modify it
8# under the terms and conditions of the GNU General Public License,
9# version 2 or later, as published by the Free Software Foundation.
10#
11# This program is distributed in the hope it will be useful, but WITHOUT
12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14# more details.
15#
16# You should have received a copy of the GNU General Public License along with
17# this program.  If not, see <http://www.gnu.org/licenses/>.
18
19# Fields:
20%rs3       27:5
21%rs2       20:5
22%rs1       15:5
23%rd        7:5
24%sh5       20:5
25%sh6       20:6
26
27%sh7    20:7
28%csr    20:12
29%rm     12:3
30%nf     29:3                     !function=ex_plus_1
31
32# immediates:
33%imm_i    20:s12
34%imm_s    25:s7 7:5
35%imm_b    31:s1 7:1 25:6 8:4     !function=ex_shift_1
36%imm_j    31:s1 12:8 20:1 21:10  !function=ex_shift_1
37%imm_u    12:s20                 !function=ex_shift_12
38%imm_bs   30:2                   !function=ex_shift_3
39%imm_rnum 20:4
40
41# Argument sets:
42&empty
43&b    imm rs2 rs1
44&i    imm rs1 rd
45&j    imm rd
46&r    rd rs1 rs2
47&r2   rd rs1
48&r2_s rs1 rs2
49&s    imm rs1 rs2
50&u    imm rd
51&shift     shamt rs1 rd
52&atomic    aq rl rs2 rs1 rd
53&rmrr      vm rd rs1 rs2
54&rmr       vm rd rs2
55&r2nfvm    vm rd rs1 nf
56&rnfvm     vm rd rs1 rs2 nf
57&k_aes     shamt rs2 rs1 rd
58
59# Formats 32:
60@r       .......   ..... ..... ... ..... ....... &r                %rs2 %rs1 %rd
61@i       ............    ..... ... ..... ....... &i      imm=%imm_i     %rs1 %rd
62@b       .......   ..... ..... ... ..... ....... &b      imm=%imm_b %rs2 %rs1
63@s       .......   ..... ..... ... ..... ....... &s      imm=%imm_s %rs2 %rs1
64@u       ....................      ..... ....... &u      imm=%imm_u          %rd
65@j       ....................      ..... ....... &j      imm=%imm_j          %rd
66
67@sh      ......  ...... .....  ... ..... ....... &shift  shamt=%sh7     %rs1 %rd
68@csr     ............   .....  ... ..... .......               %csr     %rs1 %rd
69
70@atom_ld ..... aq:1 rl:1 ..... ........ ..... ....... &atomic rs2=0     %rs1 %rd
71@atom_st ..... aq:1 rl:1 ..... ........ ..... ....... &atomic %rs2      %rs1 %rd
72
73@r4_rm   ..... ..  ..... ..... ... ..... ....... %rs3 %rs2 %rs1 %rm %rd
74@r_rm    .......   ..... ..... ... ..... ....... %rs2 %rs1 %rm %rd
75@r2_rm   .......   ..... ..... ... ..... ....... %rs1 %rm %rd
76@r2      .......   ..... ..... ... ..... ....... &r2 %rs1 %rd
77@r2_nfvm ... ... vm:1 ..... ..... ... ..... ....... &r2nfvm %nf %rs1 %rd
78@r2_vm   ...... vm:1 ..... ..... ... ..... ....... &rmr %rs2 %rd
79@r1_vm   ...... vm:1 ..... ..... ... ..... ....... %rd
80@r_nfvm  ... ... vm:1 ..... ..... ... ..... ....... &rnfvm %nf %rs2 %rs1 %rd
81@r2rd    .......   ..... ..... ... ..... ....... %rs2 %rd
82@r_vm    ...... vm:1 ..... ..... ... ..... ....... &rmrr %rs2 %rs1 %rd
83@r_vm_1  ...... . ..... ..... ... ..... .......    &rmrr vm=1 %rs2 %rs1 %rd
84@r_vm_0  ...... . ..... ..... ... ..... .......    &rmrr vm=0 %rs2 %rs1 %rd
85@r2_zimm11 . zimm:11  ..... ... ..... ....... %rs1 %rd
86@r2_zimm10 .. zimm:10  ..... ... ..... ....... %rs1 %rd
87@r2_s    .......   ..... ..... ... ..... ....... %rs2 %rs1
88
89@hfence_gvma ....... ..... .....   ... ..... ....... %rs2 %rs1
90@hfence_vvma ....... ..... .....   ... ..... ....... %rs2 %rs1
91
92@sfence_vma ....... ..... .....   ... ..... ....... %rs2 %rs1
93@sfence_vm  ....... ..... .....   ... ..... ....... %rs1
94
95@k_aes   .. ..... ..... .....  ... ..... ....... &k_aes  shamt=%imm_bs   %rs2 %rs1 %rd
96@i_aes   .. ..... ..... .....  ... ..... ....... &i      imm=%imm_rnum        %rs1 %rd
97
98# Formats 64:
99@sh5     .......  ..... .....  ... ..... ....... &shift  shamt=%sh5      %rs1 %rd
100
101# Formats 128:
102@sh6       ...... ...... ..... ... ..... ....... &shift shamt=%sh6 %rs1 %rd
103
104# *** Privileged Instructions ***
105ecall       000000000000     00000 000 00000 1110011
106ebreak      000000000001     00000 000 00000 1110011
107uret        0000000    00010 00000 000 00000 1110011
108sret        0001000    00010 00000 000 00000 1110011
109mret        0011000    00010 00000 000 00000 1110011
110wfi         0001000    00101 00000 000 00000 1110011
111sfence_vma  0001001    ..... ..... 000 00000 1110011 @sfence_vma
112sfence_vm   0001000    00100 ..... 000 00000 1110011 @sfence_vm
113
114# *** RV32I Base Instruction Set ***
115lui      ....................       ..... 0110111 @u
116auipc    ....................       ..... 0010111 @u
117jal      ....................       ..... 1101111 @j
118jalr     ............     ..... 000 ..... 1100111 @i
119beq      ....... .....    ..... 000 ..... 1100011 @b
120bne      ....... .....    ..... 001 ..... 1100011 @b
121blt      ....... .....    ..... 100 ..... 1100011 @b
122bge      ....... .....    ..... 101 ..... 1100011 @b
123bltu     ....... .....    ..... 110 ..... 1100011 @b
124bgeu     ....... .....    ..... 111 ..... 1100011 @b
125lb       ............     ..... 000 ..... 0000011 @i
126lh       ............     ..... 001 ..... 0000011 @i
127lw       ............     ..... 010 ..... 0000011 @i
128lbu      ............     ..... 100 ..... 0000011 @i
129lhu      ............     ..... 101 ..... 0000011 @i
130sb       .......  .....   ..... 000 ..... 0100011 @s
131sh       .......  .....   ..... 001 ..... 0100011 @s
132sw       .......  .....   ..... 010 ..... 0100011 @s
133addi     ............     ..... 000 ..... 0010011 @i
134slti     ............     ..... 010 ..... 0010011 @i
135sltiu    ............     ..... 011 ..... 0010011 @i
136xori     ............     ..... 100 ..... 0010011 @i
137ori      ............     ..... 110 ..... 0010011 @i
138andi     ............     ..... 111 ..... 0010011 @i
139slli     00000. ......    ..... 001 ..... 0010011 @sh
140srli     00000. ......    ..... 101 ..... 0010011 @sh
141srai     01000. ......    ..... 101 ..... 0010011 @sh
142add      0000000 .....    ..... 000 ..... 0110011 @r
143sub      0100000 .....    ..... 000 ..... 0110011 @r
144sll      0000000 .....    ..... 001 ..... 0110011 @r
145slt      0000000 .....    ..... 010 ..... 0110011 @r
146sltu     0000000 .....    ..... 011 ..... 0110011 @r
147xor      0000000 .....    ..... 100 ..... 0110011 @r
148srl      0000000 .....    ..... 101 ..... 0110011 @r
149sra      0100000 .....    ..... 101 ..... 0110011 @r
150or       0000000 .....    ..... 110 ..... 0110011 @r
151and      0000000 .....    ..... 111 ..... 0110011 @r
152fence    ---- pred:4 succ:4 ----- 000 ----- 0001111
153fence_i  ---- ----   ----   ----- 001 ----- 0001111
154csrrw    ............     ..... 001 ..... 1110011 @csr
155csrrs    ............     ..... 010 ..... 1110011 @csr
156csrrc    ............     ..... 011 ..... 1110011 @csr
157csrrwi   ............     ..... 101 ..... 1110011 @csr
158csrrsi   ............     ..... 110 ..... 1110011 @csr
159csrrci   ............     ..... 111 ..... 1110011 @csr
160
161# *** RV64I Base Instruction Set (in addition to RV32I) ***
162lwu      ............   ..... 110 ..... 0000011 @i
163ld       ............   ..... 011 ..... 0000011 @i
164sd       ....... .....  ..... 011 ..... 0100011 @s
165addiw    ............   ..... 000 ..... 0011011 @i
166slliw    0000000 .....  ..... 001 ..... 0011011 @sh5
167srliw    0000000 .....  ..... 101 ..... 0011011 @sh5
168sraiw    0100000 .....  ..... 101 ..... 0011011 @sh5
169addw     0000000 .....  ..... 000 ..... 0111011 @r
170subw     0100000 .....  ..... 000 ..... 0111011 @r
171sllw     0000000 .....  ..... 001 ..... 0111011 @r
172srlw     0000000 .....  ..... 101 ..... 0111011 @r
173sraw     0100000 .....  ..... 101 ..... 0111011 @r
174
175# *** RV128I Base Instruction Set (in addition to RV64I) ***
176ldu      ............   ..... 111 ..... 0000011 @i
177lq       ............   ..... 010 ..... 0001111 @i
178sq       ............   ..... 100 ..... 0100011 @s
179addid    ............  .....  000 ..... 1011011 @i
180sllid    000000 ......  ..... 001 ..... 1011011 @sh6
181srlid    000000 ......  ..... 101 ..... 1011011 @sh6
182sraid    010000 ......  ..... 101 ..... 1011011 @sh6
183addd     0000000 ..... .....  000 ..... 1111011 @r
184subd     0100000 ..... .....  000 ..... 1111011 @r
185slld     0000000 ..... .....  001 ..... 1111011 @r
186srld     0000000 ..... .....  101 ..... 1111011 @r
187srad     0100000 ..... .....  101 ..... 1111011 @r
188
189# *** RV32M Standard Extension ***
190mul      0000001 .....  ..... 000 ..... 0110011 @r
191mulh     0000001 .....  ..... 001 ..... 0110011 @r
192mulhsu   0000001 .....  ..... 010 ..... 0110011 @r
193mulhu    0000001 .....  ..... 011 ..... 0110011 @r
194div      0000001 .....  ..... 100 ..... 0110011 @r
195divu     0000001 .....  ..... 101 ..... 0110011 @r
196rem      0000001 .....  ..... 110 ..... 0110011 @r
197remu     0000001 .....  ..... 111 ..... 0110011 @r
198
199# *** RV64M Standard Extension (in addition to RV32M) ***
200mulw     0000001 .....  ..... 000 ..... 0111011 @r
201divw     0000001 .....  ..... 100 ..... 0111011 @r
202divuw    0000001 .....  ..... 101 ..... 0111011 @r
203remw     0000001 .....  ..... 110 ..... 0111011 @r
204remuw    0000001 .....  ..... 111 ..... 0111011 @r
205
206# *** RV128M Standard Extension (in addition to RV64M) ***
207muld     0000001 .....  ..... 000 ..... 1111011 @r
208divd     0000001 .....  ..... 100 ..... 1111011 @r
209divud    0000001 .....  ..... 101 ..... 1111011 @r
210remd     0000001 .....  ..... 110 ..... 1111011 @r
211remud    0000001 .....  ..... 111 ..... 1111011 @r
212
213# *** RV32A Standard Extension ***
214lr_w       00010 . . 00000 ..... 010 ..... 0101111 @atom_ld
215sc_w       00011 . . ..... ..... 010 ..... 0101111 @atom_st
216amoswap_w  00001 . . ..... ..... 010 ..... 0101111 @atom_st
217amoadd_w   00000 . . ..... ..... 010 ..... 0101111 @atom_st
218amoxor_w   00100 . . ..... ..... 010 ..... 0101111 @atom_st
219amoand_w   01100 . . ..... ..... 010 ..... 0101111 @atom_st
220amoor_w    01000 . . ..... ..... 010 ..... 0101111 @atom_st
221amomin_w   10000 . . ..... ..... 010 ..... 0101111 @atom_st
222amomax_w   10100 . . ..... ..... 010 ..... 0101111 @atom_st
223amominu_w  11000 . . ..... ..... 010 ..... 0101111 @atom_st
224amomaxu_w  11100 . . ..... ..... 010 ..... 0101111 @atom_st
225
226# *** RV64A Standard Extension (in addition to RV32A) ***
227lr_d       00010 . . 00000 ..... 011 ..... 0101111 @atom_ld
228sc_d       00011 . . ..... ..... 011 ..... 0101111 @atom_st
229amoswap_d  00001 . . ..... ..... 011 ..... 0101111 @atom_st
230amoadd_d   00000 . . ..... ..... 011 ..... 0101111 @atom_st
231amoxor_d   00100 . . ..... ..... 011 ..... 0101111 @atom_st
232amoand_d   01100 . . ..... ..... 011 ..... 0101111 @atom_st
233amoor_d    01000 . . ..... ..... 011 ..... 0101111 @atom_st
234amomin_d   10000 . . ..... ..... 011 ..... 0101111 @atom_st
235amomax_d   10100 . . ..... ..... 011 ..... 0101111 @atom_st
236amominu_d  11000 . . ..... ..... 011 ..... 0101111 @atom_st
237amomaxu_d  11100 . . ..... ..... 011 ..... 0101111 @atom_st
238
239# *** RV32F Standard Extension ***
240flw        ............   ..... 010 ..... 0000111 @i
241fsw        .......  ..... ..... 010 ..... 0100111 @s
242fmadd_s    ..... 00 ..... ..... ... ..... 1000011 @r4_rm
243fmsub_s    ..... 00 ..... ..... ... ..... 1000111 @r4_rm
244fnmsub_s   ..... 00 ..... ..... ... ..... 1001011 @r4_rm
245fnmadd_s   ..... 00 ..... ..... ... ..... 1001111 @r4_rm
246fadd_s     0000000  ..... ..... ... ..... 1010011 @r_rm
247fsub_s     0000100  ..... ..... ... ..... 1010011 @r_rm
248fmul_s     0001000  ..... ..... ... ..... 1010011 @r_rm
249fdiv_s     0001100  ..... ..... ... ..... 1010011 @r_rm
250fsqrt_s    0101100  00000 ..... ... ..... 1010011 @r2_rm
251fsgnj_s    0010000  ..... ..... 000 ..... 1010011 @r
252fsgnjn_s   0010000  ..... ..... 001 ..... 1010011 @r
253fsgnjx_s   0010000  ..... ..... 010 ..... 1010011 @r
254fmin_s     0010100  ..... ..... 000 ..... 1010011 @r
255fmax_s     0010100  ..... ..... 001 ..... 1010011 @r
256fcvt_w_s   1100000  00000 ..... ... ..... 1010011 @r2_rm
257fcvt_wu_s  1100000  00001 ..... ... ..... 1010011 @r2_rm
258fmv_x_w    1110000  00000 ..... 000 ..... 1010011 @r2
259feq_s      1010000  ..... ..... 010 ..... 1010011 @r
260flt_s      1010000  ..... ..... 001 ..... 1010011 @r
261fle_s      1010000  ..... ..... 000 ..... 1010011 @r
262fclass_s   1110000  00000 ..... 001 ..... 1010011 @r2
263fcvt_s_w   1101000  00000 ..... ... ..... 1010011 @r2_rm
264fcvt_s_wu  1101000  00001 ..... ... ..... 1010011 @r2_rm
265fmv_w_x    1111000  00000 ..... 000 ..... 1010011 @r2
266
267# *** RV64F Standard Extension (in addition to RV32F) ***
268fcvt_l_s   1100000  00010 ..... ... ..... 1010011 @r2_rm
269fcvt_lu_s  1100000  00011 ..... ... ..... 1010011 @r2_rm
270fcvt_s_l   1101000  00010 ..... ... ..... 1010011 @r2_rm
271fcvt_s_lu  1101000  00011 ..... ... ..... 1010011 @r2_rm
272
273# *** RV32D Standard Extension ***
274fld        ............   ..... 011 ..... 0000111 @i
275fsd        ....... .....  ..... 011 ..... 0100111 @s
276fmadd_d    ..... 01 ..... ..... ... ..... 1000011 @r4_rm
277fmsub_d    ..... 01 ..... ..... ... ..... 1000111 @r4_rm
278fnmsub_d   ..... 01 ..... ..... ... ..... 1001011 @r4_rm
279fnmadd_d   ..... 01 ..... ..... ... ..... 1001111 @r4_rm
280fadd_d     0000001  ..... ..... ... ..... 1010011 @r_rm
281fsub_d     0000101  ..... ..... ... ..... 1010011 @r_rm
282fmul_d     0001001  ..... ..... ... ..... 1010011 @r_rm
283fdiv_d     0001101  ..... ..... ... ..... 1010011 @r_rm
284fsqrt_d    0101101  00000 ..... ... ..... 1010011 @r2_rm
285fsgnj_d    0010001  ..... ..... 000 ..... 1010011 @r
286fsgnjn_d   0010001  ..... ..... 001 ..... 1010011 @r
287fsgnjx_d   0010001  ..... ..... 010 ..... 1010011 @r
288fmin_d     0010101  ..... ..... 000 ..... 1010011 @r
289fmax_d     0010101  ..... ..... 001 ..... 1010011 @r
290fcvt_s_d   0100000  00001 ..... ... ..... 1010011 @r2_rm
291fcvt_d_s   0100001  00000 ..... ... ..... 1010011 @r2_rm
292feq_d      1010001  ..... ..... 010 ..... 1010011 @r
293flt_d      1010001  ..... ..... 001 ..... 1010011 @r
294fle_d      1010001  ..... ..... 000 ..... 1010011 @r
295fclass_d   1110001  00000 ..... 001 ..... 1010011 @r2
296fcvt_w_d   1100001  00000 ..... ... ..... 1010011 @r2_rm
297fcvt_wu_d  1100001  00001 ..... ... ..... 1010011 @r2_rm
298fcvt_d_w   1101001  00000 ..... ... ..... 1010011 @r2_rm
299fcvt_d_wu  1101001  00001 ..... ... ..... 1010011 @r2_rm
300
301# *** RV64D Standard Extension (in addition to RV32D) ***
302fcvt_l_d   1100001  00010 ..... ... ..... 1010011 @r2_rm
303fcvt_lu_d  1100001  00011 ..... ... ..... 1010011 @r2_rm
304fmv_x_d    1110001  00000 ..... 000 ..... 1010011 @r2
305fcvt_d_l   1101001  00010 ..... ... ..... 1010011 @r2_rm
306fcvt_d_lu  1101001  00011 ..... ... ..... 1010011 @r2_rm
307fmv_d_x    1111001  00000 ..... 000 ..... 1010011 @r2
308
309# *** RV32H Base Instruction Set ***
310hlv_b       0110000  00000  ..... 100 ..... 1110011 @r2
311hlv_bu      0110000  00001  ..... 100 ..... 1110011 @r2
312hlv_h       0110010  00000  ..... 100 ..... 1110011 @r2
313hlv_hu      0110010  00001  ..... 100 ..... 1110011 @r2
314hlvx_hu     0110010  00011  ..... 100 ..... 1110011 @r2
315hlv_w       0110100  00000  ..... 100 ..... 1110011 @r2
316hlvx_wu     0110100  00011  ..... 100 ..... 1110011 @r2
317hsv_b       0110001  .....  ..... 100 00000 1110011 @r2_s
318hsv_h       0110011  .....  ..... 100 00000 1110011 @r2_s
319hsv_w       0110101  .....  ..... 100 00000 1110011 @r2_s
320hfence_gvma 0110001  .....  ..... 000 00000 1110011 @hfence_gvma
321hfence_vvma 0010001  .....  ..... 000 00000 1110011 @hfence_vvma
322
323# *** RV64H Base Instruction Set ***
324hlv_wu    0110100  00001   ..... 100 ..... 1110011 @r2
325hlv_d     0110110  00000   ..... 100 ..... 1110011 @r2
326hsv_d     0110111  .....   ..... 100 00000 1110011 @r2_s
327
328# *** Vector loads and stores are encoded within LOADFP/STORE-FP ***
329# Vector unit-stride load/store insns.
330vle8_v     ... 000 . 00000 ..... 000 ..... 0000111 @r2_nfvm
331vle16_v    ... 000 . 00000 ..... 101 ..... 0000111 @r2_nfvm
332vle32_v    ... 000 . 00000 ..... 110 ..... 0000111 @r2_nfvm
333vle64_v    ... 000 . 00000 ..... 111 ..... 0000111 @r2_nfvm
334vse8_v     ... 000 . 00000 ..... 000 ..... 0100111 @r2_nfvm
335vse16_v    ... 000 . 00000 ..... 101 ..... 0100111 @r2_nfvm
336vse32_v    ... 000 . 00000 ..... 110 ..... 0100111 @r2_nfvm
337vse64_v    ... 000 . 00000 ..... 111 ..... 0100111 @r2_nfvm
338
339# Vector unit-stride mask load/store insns.
340vlm_v      000 000 1 01011 ..... 000 ..... 0000111 @r2
341vsm_v      000 000 1 01011 ..... 000 ..... 0100111 @r2
342
343# Vector strided insns.
344vlse8_v     ... 010 . ..... ..... 000 ..... 0000111 @r_nfvm
345vlse16_v    ... 010 . ..... ..... 101 ..... 0000111 @r_nfvm
346vlse32_v    ... 010 . ..... ..... 110 ..... 0000111 @r_nfvm
347vlse64_v    ... 010 . ..... ..... 111 ..... 0000111 @r_nfvm
348vsse8_v     ... 010 . ..... ..... 000 ..... 0100111 @r_nfvm
349vsse16_v    ... 010 . ..... ..... 101 ..... 0100111 @r_nfvm
350vsse32_v    ... 010 . ..... ..... 110 ..... 0100111 @r_nfvm
351vsse64_v    ... 010 . ..... ..... 111 ..... 0100111 @r_nfvm
352
353# Vector ordered-indexed and unordered-indexed load insns.
354vlxei8_v      ... 0-1 . ..... ..... 000 ..... 0000111 @r_nfvm
355vlxei16_v     ... 0-1 . ..... ..... 101 ..... 0000111 @r_nfvm
356vlxei32_v     ... 0-1 . ..... ..... 110 ..... 0000111 @r_nfvm
357vlxei64_v     ... 0-1 . ..... ..... 111 ..... 0000111 @r_nfvm
358
359# Vector ordered-indexed and unordered-indexed store insns.
360vsxei8_v      ... 0-1 . ..... ..... 000 ..... 0100111 @r_nfvm
361vsxei16_v     ... 0-1 . ..... ..... 101 ..... 0100111 @r_nfvm
362vsxei32_v     ... 0-1 . ..... ..... 110 ..... 0100111 @r_nfvm
363vsxei64_v     ... 0-1 . ..... ..... 111 ..... 0100111 @r_nfvm
364
365# Vector unit-stride fault-only-first load insns.
366vle8ff_v      ... 000 . 10000 ..... 000 ..... 0000111 @r2_nfvm
367vle16ff_v     ... 000 . 10000 ..... 101 ..... 0000111 @r2_nfvm
368vle32ff_v     ... 000 . 10000 ..... 110 ..... 0000111 @r2_nfvm
369vle64ff_v     ... 000 . 10000 ..... 111 ..... 0000111 @r2_nfvm
370
371# Vector whole register insns
372vl1re8_v      000 000 1 01000 ..... 000 ..... 0000111 @r2
373vl1re16_v     000 000 1 01000 ..... 101 ..... 0000111 @r2
374vl1re32_v     000 000 1 01000 ..... 110 ..... 0000111 @r2
375vl1re64_v     000 000 1 01000 ..... 111 ..... 0000111 @r2
376vl2re8_v      001 000 1 01000 ..... 000 ..... 0000111 @r2
377vl2re16_v     001 000 1 01000 ..... 101 ..... 0000111 @r2
378vl2re32_v     001 000 1 01000 ..... 110 ..... 0000111 @r2
379vl2re64_v     001 000 1 01000 ..... 111 ..... 0000111 @r2
380vl4re8_v      011 000 1 01000 ..... 000 ..... 0000111 @r2
381vl4re16_v     011 000 1 01000 ..... 101 ..... 0000111 @r2
382vl4re32_v     011 000 1 01000 ..... 110 ..... 0000111 @r2
383vl4re64_v     011 000 1 01000 ..... 111 ..... 0000111 @r2
384vl8re8_v      111 000 1 01000 ..... 000 ..... 0000111 @r2
385vl8re16_v     111 000 1 01000 ..... 101 ..... 0000111 @r2
386vl8re32_v     111 000 1 01000 ..... 110 ..... 0000111 @r2
387vl8re64_v     111 000 1 01000 ..... 111 ..... 0000111 @r2
388vs1r_v        000 000 1 01000 ..... 000 ..... 0100111 @r2
389vs2r_v        001 000 1 01000 ..... 000 ..... 0100111 @r2
390vs4r_v        011 000 1 01000 ..... 000 ..... 0100111 @r2
391vs8r_v        111 000 1 01000 ..... 000 ..... 0100111 @r2
392
393# *** new major opcode OP-V ***
394vadd_vv         000000 . ..... ..... 000 ..... 1010111 @r_vm
395vadd_vx         000000 . ..... ..... 100 ..... 1010111 @r_vm
396vadd_vi         000000 . ..... ..... 011 ..... 1010111 @r_vm
397vsub_vv         000010 . ..... ..... 000 ..... 1010111 @r_vm
398vsub_vx         000010 . ..... ..... 100 ..... 1010111 @r_vm
399vrsub_vx        000011 . ..... ..... 100 ..... 1010111 @r_vm
400vrsub_vi        000011 . ..... ..... 011 ..... 1010111 @r_vm
401vwaddu_vv       110000 . ..... ..... 010 ..... 1010111 @r_vm
402vwaddu_vx       110000 . ..... ..... 110 ..... 1010111 @r_vm
403vwadd_vv        110001 . ..... ..... 010 ..... 1010111 @r_vm
404vwadd_vx        110001 . ..... ..... 110 ..... 1010111 @r_vm
405vwsubu_vv       110010 . ..... ..... 010 ..... 1010111 @r_vm
406vwsubu_vx       110010 . ..... ..... 110 ..... 1010111 @r_vm
407vwsub_vv        110011 . ..... ..... 010 ..... 1010111 @r_vm
408vwsub_vx        110011 . ..... ..... 110 ..... 1010111 @r_vm
409vwaddu_wv       110100 . ..... ..... 010 ..... 1010111 @r_vm
410vwaddu_wx       110100 . ..... ..... 110 ..... 1010111 @r_vm
411vwadd_wv        110101 . ..... ..... 010 ..... 1010111 @r_vm
412vwadd_wx        110101 . ..... ..... 110 ..... 1010111 @r_vm
413vwsubu_wv       110110 . ..... ..... 010 ..... 1010111 @r_vm
414vwsubu_wx       110110 . ..... ..... 110 ..... 1010111 @r_vm
415vwsub_wv        110111 . ..... ..... 010 ..... 1010111 @r_vm
416vwsub_wx        110111 . ..... ..... 110 ..... 1010111 @r_vm
417vadc_vvm        010000 0 ..... ..... 000 ..... 1010111 @r_vm_1
418vadc_vxm        010000 0 ..... ..... 100 ..... 1010111 @r_vm_1
419vadc_vim        010000 0 ..... ..... 011 ..... 1010111 @r_vm_1
420vmadc_vvm       010001 . ..... ..... 000 ..... 1010111 @r_vm
421vmadc_vxm       010001 . ..... ..... 100 ..... 1010111 @r_vm
422vmadc_vim       010001 . ..... ..... 011 ..... 1010111 @r_vm
423vsbc_vvm        010010 0 ..... ..... 000 ..... 1010111 @r_vm_1
424vsbc_vxm        010010 0 ..... ..... 100 ..... 1010111 @r_vm_1
425vmsbc_vvm       010011 . ..... ..... 000 ..... 1010111 @r_vm
426vmsbc_vxm       010011 . ..... ..... 100 ..... 1010111 @r_vm
427vand_vv         001001 . ..... ..... 000 ..... 1010111 @r_vm
428vand_vx         001001 . ..... ..... 100 ..... 1010111 @r_vm
429vand_vi         001001 . ..... ..... 011 ..... 1010111 @r_vm
430vor_vv          001010 . ..... ..... 000 ..... 1010111 @r_vm
431vor_vx          001010 . ..... ..... 100 ..... 1010111 @r_vm
432vor_vi          001010 . ..... ..... 011 ..... 1010111 @r_vm
433vxor_vv         001011 . ..... ..... 000 ..... 1010111 @r_vm
434vxor_vx         001011 . ..... ..... 100 ..... 1010111 @r_vm
435vxor_vi         001011 . ..... ..... 011 ..... 1010111 @r_vm
436vsll_vv         100101 . ..... ..... 000 ..... 1010111 @r_vm
437vsll_vx         100101 . ..... ..... 100 ..... 1010111 @r_vm
438vsll_vi         100101 . ..... ..... 011 ..... 1010111 @r_vm
439vsrl_vv         101000 . ..... ..... 000 ..... 1010111 @r_vm
440vsrl_vx         101000 . ..... ..... 100 ..... 1010111 @r_vm
441vsrl_vi         101000 . ..... ..... 011 ..... 1010111 @r_vm
442vsra_vv         101001 . ..... ..... 000 ..... 1010111 @r_vm
443vsra_vx         101001 . ..... ..... 100 ..... 1010111 @r_vm
444vsra_vi         101001 . ..... ..... 011 ..... 1010111 @r_vm
445vnsrl_wv        101100 . ..... ..... 000 ..... 1010111 @r_vm
446vnsrl_wx        101100 . ..... ..... 100 ..... 1010111 @r_vm
447vnsrl_wi        101100 . ..... ..... 011 ..... 1010111 @r_vm
448vnsra_wv        101101 . ..... ..... 000 ..... 1010111 @r_vm
449vnsra_wx        101101 . ..... ..... 100 ..... 1010111 @r_vm
450vnsra_wi        101101 . ..... ..... 011 ..... 1010111 @r_vm
451vmseq_vv        011000 . ..... ..... 000 ..... 1010111 @r_vm
452vmseq_vx        011000 . ..... ..... 100 ..... 1010111 @r_vm
453vmseq_vi        011000 . ..... ..... 011 ..... 1010111 @r_vm
454vmsne_vv        011001 . ..... ..... 000 ..... 1010111 @r_vm
455vmsne_vx        011001 . ..... ..... 100 ..... 1010111 @r_vm
456vmsne_vi        011001 . ..... ..... 011 ..... 1010111 @r_vm
457vmsltu_vv       011010 . ..... ..... 000 ..... 1010111 @r_vm
458vmsltu_vx       011010 . ..... ..... 100 ..... 1010111 @r_vm
459vmslt_vv        011011 . ..... ..... 000 ..... 1010111 @r_vm
460vmslt_vx        011011 . ..... ..... 100 ..... 1010111 @r_vm
461vmsleu_vv       011100 . ..... ..... 000 ..... 1010111 @r_vm
462vmsleu_vx       011100 . ..... ..... 100 ..... 1010111 @r_vm
463vmsleu_vi       011100 . ..... ..... 011 ..... 1010111 @r_vm
464vmsle_vv        011101 . ..... ..... 000 ..... 1010111 @r_vm
465vmsle_vx        011101 . ..... ..... 100 ..... 1010111 @r_vm
466vmsle_vi        011101 . ..... ..... 011 ..... 1010111 @r_vm
467vmsgtu_vx       011110 . ..... ..... 100 ..... 1010111 @r_vm
468vmsgtu_vi       011110 . ..... ..... 011 ..... 1010111 @r_vm
469vmsgt_vx        011111 . ..... ..... 100 ..... 1010111 @r_vm
470vmsgt_vi        011111 . ..... ..... 011 ..... 1010111 @r_vm
471vminu_vv        000100 . ..... ..... 000 ..... 1010111 @r_vm
472vminu_vx        000100 . ..... ..... 100 ..... 1010111 @r_vm
473vmin_vv         000101 . ..... ..... 000 ..... 1010111 @r_vm
474vmin_vx         000101 . ..... ..... 100 ..... 1010111 @r_vm
475vmaxu_vv        000110 . ..... ..... 000 ..... 1010111 @r_vm
476vmaxu_vx        000110 . ..... ..... 100 ..... 1010111 @r_vm
477vmax_vv         000111 . ..... ..... 000 ..... 1010111 @r_vm
478vmax_vx         000111 . ..... ..... 100 ..... 1010111 @r_vm
479vmul_vv         100101 . ..... ..... 010 ..... 1010111 @r_vm
480vmul_vx         100101 . ..... ..... 110 ..... 1010111 @r_vm
481vmulh_vv        100111 . ..... ..... 010 ..... 1010111 @r_vm
482vmulh_vx        100111 . ..... ..... 110 ..... 1010111 @r_vm
483vmulhu_vv       100100 . ..... ..... 010 ..... 1010111 @r_vm
484vmulhu_vx       100100 . ..... ..... 110 ..... 1010111 @r_vm
485vmulhsu_vv      100110 . ..... ..... 010 ..... 1010111 @r_vm
486vmulhsu_vx      100110 . ..... ..... 110 ..... 1010111 @r_vm
487vdivu_vv        100000 . ..... ..... 010 ..... 1010111 @r_vm
488vdivu_vx        100000 . ..... ..... 110 ..... 1010111 @r_vm
489vdiv_vv         100001 . ..... ..... 010 ..... 1010111 @r_vm
490vdiv_vx         100001 . ..... ..... 110 ..... 1010111 @r_vm
491vremu_vv        100010 . ..... ..... 010 ..... 1010111 @r_vm
492vremu_vx        100010 . ..... ..... 110 ..... 1010111 @r_vm
493vrem_vv         100011 . ..... ..... 010 ..... 1010111 @r_vm
494vrem_vx         100011 . ..... ..... 110 ..... 1010111 @r_vm
495vwmulu_vv       111000 . ..... ..... 010 ..... 1010111 @r_vm
496vwmulu_vx       111000 . ..... ..... 110 ..... 1010111 @r_vm
497vwmulsu_vv      111010 . ..... ..... 010 ..... 1010111 @r_vm
498vwmulsu_vx      111010 . ..... ..... 110 ..... 1010111 @r_vm
499vwmul_vv        111011 . ..... ..... 010 ..... 1010111 @r_vm
500vwmul_vx        111011 . ..... ..... 110 ..... 1010111 @r_vm
501vmacc_vv        101101 . ..... ..... 010 ..... 1010111 @r_vm
502vmacc_vx        101101 . ..... ..... 110 ..... 1010111 @r_vm
503vnmsac_vv       101111 . ..... ..... 010 ..... 1010111 @r_vm
504vnmsac_vx       101111 . ..... ..... 110 ..... 1010111 @r_vm
505vmadd_vv        101001 . ..... ..... 010 ..... 1010111 @r_vm
506vmadd_vx        101001 . ..... ..... 110 ..... 1010111 @r_vm
507vnmsub_vv       101011 . ..... ..... 010 ..... 1010111 @r_vm
508vnmsub_vx       101011 . ..... ..... 110 ..... 1010111 @r_vm
509vwmaccu_vv      111100 . ..... ..... 010 ..... 1010111 @r_vm
510vwmaccu_vx      111100 . ..... ..... 110 ..... 1010111 @r_vm
511vwmacc_vv       111101 . ..... ..... 010 ..... 1010111 @r_vm
512vwmacc_vx       111101 . ..... ..... 110 ..... 1010111 @r_vm
513vwmaccsu_vv     111111 . ..... ..... 010 ..... 1010111 @r_vm
514vwmaccsu_vx     111111 . ..... ..... 110 ..... 1010111 @r_vm
515vwmaccus_vx     111110 . ..... ..... 110 ..... 1010111 @r_vm
516vmv_v_v         010111 1 00000 ..... 000 ..... 1010111 @r2
517vmv_v_x         010111 1 00000 ..... 100 ..... 1010111 @r2
518vmv_v_i         010111 1 00000 ..... 011 ..... 1010111 @r2
519vmerge_vvm      010111 0 ..... ..... 000 ..... 1010111 @r_vm_0
520vmerge_vxm      010111 0 ..... ..... 100 ..... 1010111 @r_vm_0
521vmerge_vim      010111 0 ..... ..... 011 ..... 1010111 @r_vm_0
522vsaddu_vv       100000 . ..... ..... 000 ..... 1010111 @r_vm
523vsaddu_vx       100000 . ..... ..... 100 ..... 1010111 @r_vm
524vsaddu_vi       100000 . ..... ..... 011 ..... 1010111 @r_vm
525vsadd_vv        100001 . ..... ..... 000 ..... 1010111 @r_vm
526vsadd_vx        100001 . ..... ..... 100 ..... 1010111 @r_vm
527vsadd_vi        100001 . ..... ..... 011 ..... 1010111 @r_vm
528vssubu_vv       100010 . ..... ..... 000 ..... 1010111 @r_vm
529vssubu_vx       100010 . ..... ..... 100 ..... 1010111 @r_vm
530vssub_vv        100011 . ..... ..... 000 ..... 1010111 @r_vm
531vssub_vx        100011 . ..... ..... 100 ..... 1010111 @r_vm
532vaadd_vv        001001 . ..... ..... 010 ..... 1010111 @r_vm
533vaadd_vx        001001 . ..... ..... 110 ..... 1010111 @r_vm
534vaaddu_vv       001000 . ..... ..... 010 ..... 1010111 @r_vm
535vaaddu_vx       001000 . ..... ..... 110 ..... 1010111 @r_vm
536vasub_vv        001011 . ..... ..... 010 ..... 1010111 @r_vm
537vasub_vx        001011 . ..... ..... 110 ..... 1010111 @r_vm
538vasubu_vv       001010 . ..... ..... 010 ..... 1010111 @r_vm
539vasubu_vx       001010 . ..... ..... 110 ..... 1010111 @r_vm
540vsmul_vv        100111 . ..... ..... 000 ..... 1010111 @r_vm
541vsmul_vx        100111 . ..... ..... 100 ..... 1010111 @r_vm
542vssrl_vv        101010 . ..... ..... 000 ..... 1010111 @r_vm
543vssrl_vx        101010 . ..... ..... 100 ..... 1010111 @r_vm
544vssrl_vi        101010 . ..... ..... 011 ..... 1010111 @r_vm
545vssra_vv        101011 . ..... ..... 000 ..... 1010111 @r_vm
546vssra_vx        101011 . ..... ..... 100 ..... 1010111 @r_vm
547vssra_vi        101011 . ..... ..... 011 ..... 1010111 @r_vm
548vnclipu_wv      101110 . ..... ..... 000 ..... 1010111 @r_vm
549vnclipu_wx      101110 . ..... ..... 100 ..... 1010111 @r_vm
550vnclipu_wi      101110 . ..... ..... 011 ..... 1010111 @r_vm
551vnclip_wv       101111 . ..... ..... 000 ..... 1010111 @r_vm
552vnclip_wx       101111 . ..... ..... 100 ..... 1010111 @r_vm
553vnclip_wi       101111 . ..... ..... 011 ..... 1010111 @r_vm
554vfadd_vv        000000 . ..... ..... 001 ..... 1010111 @r_vm
555vfadd_vf        000000 . ..... ..... 101 ..... 1010111 @r_vm
556vfsub_vv        000010 . ..... ..... 001 ..... 1010111 @r_vm
557vfsub_vf        000010 . ..... ..... 101 ..... 1010111 @r_vm
558vfrsub_vf       100111 . ..... ..... 101 ..... 1010111 @r_vm
559vfwadd_vv       110000 . ..... ..... 001 ..... 1010111 @r_vm
560vfwadd_vf       110000 . ..... ..... 101 ..... 1010111 @r_vm
561vfwadd_wv       110100 . ..... ..... 001 ..... 1010111 @r_vm
562vfwadd_wf       110100 . ..... ..... 101 ..... 1010111 @r_vm
563vfwsub_vv       110010 . ..... ..... 001 ..... 1010111 @r_vm
564vfwsub_vf       110010 . ..... ..... 101 ..... 1010111 @r_vm
565vfwsub_wv       110110 . ..... ..... 001 ..... 1010111 @r_vm
566vfwsub_wf       110110 . ..... ..... 101 ..... 1010111 @r_vm
567vfmul_vv        100100 . ..... ..... 001 ..... 1010111 @r_vm
568vfmul_vf        100100 . ..... ..... 101 ..... 1010111 @r_vm
569vfdiv_vv        100000 . ..... ..... 001 ..... 1010111 @r_vm
570vfdiv_vf        100000 . ..... ..... 101 ..... 1010111 @r_vm
571vfrdiv_vf       100001 . ..... ..... 101 ..... 1010111 @r_vm
572vfwmul_vv       111000 . ..... ..... 001 ..... 1010111 @r_vm
573vfwmul_vf       111000 . ..... ..... 101 ..... 1010111 @r_vm
574vfmacc_vv       101100 . ..... ..... 001 ..... 1010111 @r_vm
575vfnmacc_vv      101101 . ..... ..... 001 ..... 1010111 @r_vm
576vfnmacc_vf      101101 . ..... ..... 101 ..... 1010111 @r_vm
577vfmacc_vf       101100 . ..... ..... 101 ..... 1010111 @r_vm
578vfmsac_vv       101110 . ..... ..... 001 ..... 1010111 @r_vm
579vfmsac_vf       101110 . ..... ..... 101 ..... 1010111 @r_vm
580vfnmsac_vv      101111 . ..... ..... 001 ..... 1010111 @r_vm
581vfnmsac_vf      101111 . ..... ..... 101 ..... 1010111 @r_vm
582vfmadd_vv       101000 . ..... ..... 001 ..... 1010111 @r_vm
583vfmadd_vf       101000 . ..... ..... 101 ..... 1010111 @r_vm
584vfnmadd_vv      101001 . ..... ..... 001 ..... 1010111 @r_vm
585vfnmadd_vf      101001 . ..... ..... 101 ..... 1010111 @r_vm
586vfmsub_vv       101010 . ..... ..... 001 ..... 1010111 @r_vm
587vfmsub_vf       101010 . ..... ..... 101 ..... 1010111 @r_vm
588vfnmsub_vv      101011 . ..... ..... 001 ..... 1010111 @r_vm
589vfnmsub_vf      101011 . ..... ..... 101 ..... 1010111 @r_vm
590vfwmacc_vv      111100 . ..... ..... 001 ..... 1010111 @r_vm
591vfwmacc_vf      111100 . ..... ..... 101 ..... 1010111 @r_vm
592vfwnmacc_vv     111101 . ..... ..... 001 ..... 1010111 @r_vm
593vfwnmacc_vf     111101 . ..... ..... 101 ..... 1010111 @r_vm
594vfwmsac_vv      111110 . ..... ..... 001 ..... 1010111 @r_vm
595vfwmsac_vf      111110 . ..... ..... 101 ..... 1010111 @r_vm
596vfwnmsac_vv     111111 . ..... ..... 001 ..... 1010111 @r_vm
597vfwnmsac_vf     111111 . ..... ..... 101 ..... 1010111 @r_vm
598vfsqrt_v        010011 . ..... 00000 001 ..... 1010111 @r2_vm
599vfrsqrt7_v      010011 . ..... 00100 001 ..... 1010111 @r2_vm
600vfrec7_v        010011 . ..... 00101 001 ..... 1010111 @r2_vm
601vfmin_vv        000100 . ..... ..... 001 ..... 1010111 @r_vm
602vfmin_vf        000100 . ..... ..... 101 ..... 1010111 @r_vm
603vfmax_vv        000110 . ..... ..... 001 ..... 1010111 @r_vm
604vfmax_vf        000110 . ..... ..... 101 ..... 1010111 @r_vm
605vfsgnj_vv       001000 . ..... ..... 001 ..... 1010111 @r_vm
606vfsgnj_vf       001000 . ..... ..... 101 ..... 1010111 @r_vm
607vfsgnjn_vv      001001 . ..... ..... 001 ..... 1010111 @r_vm
608vfsgnjn_vf      001001 . ..... ..... 101 ..... 1010111 @r_vm
609vfsgnjx_vv      001010 . ..... ..... 001 ..... 1010111 @r_vm
610vfsgnjx_vf      001010 . ..... ..... 101 ..... 1010111 @r_vm
611vfslide1up_vf   001110 . ..... ..... 101 ..... 1010111 @r_vm
612vfslide1down_vf 001111 . ..... ..... 101 ..... 1010111 @r_vm
613vmfeq_vv        011000 . ..... ..... 001 ..... 1010111 @r_vm
614vmfeq_vf        011000 . ..... ..... 101 ..... 1010111 @r_vm
615vmfne_vv        011100 . ..... ..... 001 ..... 1010111 @r_vm
616vmfne_vf        011100 . ..... ..... 101 ..... 1010111 @r_vm
617vmflt_vv        011011 . ..... ..... 001 ..... 1010111 @r_vm
618vmflt_vf        011011 . ..... ..... 101 ..... 1010111 @r_vm
619vmfle_vv        011001 . ..... ..... 001 ..... 1010111 @r_vm
620vmfle_vf        011001 . ..... ..... 101 ..... 1010111 @r_vm
621vmfgt_vf        011101 . ..... ..... 101 ..... 1010111 @r_vm
622vmfge_vf        011111 . ..... ..... 101 ..... 1010111 @r_vm
623vfclass_v       010011 . ..... 10000 001 ..... 1010111 @r2_vm
624vfmerge_vfm     010111 0 ..... ..... 101 ..... 1010111 @r_vm_0
625vfmv_v_f        010111 1 00000 ..... 101 ..... 1010111 @r2
626
627vfcvt_xu_f_v       010010 . ..... 00000 001 ..... 1010111 @r2_vm
628vfcvt_x_f_v        010010 . ..... 00001 001 ..... 1010111 @r2_vm
629vfcvt_f_xu_v       010010 . ..... 00010 001 ..... 1010111 @r2_vm
630vfcvt_f_x_v        010010 . ..... 00011 001 ..... 1010111 @r2_vm
631vfcvt_rtz_xu_f_v   010010 . ..... 00110 001 ..... 1010111 @r2_vm
632vfcvt_rtz_x_f_v    010010 . ..... 00111 001 ..... 1010111 @r2_vm
633
634vfwcvt_xu_f_v      010010 . ..... 01000 001 ..... 1010111 @r2_vm
635vfwcvt_x_f_v       010010 . ..... 01001 001 ..... 1010111 @r2_vm
636vfwcvt_f_xu_v      010010 . ..... 01010 001 ..... 1010111 @r2_vm
637vfwcvt_f_x_v       010010 . ..... 01011 001 ..... 1010111 @r2_vm
638vfwcvt_f_f_v       010010 . ..... 01100 001 ..... 1010111 @r2_vm
639vfwcvt_rtz_xu_f_v  010010 . ..... 01110 001 ..... 1010111 @r2_vm
640vfwcvt_rtz_x_f_v   010010 . ..... 01111 001 ..... 1010111 @r2_vm
641
642vfncvt_xu_f_w      010010 . ..... 10000 001 ..... 1010111 @r2_vm
643vfncvt_x_f_w       010010 . ..... 10001 001 ..... 1010111 @r2_vm
644vfncvt_f_xu_w      010010 . ..... 10010 001 ..... 1010111 @r2_vm
645vfncvt_f_x_w       010010 . ..... 10011 001 ..... 1010111 @r2_vm
646vfncvt_f_f_w       010010 . ..... 10100 001 ..... 1010111 @r2_vm
647vfncvt_rod_f_f_w   010010 . ..... 10101 001 ..... 1010111 @r2_vm
648vfncvt_rtz_xu_f_w  010010 . ..... 10110 001 ..... 1010111 @r2_vm
649vfncvt_rtz_x_f_w   010010 . ..... 10111 001 ..... 1010111 @r2_vm
650
651vredsum_vs      000000 . ..... ..... 010 ..... 1010111 @r_vm
652vredand_vs      000001 . ..... ..... 010 ..... 1010111 @r_vm
653vredor_vs       000010 . ..... ..... 010 ..... 1010111 @r_vm
654vredxor_vs      000011 . ..... ..... 010 ..... 1010111 @r_vm
655vredminu_vs     000100 . ..... ..... 010 ..... 1010111 @r_vm
656vredmin_vs      000101 . ..... ..... 010 ..... 1010111 @r_vm
657vredmaxu_vs     000110 . ..... ..... 010 ..... 1010111 @r_vm
658vredmax_vs      000111 . ..... ..... 010 ..... 1010111 @r_vm
659vwredsumu_vs    110000 . ..... ..... 000 ..... 1010111 @r_vm
660vwredsum_vs     110001 . ..... ..... 000 ..... 1010111 @r_vm
661# Vector ordered and unordered reduction sum
662vfredsum_vs     0000-1 . ..... ..... 001 ..... 1010111 @r_vm
663vfredmin_vs     000101 . ..... ..... 001 ..... 1010111 @r_vm
664vfredmax_vs     000111 . ..... ..... 001 ..... 1010111 @r_vm
665# Vector widening ordered and unordered float reduction sum
666vfwredsum_vs    1100-1 . ..... ..... 001 ..... 1010111 @r_vm
667vmand_mm        011001 - ..... ..... 010 ..... 1010111 @r
668vmnand_mm       011101 - ..... ..... 010 ..... 1010111 @r
669vmandn_mm       011000 - ..... ..... 010 ..... 1010111 @r
670vmxor_mm        011011 - ..... ..... 010 ..... 1010111 @r
671vmor_mm         011010 - ..... ..... 010 ..... 1010111 @r
672vmnor_mm        011110 - ..... ..... 010 ..... 1010111 @r
673vmorn_mm        011100 - ..... ..... 010 ..... 1010111 @r
674vmxnor_mm       011111 - ..... ..... 010 ..... 1010111 @r
675vcpop_m         010000 . ..... 10000 010 ..... 1010111 @r2_vm
676vfirst_m        010000 . ..... 10001 010 ..... 1010111 @r2_vm
677vmsbf_m         010100 . ..... 00001 010 ..... 1010111 @r2_vm
678vmsif_m         010100 . ..... 00011 010 ..... 1010111 @r2_vm
679vmsof_m         010100 . ..... 00010 010 ..... 1010111 @r2_vm
680viota_m         010100 . ..... 10000 010 ..... 1010111 @r2_vm
681vid_v           010100 . 00000 10001 010 ..... 1010111 @r1_vm
682vmv_x_s         010000 1 ..... 00000 010 ..... 1010111 @r2rd
683vmv_s_x         010000 1 00000 ..... 110 ..... 1010111 @r2
684vfmv_f_s        010000 1 ..... 00000 001 ..... 1010111 @r2rd
685vfmv_s_f        010000 1 00000 ..... 101 ..... 1010111 @r2
686vslideup_vx     001110 . ..... ..... 100 ..... 1010111 @r_vm
687vslideup_vi     001110 . ..... ..... 011 ..... 1010111 @r_vm
688vslide1up_vx    001110 . ..... ..... 110 ..... 1010111 @r_vm
689vslidedown_vx   001111 . ..... ..... 100 ..... 1010111 @r_vm
690vslidedown_vi   001111 . ..... ..... 011 ..... 1010111 @r_vm
691vslide1down_vx  001111 . ..... ..... 110 ..... 1010111 @r_vm
692vrgather_vv     001100 . ..... ..... 000 ..... 1010111 @r_vm
693vrgatherei16_vv 001110 . ..... ..... 000 ..... 1010111 @r_vm
694vrgather_vx     001100 . ..... ..... 100 ..... 1010111 @r_vm
695vrgather_vi     001100 . ..... ..... 011 ..... 1010111 @r_vm
696vcompress_vm    010111 - ..... ..... 010 ..... 1010111 @r
697vmv1r_v         100111 1 ..... 00000 011 ..... 1010111 @r2rd
698vmv2r_v         100111 1 ..... 00001 011 ..... 1010111 @r2rd
699vmv4r_v         100111 1 ..... 00011 011 ..... 1010111 @r2rd
700vmv8r_v         100111 1 ..... 00111 011 ..... 1010111 @r2rd
701
702# Vector Integer Extension
703vzext_vf2       010010 . ..... 00110 010 ..... 1010111 @r2_vm
704vzext_vf4       010010 . ..... 00100 010 ..... 1010111 @r2_vm
705vzext_vf8       010010 . ..... 00010 010 ..... 1010111 @r2_vm
706vsext_vf2       010010 . ..... 00111 010 ..... 1010111 @r2_vm
707vsext_vf4       010010 . ..... 00101 010 ..... 1010111 @r2_vm
708vsext_vf8       010010 . ..... 00011 010 ..... 1010111 @r2_vm
709
710vsetvli         0 ........... ..... 111 ..... 1010111  @r2_zimm11
711vsetivli        11 .......... ..... 111 ..... 1010111  @r2_zimm10
712vsetvl          1000000 ..... ..... 111 ..... 1010111  @r
713
714# *** RV32 Zba Standard Extension ***
715sh1add     0010000 .......... 010 ..... 0110011 @r
716sh2add     0010000 .......... 100 ..... 0110011 @r
717sh3add     0010000 .......... 110 ..... 0110011 @r
718
719# *** RV64 Zba Standard Extension (in addition to RV32 Zba) ***
720add_uw     0000100 .......... 000 ..... 0111011 @r
721sh1add_uw  0010000 .......... 010 ..... 0111011 @r
722sh2add_uw  0010000 .......... 100 ..... 0111011 @r
723sh3add_uw  0010000 .......... 110 ..... 0111011 @r
724slli_uw    00001 ............ 001 ..... 0011011 @sh
725
726# *** RV32 Zbb/Zbkb Standard Extension ***
727andn       0100000 .......... 111 ..... 0110011 @r
728rol        0110000 .......... 001 ..... 0110011 @r
729ror        0110000 .......... 101 ..... 0110011 @r
730rori       01100 ............ 101 ..... 0010011 @sh
731# The encoding for rev8 differs between RV32 and RV64.
732# rev8_32 denotes the RV32 variant.
733rev8_32    011010 011000 ..... 101 ..... 0010011 @r2
734# The encoding for zext.h differs between RV32 and RV64.
735# zext_h_32 denotes the RV32 variant.
736{
737  zext_h_32  0000100 00000 ..... 100 ..... 0110011 @r2
738  pack       0000100 ..... ..... 100 ..... 0110011 @r
739}
740xnor       0100000 .......... 100 ..... 0110011 @r
741# *** RV32 extra Zbb Standard Extension ***
742clz        011000 000000 ..... 001 ..... 0010011 @r2
743cpop       011000 000010 ..... 001 ..... 0010011 @r2
744ctz        011000 000001 ..... 001 ..... 0010011 @r2
745max        0000101 .......... 110 ..... 0110011 @r
746maxu       0000101 .......... 111 ..... 0110011 @r
747min        0000101 .......... 100 ..... 0110011 @r
748minu       0000101 .......... 101 ..... 0110011 @r
749orc_b      001010 000111 ..... 101 ..... 0010011 @r2
750orn        0100000 .......... 110 ..... 0110011 @r
751sext_b     011000 000100 ..... 001 ..... 0010011 @r2
752sext_h     011000 000101 ..... 001 ..... 0010011 @r2
753# *** RV32 extra Zbkb Standard Extension ***
754brev8      0110100 00111 ..... 101 ..... 0010011 @r2  #grevi
755packh      0000100  .......... 111 ..... 0110011 @r
756unzip      0000100 01111 ..... 101 ..... 0010011 @r2  #unshfl
757zip        0000100 01111 ..... 001 ..... 0010011 @r2  #shfl
758
759# *** RV64 Zbb/Zbkb Standard Extension (in addition to RV32 Zbb/Zbkb) ***
760# The encoding for rev8 differs between RV32 and RV64.
761# When executing on RV64, the encoding used in RV32 is an illegal
762# instruction, so we use different handler functions to differentiate.
763rev8_64    011010 111000 ..... 101 ..... 0010011 @r2
764rolw       0110000 .......... 001 ..... 0111011 @r
765roriw      0110000 .......... 101 ..... 0011011 @sh5
766rorw       0110000 .......... 101 ..... 0111011 @r
767# The encoding for zext.h differs between RV32 and RV64.
768# When executing on RV64, the encoding used in RV32 is an illegal
769# instruction, so we use different handler functions to differentiate.
770{
771  zext_h_64  0000100 00000 ..... 100 ..... 0111011 @r2
772  packw      0000100 ..... ..... 100 ..... 0111011 @r
773}
774# *** RV64 extra Zbb Standard Extension (in addition to RV32 Zbb) ***
775clzw       0110000 00000 ..... 001 ..... 0011011 @r2
776ctzw       0110000 00001 ..... 001 ..... 0011011 @r2
777cpopw      0110000 00010 ..... 001 ..... 0011011 @r2
778
779# *** RV32 Zbc/Zbkc Standard Extension ***
780clmul      0000101 .......... 001 ..... 0110011 @r
781clmulh     0000101 .......... 011 ..... 0110011 @r
782# *** RV32 extra Zbc Standard Extension ***
783clmulr     0000101 .......... 010 ..... 0110011 @r
784
785# *** RV32 Zbkx Standard Extension ***
786xperm4     0010100 .......... 010 ..... 0110011 @r
787xperm8     0010100 .......... 100 ..... 0110011 @r
788
789# *** RV32 Zbs Standard Extension ***
790bclr       0100100 .......... 001 ..... 0110011 @r
791bclri      01001. ........... 001 ..... 0010011 @sh
792bext       0100100 .......... 101 ..... 0110011 @r
793bexti      01001. ........... 101 ..... 0010011 @sh
794binv       0110100 .......... 001 ..... 0110011 @r
795binvi      01101. ........... 001 ..... 0010011 @sh
796bset       0010100 .......... 001 ..... 0110011 @r
797bseti      00101. ........... 001 ..... 0010011 @sh
798
799# *** RV32 Zfh Extension ***
800flh        ............   ..... 001 ..... 0000111 @i
801fsh        .......  ..... ..... 001 ..... 0100111 @s
802fmadd_h    ..... 10 ..... ..... ... ..... 1000011 @r4_rm
803fmsub_h    ..... 10 ..... ..... ... ..... 1000111 @r4_rm
804fnmsub_h   ..... 10 ..... ..... ... ..... 1001011 @r4_rm
805fnmadd_h   ..... 10 ..... ..... ... ..... 1001111 @r4_rm
806fadd_h     0000010  ..... ..... ... ..... 1010011 @r_rm
807fsub_h     0000110  ..... ..... ... ..... 1010011 @r_rm
808fmul_h     0001010  ..... ..... ... ..... 1010011 @r_rm
809fdiv_h     0001110  ..... ..... ... ..... 1010011 @r_rm
810fsqrt_h    0101110  00000 ..... ... ..... 1010011 @r2_rm
811fsgnj_h    0010010  ..... ..... 000 ..... 1010011 @r
812fsgnjn_h   0010010  ..... ..... 001 ..... 1010011 @r
813fsgnjx_h   0010010  ..... ..... 010 ..... 1010011 @r
814fmin_h     0010110  ..... ..... 000 ..... 1010011 @r
815fmax_h     0010110  ..... ..... 001 ..... 1010011 @r
816fcvt_h_s   0100010  00000 ..... ... ..... 1010011 @r2_rm
817fcvt_s_h   0100000  00010 ..... ... ..... 1010011 @r2_rm
818fcvt_h_d   0100010  00001 ..... ... ..... 1010011 @r2_rm
819fcvt_d_h   0100001  00010 ..... ... ..... 1010011 @r2_rm
820fcvt_w_h   1100010  00000 ..... ... ..... 1010011 @r2_rm
821fcvt_wu_h  1100010  00001 ..... ... ..... 1010011 @r2_rm
822fmv_x_h    1110010  00000 ..... 000 ..... 1010011 @r2
823feq_h      1010010  ..... ..... 010 ..... 1010011 @r
824flt_h      1010010  ..... ..... 001 ..... 1010011 @r
825fle_h      1010010  ..... ..... 000 ..... 1010011 @r
826fclass_h   1110010  00000 ..... 001 ..... 1010011 @r2
827fcvt_h_w   1101010  00000 ..... ... ..... 1010011 @r2_rm
828fcvt_h_wu  1101010  00001 ..... ... ..... 1010011 @r2_rm
829fmv_h_x    1111010  00000 ..... 000 ..... 1010011 @r2
830
831# *** RV64 Zfh Extension (in addition to RV32 Zfh) ***
832fcvt_l_h   1100010  00010 ..... ... ..... 1010011 @r2_rm
833fcvt_lu_h  1100010  00011 ..... ... ..... 1010011 @r2_rm
834fcvt_h_l   1101010  00010 ..... ... ..... 1010011 @r2_rm
835fcvt_h_lu  1101010  00011 ..... ... ..... 1010011 @r2_rm
836
837# *** Svinval Standard Extension ***
838sinval_vma        0001011 ..... ..... 000 00000 1110011 @sfence_vma
839sfence_w_inval    0001100 00000 00000 000 00000 1110011
840sfence_inval_ir   0001100 00001 00000 000 00000 1110011
841hinval_vvma       0010011 ..... ..... 000 00000 1110011 @hfence_vvma
842hinval_gvma       0110011 ..... ..... 000 00000 1110011 @hfence_gvma
843
844# *** RV32 Zknd Standard Extension ***
845aes32dsmi   .. 10111 ..... ..... 000 ..... 0110011 @k_aes
846aes32dsi    .. 10101 ..... ..... 000 ..... 0110011 @k_aes
847# *** RV64 Zknd Standard Extension ***
848aes64dsm    00 11111 ..... ..... 000 ..... 0110011 @r
849aes64ds     00 11101 ..... ..... 000 ..... 0110011 @r
850aes64im     00 11000 00000 ..... 001 ..... 0010011 @r2
851# *** RV32 Zkne Standard Extension ***
852aes32esmi   .. 10011 ..... ..... 000 ..... 0110011 @k_aes
853aes32esi    .. 10001 ..... ..... 000 ..... 0110011 @k_aes
854# *** RV64 Zkne Standard Extension ***
855aes64es     00 11001 ..... ..... 000 ..... 0110011 @r
856aes64esm    00 11011 ..... ..... 000 ..... 0110011 @r
857# *** RV64 Zkne/zknd Standard Extension ***
858aes64ks2    01 11111 ..... ..... 000 ..... 0110011 @r
859aes64ks1i   00 11000 1.... ..... 001 ..... 0010011 @i_aes
860# *** RV32 Zknh Standard Extension ***
861sha256sig0  00 01000 00010 ..... 001 ..... 0010011 @r2
862sha256sig1  00 01000 00011 ..... 001 ..... 0010011 @r2
863sha256sum0  00 01000 00000 ..... 001 ..... 0010011 @r2
864sha256sum1  00 01000 00001 ..... 001 ..... 0010011 @r2
865sha512sum0r 01 01000 ..... ..... 000 ..... 0110011 @r
866sha512sum1r 01 01001 ..... ..... 000 ..... 0110011 @r
867sha512sig0l 01 01010 ..... ..... 000 ..... 0110011 @r
868sha512sig0h 01 01110 ..... ..... 000 ..... 0110011 @r
869sha512sig1l 01 01011 ..... ..... 000 ..... 0110011 @r
870sha512sig1h 01 01111 ..... ..... 000 ..... 0110011 @r
871# *** RV64 Zknh Standard Extension ***
872sha512sig0  00 01000 00110 ..... 001 ..... 0010011 @r2
873sha512sig1  00 01000 00111 ..... 001 ..... 0010011 @r2
874sha512sum0  00 01000 00100 ..... 001 ..... 0010011 @r2
875sha512sum1  00 01000 00101 ..... 001 ..... 0010011 @r2
876# *** RV32 Zksh Standard Extension ***
877sm3p0       00 01000 01000 ..... 001 ..... 0010011 @r2
878sm3p1       00 01000 01001 ..... 001 ..... 0010011 @r2
879# *** RV32 Zksed Standard Extension ***
880sm4ed       .. 11000 ..... ..... 000 ..... 0110011 @k_aes
881sm4ks       .. 11010 ..... ..... 000 ..... 0110011 @k_aes
882