[PATCH] RISCV:Create zmmul extension

Jan Beulich jbeulich@suse.com
Tue Nov 2 08:11:46 GMT 2021


On 28.10.2021 03:54, shihua@iscas.ac.cn wrote:
> --- a/include/opcode/riscv.h
> +++ b/include/opcode/riscv.h
> @@ -319,6 +319,7 @@ enum riscv_insn_class
>    INSN_CLASS_ZBA,
>    INSN_CLASS_ZBB,
>    INSN_CLASS_ZBC,
> +  INSN_CLASS_ZMMUL,

This being enumerators I don't think you can ...

> --- a/opcodes/riscv-opc.c
> +++ b/opcodes/riscv-opc.c
> @@ -489,15 +489,15 @@ const struct riscv_opcode riscv_opcodes[] =
>  {"amominu.d.aqrl", 64, INSN_CLASS_A, "d,t,0(s)", MATCH_AMOMINU_D|MASK_AQRL, MASK_AMOMINU_D|MASK_AQRL, match_opcode, INSN_DREF|INSN_8_BYTE },
>  
>  /* Multiply/Divide instruction subset.  */
> -{"mul",        0, INSN_CLASS_M,   "d,s,t",     MATCH_MUL, MASK_MUL, match_opcode, 0 },
> -{"mulh",       0, INSN_CLASS_M,   "d,s,t",     MATCH_MULH, MASK_MULH, match_opcode, 0 },
> -{"mulhu",      0, INSN_CLASS_M,   "d,s,t",     MATCH_MULHU, MASK_MULHU, match_opcode, 0 },
> -{"mulhsu",     0, INSN_CLASS_M,   "d,s,t",     MATCH_MULHSU, MASK_MULHSU, match_opcode, 0 },
> +{"mul",        0, INSN_CLASS_M || INSN_CLASS_ZMMUL,   "d,s,t",     MATCH_MUL, MASK_MUL, match_opcode, 0 },
> +{"mulh",       0, INSN_CLASS_M || INSN_CLASS_ZMMUL,   "d,s,t",     MATCH_MULH, MASK_MULH, match_opcode, 0 },
> +{"mulhu",      0, INSN_CLASS_M || INSN_CLASS_ZMMUL,   "d,s,t",     MATCH_MULHU, MASK_MULHU, match_opcode, 0 },
> +{"mulhsu",     0, INSN_CLASS_M || INSN_CLASS_ZMMUL,   "d,s,t",     MATCH_MULHSU, MASK_MULHSU, match_opcode, 0 },
>  {"div",        0, INSN_CLASS_M,   "d,s,t",     MATCH_DIV, MASK_DIV, match_opcode, 0 },
>  {"divu",       0, INSN_CLASS_M,   "d,s,t",     MATCH_DIVU, MASK_DIVU, match_opcode, 0 },
>  {"rem",        0, INSN_CLASS_M,   "d,s,t",     MATCH_REM, MASK_REM, match_opcode, 0 },
>  {"remu",       0, INSN_CLASS_M,   "d,s,t",     MATCH_REMU, MASK_REMU, match_opcode, 0 },
> -{"mulw",      64, INSN_CLASS_M,   "d,s,t",     MATCH_MULW, MASK_MULW, match_opcode, 0 },
> +{"mulw",      64, INSN_CLASS_M || INSN_CLASS_ZMMUL,   "d,s,t",     MATCH_MULW, MASK_MULW, match_opcode, 0 },

... combine them with || (or | for that matter) - you effectively produce
INSN_CLASS_I here afaict.

Jan



More information about the Binutils mailing list