RISC-V: avoid use of match_opcode() in riscv_insn_types[]

Message ID 6f43c2d5-20d8-49aa-b577-ec7e5587cc8e@suse.com
State New
Headers
Series RISC-V: avoid use of match_opcode() in riscv_insn_types[] |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Jan Beulich July 4, 2024, 11:12 a.m. UTC
  As of 27b33966b18e ("RISC-V: disallow x0 with certain macro-insns") the
.match_func field may be NULL for entries used for assembly only, which
is the case for the entire table. With .match and .mask both zero the
function would only ever succeed anyway. Save almost a hundred base
relocations in the final executable by using NULL instead.
  

Comments

Nelson Chu July 4, 2024, 1:54 p.m. UTC | #1
Thanks, looks good and reasonable to me :-)

Nelson

On Thu, Jul 4, 2024 at 7:12 PM Jan Beulich <jbeulich@suse.com> wrote:

> As of 27b33966b18e ("RISC-V: disallow x0 with certain macro-insns") the
> .match_func field may be NULL for entries used for assembly only, which
> is the case for the entire table. With .match and .mask both zero the
> function would only ever succeed anyway. Save almost a hundred base
> relocations in the final executable by using NULL instead.
>
> --- a/opcodes/riscv-opc.c
> +++ b/opcodes/riscv-opc.c
> @@ -3132,108 +3132,108 @@ const struct riscv_opcode riscv_opcodes[
>  const struct riscv_opcode riscv_insn_types[] =
>  {
>  /* name, xlen, isa, operands, match, mask, match_func, pinfo.  */
> -{"r",       0, INSN_CLASS_I,       "O4,F3,F7,d,s,t",    0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,s,t",    0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F7,d,S,t",    0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,S,t",    0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F7,d,s,T",    0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,s,T",    0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F7,d,S,T",    0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,S,T",    0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_I,       "O4,F3,F2,d,s,t,r",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,r",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,r",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,r",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,r",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,r",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,r",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,r",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,s,t,R",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,R",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,R",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,R",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,R",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,R",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,R",  0, 0,
> match_opcode, 0 },
> -{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,R",  0, 0,
> match_opcode, 0 },
> -
> -{"r4",      0, INSN_CLASS_I,       "O4,F3,F2,d,s,t,r",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,r",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,r",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,r",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,r",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,r",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,r",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,r",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,s,t,R",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,R",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,R",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,R",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,R",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,R",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,R",  0, 0,
> match_opcode, 0 },
> -{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,R",  0, 0,
> match_opcode, 0 },
> -
> -{"i",       0, INSN_CLASS_I,       "O4,F3,d,s,j",       0, 0,
> match_opcode, 0 },
> -{"i",       0, INSN_CLASS_F,       "O4,F3,D,s,j",       0, 0,
> match_opcode, 0 },
> -{"i",       0, INSN_CLASS_F,       "O4,F3,d,S,j",       0, 0,
> match_opcode, 0 },
> -{"i",       0, INSN_CLASS_F,       "O4,F3,D,S,j",       0, 0,
> match_opcode, 0 },
> -{"i",       0, INSN_CLASS_I,       "O4,F3,d,o(s)",      0, 0,
> match_opcode, 0 },
> -{"i",       0, INSN_CLASS_F,       "O4,F3,D,o(s)",      0, 0,
> match_opcode, 0 },
> -
> -{"s",       0, INSN_CLASS_I,       "O4,F3,t,q(s)",      0, 0,
> match_opcode, 0 },
> -{"s",       0, INSN_CLASS_F,       "O4,F3,T,q(s)",      0, 0,
> match_opcode, 0 },
> -
> -{"sb",      0, INSN_CLASS_I,       "O4,F3,s,t,p",       0, 0,
> match_opcode, 0 },
> -{"sb",      0, INSN_CLASS_F,       "O4,F3,S,t,p",       0, 0,
> match_opcode, 0 },
> -{"sb",      0, INSN_CLASS_F,       "O4,F3,s,T,p",       0, 0,
> match_opcode, 0 },
> -{"sb",      0, INSN_CLASS_F,       "O4,F3,S,T,p",       0, 0,
> match_opcode, 0 },
> -{"b",       0, INSN_CLASS_I,       "O4,F3,s,t,p",       0, 0,
> match_opcode, 0 },
> -{"b",       0, INSN_CLASS_F,       "O4,F3,S,t,p",       0, 0,
> match_opcode, 0 },
> -{"b",       0, INSN_CLASS_F,       "O4,F3,s,T,p",       0, 0,
> match_opcode, 0 },
> -{"b",       0, INSN_CLASS_F,       "O4,F3,S,T,p",       0, 0,
> match_opcode, 0 },
> -
> -{"u",       0, INSN_CLASS_I,       "O4,d,u",            0, 0,
> match_opcode, 0 },
> -{"u",       0, INSN_CLASS_F,       "O4,D,u",            0, 0,
> match_opcode, 0 },
> -
> -{"uj",      0, INSN_CLASS_I,       "O4,d,a",            0, 0,
> match_opcode, 0 },
> -{"uj",      0, INSN_CLASS_F,       "O4,D,a",            0, 0,
> match_opcode, 0 },
> -{"j",       0, INSN_CLASS_I,       "O4,d,a",            0, 0,
> match_opcode, 0 },
> -{"j",       0, INSN_CLASS_F,       "O4,D,a",            0, 0,
> match_opcode, 0 },
> -
> -{"cr",      0, INSN_CLASS_C,       "O2,CF4,d,CV",       0, 0,
> match_opcode, 0 },
> -{"cr",      0, INSN_CLASS_F_AND_C, "O2,CF4,D,CV",       0, 0,
> match_opcode, 0 },
> -{"cr",      0, INSN_CLASS_F_AND_C, "O2,CF4,d,CT",       0, 0,
> match_opcode, 0 },
> -{"cr",      0, INSN_CLASS_F_AND_C, "O2,CF4,D,CT",       0, 0,
> match_opcode, 0 },
> -
> -{"ci",      0, INSN_CLASS_C,       "O2,CF3,d,Co",       0, 0,
> match_opcode, 0 },
> -{"ci",      0, INSN_CLASS_F_AND_C, "O2,CF3,D,Co",       0, 0,
> match_opcode, 0 },
> -
> -{"ciw",     0, INSN_CLASS_C,       "O2,CF3,Ct,C8",      0, 0,
> match_opcode, 0 },
> -{"ciw",     0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C8",      0, 0,
> match_opcode, 0 },
> -
> -{"css",     0, INSN_CLASS_C,       "O2,CF3,CV,C6",      0, 0,
> match_opcode, 0 },
> -{"css",     0, INSN_CLASS_F_AND_C, "O2,CF3,CT,C6",      0, 0,
> match_opcode, 0 },
> -
> -{"cl",      0, INSN_CLASS_C,       "O2,CF3,Ct,C5(Cs)",  0, 0,
> match_opcode, 0 },
> -{"cl",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(Cs)",  0, 0,
> match_opcode, 0 },
> -{"cl",      0, INSN_CLASS_F_AND_C, "O2,CF3,Ct,C5(CS)",  0, 0,
> match_opcode, 0 },
> -{"cl",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(CS)",  0, 0,
> match_opcode, 0 },
> -
> -{"cs",      0, INSN_CLASS_C,       "O2,CF3,Ct,C5(Cs)",  0, 0,
> match_opcode, 0 },
> -{"cs",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(Cs)",  0, 0,
> match_opcode, 0 },
> -{"cs",      0, INSN_CLASS_F_AND_C, "O2,CF3,Ct,C5(CS)",  0, 0,
> match_opcode, 0 },
> -{"cs",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(CS)",  0, 0,
> match_opcode, 0 },
> -
> -{"ca",      0, INSN_CLASS_C,       "O2,CF6,CF2,Cs,Ct",  0, 0,
> match_opcode, 0 },
> -{"ca",      0, INSN_CLASS_F_AND_C, "O2,CF6,CF2,CS,Ct",  0, 0,
> match_opcode, 0 },
> -{"ca",      0, INSN_CLASS_F_AND_C, "O2,CF6,CF2,Cs,CD",  0, 0,
> match_opcode, 0 },
> -{"ca",      0, INSN_CLASS_F_AND_C, "O2,CF6,CF2,CS,CD",  0, 0,
> match_opcode, 0 },
> +{"r",       0, INSN_CLASS_I,       "O4,F3,F7,d,s,t",    0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,s,t",    0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F7,d,S,t",    0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,S,t",    0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F7,d,s,T",    0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,s,T",    0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F7,d,S,T",    0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,S,T",    0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_I,       "O4,F3,F2,d,s,t,r",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,r",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,r",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,r",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,r",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,r",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,r",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,r",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,s,t,R",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,R",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,R",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,R",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,R",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,R",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,R",  0, 0, NULL, 0 },
> +{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,R",  0, 0, NULL, 0 },
> +
> +{"r4",      0, INSN_CLASS_I,       "O4,F3,F2,d,s,t,r",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,r",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,r",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,r",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,r",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,r",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,r",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,r",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,s,t,R",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,R",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,R",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,R",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,R",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,R",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,R",  0, 0, NULL, 0 },
> +{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,R",  0, 0, NULL, 0 },
> +
> +{"i",       0, INSN_CLASS_I,       "O4,F3,d,s,j",       0, 0, NULL, 0 },
> +{"i",       0, INSN_CLASS_F,       "O4,F3,D,s,j",       0, 0, NULL, 0 },
> +{"i",       0, INSN_CLASS_F,       "O4,F3,d,S,j",       0, 0, NULL, 0 },
> +{"i",       0, INSN_CLASS_F,       "O4,F3,D,S,j",       0, 0, NULL, 0 },
> +{"i",       0, INSN_CLASS_I,       "O4,F3,d,o(s)",      0, 0, NULL, 0 },
> +{"i",       0, INSN_CLASS_F,       "O4,F3,D,o(s)",      0, 0, NULL, 0 },
> +
> +{"s",       0, INSN_CLASS_I,       "O4,F3,t,q(s)",      0, 0, NULL, 0 },
> +{"s",       0, INSN_CLASS_F,       "O4,F3,T,q(s)",      0, 0, NULL, 0 },
> +
> +{"sb",      0, INSN_CLASS_I,       "O4,F3,s,t,p",       0, 0, NULL, 0 },
> +{"sb",      0, INSN_CLASS_F,       "O4,F3,S,t,p",       0, 0, NULL, 0 },
> +{"sb",      0, INSN_CLASS_F,       "O4,F3,s,T,p",       0, 0, NULL, 0 },
> +{"sb",      0, INSN_CLASS_F,       "O4,F3,S,T,p",       0, 0, NULL, 0 },
> +{"b",       0, INSN_CLASS_I,       "O4,F3,s,t,p",       0, 0, NULL, 0 },
> +{"b",       0, INSN_CLASS_F,       "O4,F3,S,t,p",       0, 0, NULL, 0 },
> +{"b",       0, INSN_CLASS_F,       "O4,F3,s,T,p",       0, 0, NULL, 0 },
> +{"b",       0, INSN_CLASS_F,       "O4,F3,S,T,p",       0, 0, NULL, 0 },
> +
> +{"u",       0, INSN_CLASS_I,       "O4,d,u",            0, 0, NULL, 0 },
> +{"u",       0, INSN_CLASS_F,       "O4,D,u",            0, 0, NULL, 0 },
> +
> +{"uj",      0, INSN_CLASS_I,       "O4,d,a",            0, 0, NULL, 0 },
> +{"uj",      0, INSN_CLASS_F,       "O4,D,a",            0, 0, NULL, 0 },
> +{"j",       0, INSN_CLASS_I,       "O4,d,a",            0, 0, NULL, 0 },
> +{"j",       0, INSN_CLASS_F,       "O4,D,a",            0, 0, NULL, 0 },
> +
> +{"cr",      0, INSN_CLASS_C,       "O2,CF4,d,CV",       0, 0, NULL, 0 },
> +{"cr",      0, INSN_CLASS_F_AND_C, "O2,CF4,D,CV",       0, 0, NULL, 0 },
> +{"cr",      0, INSN_CLASS_F_AND_C, "O2,CF4,d,CT",       0, 0, NULL, 0 },
> +{"cr",      0, INSN_CLASS_F_AND_C, "O2,CF4,D,CT",       0, 0, NULL, 0 },
> +
> +{"ci",      0, INSN_CLASS_C,       "O2,CF3,d,Co",       0, 0, NULL, 0 },
> +{"ci",      0, INSN_CLASS_F_AND_C, "O2,CF3,D,Co",       0, 0, NULL, 0 },
> +
> +{"ciw",     0, INSN_CLASS_C,       "O2,CF3,Ct,C8",      0, 0, NULL, 0 },
> +{"ciw",     0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C8",      0, 0, NULL, 0 },
> +
> +{"css",     0, INSN_CLASS_C,       "O2,CF3,CV,C6",      0, 0, NULL, 0 },
> +{"css",     0, INSN_CLASS_F_AND_C, "O2,CF3,CT,C6",      0, 0, NULL, 0 },
> +
> +{"cl",      0, INSN_CLASS_C,       "O2,CF3,Ct,C5(Cs)",  0, 0, NULL, 0 },
> +{"cl",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(Cs)",  0, 0, NULL, 0 },
> +{"cl",      0, INSN_CLASS_F_AND_C, "O2,CF3,Ct,C5(CS)",  0, 0, NULL, 0 },
> +{"cl",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(CS)",  0, 0, NULL, 0 },
> +
> +{"cs",      0, INSN_CLASS_C,       "O2,CF3,Ct,C5(Cs)",  0, 0, NULL, 0 },
> +{"cs",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(Cs)",  0, 0, NULL, 0 },
> +{"cs",      0, INSN_CLASS_F_AND_C, "O2,CF3,Ct,C5(CS)",  0, 0, NULL, 0 },
> +{"cs",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(CS)",  0, 0, NULL, 0 },
> +
> +{"ca",      0, INSN_CLASS_C,       "O2,CF6,CF2,Cs,Ct",  0, 0, NULL, 0 },
> +{"ca",      0, INSN_CLASS_F_AND_C, "O2,CF6,CF2,CS,Ct",  0, 0, NULL, 0 },
> +{"ca",      0, INSN_CLASS_F_AND_C, "O2,CF6,CF2,Cs,CD",  0, 0, NULL, 0 },
> +{"ca",      0, INSN_CLASS_F_AND_C, "O2,CF6,CF2,CS,CD",  0, 0, NULL, 0 },
>
> -{"cb",      0, INSN_CLASS_C,       "O2,CF3,Cs,Cp",      0, 0,
> match_opcode, 0 },
> -{"cb",      0, INSN_CLASS_F_AND_C, "O2,CF3,CS,Cp",      0, 0,
> match_opcode, 0 },
> +{"cb",      0, INSN_CLASS_C,       "O2,CF3,Cs,Cp",      0, 0, NULL, 0 },
> +{"cb",      0, INSN_CLASS_F_AND_C, "O2,CF3,CS,Cp",      0, 0, NULL, 0 },
>
> -{"cj",      0, INSN_CLASS_C,       "O2,CF3,Ca",         0, 0,
> match_opcode, 0 },
> +{"cj",      0, INSN_CLASS_C,       "O2,CF3,Ca",         0, 0, NULL, 0 },
>
>  /* Terminate the list.  */
>  {0, 0, INSN_CLASS_NONE, 0, 0, 0, 0, 0}
>
  

Patch

--- a/opcodes/riscv-opc.c
+++ b/opcodes/riscv-opc.c
@@ -3132,108 +3132,108 @@  const struct riscv_opcode riscv_opcodes[
 const struct riscv_opcode riscv_insn_types[] =
 {
 /* name, xlen, isa, operands, match, mask, match_func, pinfo.  */
-{"r",       0, INSN_CLASS_I,       "O4,F3,F7,d,s,t",    0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,s,t",    0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F7,d,S,t",    0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,S,t",    0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F7,d,s,T",    0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,s,T",    0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F7,d,S,T",    0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,S,T",    0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_I,       "O4,F3,F2,d,s,t,r",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,r",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,r",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,r",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,r",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,r",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,r",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,r",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,s,t,R",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,R",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,R",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,R",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,R",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,R",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,R",  0, 0, match_opcode, 0 },
-{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,R",  0, 0, match_opcode, 0 },
-
-{"r4",      0, INSN_CLASS_I,       "O4,F3,F2,d,s,t,r",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,r",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,r",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,r",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,r",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,r",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,r",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,r",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,s,t,R",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,R",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,R",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,R",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,R",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,R",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,R",  0, 0, match_opcode, 0 },
-{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,R",  0, 0, match_opcode, 0 },
-
-{"i",       0, INSN_CLASS_I,       "O4,F3,d,s,j",       0, 0, match_opcode, 0 },
-{"i",       0, INSN_CLASS_F,       "O4,F3,D,s,j",       0, 0, match_opcode, 0 },
-{"i",       0, INSN_CLASS_F,       "O4,F3,d,S,j",       0, 0, match_opcode, 0 },
-{"i",       0, INSN_CLASS_F,       "O4,F3,D,S,j",       0, 0, match_opcode, 0 },
-{"i",       0, INSN_CLASS_I,       "O4,F3,d,o(s)",      0, 0, match_opcode, 0 },
-{"i",       0, INSN_CLASS_F,       "O4,F3,D,o(s)",      0, 0, match_opcode, 0 },
-
-{"s",       0, INSN_CLASS_I,       "O4,F3,t,q(s)",      0, 0, match_opcode, 0 },
-{"s",       0, INSN_CLASS_F,       "O4,F3,T,q(s)",      0, 0, match_opcode, 0 },
-
-{"sb",      0, INSN_CLASS_I,       "O4,F3,s,t,p",       0, 0, match_opcode, 0 },
-{"sb",      0, INSN_CLASS_F,       "O4,F3,S,t,p",       0, 0, match_opcode, 0 },
-{"sb",      0, INSN_CLASS_F,       "O4,F3,s,T,p",       0, 0, match_opcode, 0 },
-{"sb",      0, INSN_CLASS_F,       "O4,F3,S,T,p",       0, 0, match_opcode, 0 },
-{"b",       0, INSN_CLASS_I,       "O4,F3,s,t,p",       0, 0, match_opcode, 0 },
-{"b",       0, INSN_CLASS_F,       "O4,F3,S,t,p",       0, 0, match_opcode, 0 },
-{"b",       0, INSN_CLASS_F,       "O4,F3,s,T,p",       0, 0, match_opcode, 0 },
-{"b",       0, INSN_CLASS_F,       "O4,F3,S,T,p",       0, 0, match_opcode, 0 },
-
-{"u",       0, INSN_CLASS_I,       "O4,d,u",            0, 0, match_opcode, 0 },
-{"u",       0, INSN_CLASS_F,       "O4,D,u",            0, 0, match_opcode, 0 },
-
-{"uj",      0, INSN_CLASS_I,       "O4,d,a",            0, 0, match_opcode, 0 },
-{"uj",      0, INSN_CLASS_F,       "O4,D,a",            0, 0, match_opcode, 0 },
-{"j",       0, INSN_CLASS_I,       "O4,d,a",            0, 0, match_opcode, 0 },
-{"j",       0, INSN_CLASS_F,       "O4,D,a",            0, 0, match_opcode, 0 },
-
-{"cr",      0, INSN_CLASS_C,       "O2,CF4,d,CV",       0, 0, match_opcode, 0 },
-{"cr",      0, INSN_CLASS_F_AND_C, "O2,CF4,D,CV",       0, 0, match_opcode, 0 },
-{"cr",      0, INSN_CLASS_F_AND_C, "O2,CF4,d,CT",       0, 0, match_opcode, 0 },
-{"cr",      0, INSN_CLASS_F_AND_C, "O2,CF4,D,CT",       0, 0, match_opcode, 0 },
-
-{"ci",      0, INSN_CLASS_C,       "O2,CF3,d,Co",       0, 0, match_opcode, 0 },
-{"ci",      0, INSN_CLASS_F_AND_C, "O2,CF3,D,Co",       0, 0, match_opcode, 0 },
-
-{"ciw",     0, INSN_CLASS_C,       "O2,CF3,Ct,C8",      0, 0, match_opcode, 0 },
-{"ciw",     0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C8",      0, 0, match_opcode, 0 },
-
-{"css",     0, INSN_CLASS_C,       "O2,CF3,CV,C6",      0, 0, match_opcode, 0 },
-{"css",     0, INSN_CLASS_F_AND_C, "O2,CF3,CT,C6",      0, 0, match_opcode, 0 },
-
-{"cl",      0, INSN_CLASS_C,       "O2,CF3,Ct,C5(Cs)",  0, 0, match_opcode, 0 },
-{"cl",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(Cs)",  0, 0, match_opcode, 0 },
-{"cl",      0, INSN_CLASS_F_AND_C, "O2,CF3,Ct,C5(CS)",  0, 0, match_opcode, 0 },
-{"cl",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(CS)",  0, 0, match_opcode, 0 },
-
-{"cs",      0, INSN_CLASS_C,       "O2,CF3,Ct,C5(Cs)",  0, 0, match_opcode, 0 },
-{"cs",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(Cs)",  0, 0, match_opcode, 0 },
-{"cs",      0, INSN_CLASS_F_AND_C, "O2,CF3,Ct,C5(CS)",  0, 0, match_opcode, 0 },
-{"cs",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(CS)",  0, 0, match_opcode, 0 },
-
-{"ca",      0, INSN_CLASS_C,       "O2,CF6,CF2,Cs,Ct",  0, 0, match_opcode, 0 },
-{"ca",      0, INSN_CLASS_F_AND_C, "O2,CF6,CF2,CS,Ct",  0, 0, match_opcode, 0 },
-{"ca",      0, INSN_CLASS_F_AND_C, "O2,CF6,CF2,Cs,CD",  0, 0, match_opcode, 0 },
-{"ca",      0, INSN_CLASS_F_AND_C, "O2,CF6,CF2,CS,CD",  0, 0, match_opcode, 0 },
+{"r",       0, INSN_CLASS_I,       "O4,F3,F7,d,s,t",    0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,s,t",    0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F7,d,S,t",    0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,S,t",    0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F7,d,s,T",    0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,s,T",    0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F7,d,S,T",    0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F7,D,S,T",    0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_I,       "O4,F3,F2,d,s,t,r",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,r",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,r",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,r",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,r",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,r",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,r",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,r",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,s,t,R",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,R",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,R",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,R",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,R",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,R",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,R",  0, 0, NULL, 0 },
+{"r",       0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,R",  0, 0, NULL, 0 },
+
+{"r4",      0, INSN_CLASS_I,       "O4,F3,F2,d,s,t,r",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,r",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,r",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,r",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,r",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,r",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,r",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,r",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,s,t,R",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,t,R",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,t,R",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,t,R",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,s,T,R",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,s,T,R",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,d,S,T,R",  0, 0, NULL, 0 },
+{"r4",      0, INSN_CLASS_F,       "O4,F3,F2,D,S,T,R",  0, 0, NULL, 0 },
+
+{"i",       0, INSN_CLASS_I,       "O4,F3,d,s,j",       0, 0, NULL, 0 },
+{"i",       0, INSN_CLASS_F,       "O4,F3,D,s,j",       0, 0, NULL, 0 },
+{"i",       0, INSN_CLASS_F,       "O4,F3,d,S,j",       0, 0, NULL, 0 },
+{"i",       0, INSN_CLASS_F,       "O4,F3,D,S,j",       0, 0, NULL, 0 },
+{"i",       0, INSN_CLASS_I,       "O4,F3,d,o(s)",      0, 0, NULL, 0 },
+{"i",       0, INSN_CLASS_F,       "O4,F3,D,o(s)",      0, 0, NULL, 0 },
+
+{"s",       0, INSN_CLASS_I,       "O4,F3,t,q(s)",      0, 0, NULL, 0 },
+{"s",       0, INSN_CLASS_F,       "O4,F3,T,q(s)",      0, 0, NULL, 0 },
+
+{"sb",      0, INSN_CLASS_I,       "O4,F3,s,t,p",       0, 0, NULL, 0 },
+{"sb",      0, INSN_CLASS_F,       "O4,F3,S,t,p",       0, 0, NULL, 0 },
+{"sb",      0, INSN_CLASS_F,       "O4,F3,s,T,p",       0, 0, NULL, 0 },
+{"sb",      0, INSN_CLASS_F,       "O4,F3,S,T,p",       0, 0, NULL, 0 },
+{"b",       0, INSN_CLASS_I,       "O4,F3,s,t,p",       0, 0, NULL, 0 },
+{"b",       0, INSN_CLASS_F,       "O4,F3,S,t,p",       0, 0, NULL, 0 },
+{"b",       0, INSN_CLASS_F,       "O4,F3,s,T,p",       0, 0, NULL, 0 },
+{"b",       0, INSN_CLASS_F,       "O4,F3,S,T,p",       0, 0, NULL, 0 },
+
+{"u",       0, INSN_CLASS_I,       "O4,d,u",            0, 0, NULL, 0 },
+{"u",       0, INSN_CLASS_F,       "O4,D,u",            0, 0, NULL, 0 },
+
+{"uj",      0, INSN_CLASS_I,       "O4,d,a",            0, 0, NULL, 0 },
+{"uj",      0, INSN_CLASS_F,       "O4,D,a",            0, 0, NULL, 0 },
+{"j",       0, INSN_CLASS_I,       "O4,d,a",            0, 0, NULL, 0 },
+{"j",       0, INSN_CLASS_F,       "O4,D,a",            0, 0, NULL, 0 },
+
+{"cr",      0, INSN_CLASS_C,       "O2,CF4,d,CV",       0, 0, NULL, 0 },
+{"cr",      0, INSN_CLASS_F_AND_C, "O2,CF4,D,CV",       0, 0, NULL, 0 },
+{"cr",      0, INSN_CLASS_F_AND_C, "O2,CF4,d,CT",       0, 0, NULL, 0 },
+{"cr",      0, INSN_CLASS_F_AND_C, "O2,CF4,D,CT",       0, 0, NULL, 0 },
+
+{"ci",      0, INSN_CLASS_C,       "O2,CF3,d,Co",       0, 0, NULL, 0 },
+{"ci",      0, INSN_CLASS_F_AND_C, "O2,CF3,D,Co",       0, 0, NULL, 0 },
+
+{"ciw",     0, INSN_CLASS_C,       "O2,CF3,Ct,C8",      0, 0, NULL, 0 },
+{"ciw",     0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C8",      0, 0, NULL, 0 },
+
+{"css",     0, INSN_CLASS_C,       "O2,CF3,CV,C6",      0, 0, NULL, 0 },
+{"css",     0, INSN_CLASS_F_AND_C, "O2,CF3,CT,C6",      0, 0, NULL, 0 },
+
+{"cl",      0, INSN_CLASS_C,       "O2,CF3,Ct,C5(Cs)",  0, 0, NULL, 0 },
+{"cl",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(Cs)",  0, 0, NULL, 0 },
+{"cl",      0, INSN_CLASS_F_AND_C, "O2,CF3,Ct,C5(CS)",  0, 0, NULL, 0 },
+{"cl",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(CS)",  0, 0, NULL, 0 },
+
+{"cs",      0, INSN_CLASS_C,       "O2,CF3,Ct,C5(Cs)",  0, 0, NULL, 0 },
+{"cs",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(Cs)",  0, 0, NULL, 0 },
+{"cs",      0, INSN_CLASS_F_AND_C, "O2,CF3,Ct,C5(CS)",  0, 0, NULL, 0 },
+{"cs",      0, INSN_CLASS_F_AND_C, "O2,CF3,CD,C5(CS)",  0, 0, NULL, 0 },
+
+{"ca",      0, INSN_CLASS_C,       "O2,CF6,CF2,Cs,Ct",  0, 0, NULL, 0 },
+{"ca",      0, INSN_CLASS_F_AND_C, "O2,CF6,CF2,CS,Ct",  0, 0, NULL, 0 },
+{"ca",      0, INSN_CLASS_F_AND_C, "O2,CF6,CF2,Cs,CD",  0, 0, NULL, 0 },
+{"ca",      0, INSN_CLASS_F_AND_C, "O2,CF6,CF2,CS,CD",  0, 0, NULL, 0 },
 
-{"cb",      0, INSN_CLASS_C,       "O2,CF3,Cs,Cp",      0, 0, match_opcode, 0 },
-{"cb",      0, INSN_CLASS_F_AND_C, "O2,CF3,CS,Cp",      0, 0, match_opcode, 0 },
+{"cb",      0, INSN_CLASS_C,       "O2,CF3,Cs,Cp",      0, 0, NULL, 0 },
+{"cb",      0, INSN_CLASS_F_AND_C, "O2,CF3,CS,Cp",      0, 0, NULL, 0 },
 
-{"cj",      0, INSN_CLASS_C,       "O2,CF3,Ca",         0, 0, match_opcode, 0 },
+{"cj",      0, INSN_CLASS_C,       "O2,CF3,Ca",         0, 0, NULL, 0 },
 
 /* Terminate the list.  */
 {0, 0, INSN_CLASS_NONE, 0, 0, 0, 0, 0}