RISC-V: Added half-precision floating-point v1.0 instructions.

bfd/
	* elfxx-riscv.c (riscv_implicit_subsets): Added implicit f
	and zicsr for zfh.
	(riscv_supported_std_z_ext): Added default v1.0 version for zfh.
	(riscv_multi_subset_supports): Handle INSN_CLASS_ZFH,
	INSN_CLASS_D_AND_ZFH and INSN_CLASS_Q_AND_ZFH.
gas/
	* config/tc-riscv.c (FLT_CHARS): Added "hH".
	(macro): Expand Pseudo M_FLH and M_FSH.
	(riscv_pseudo_table): Added .float16 directive.
	* testsuite/gas/riscv/float16-be.d: New testcase for .float16.
	* testsuite/gas/riscv/float16-le.d: Likewise.
	* testsuite/gas/riscv/float16.s: Likewise.
	* testsuite/gas/riscv/fp-zfh-insns.d: New testcase for zfh.
	* testsuite/gas/riscv/fp-zfh-insns.s: Likewise.
include/
	* opcode/riscv-opc.h: Added MASK and MATCH encodings for zfh.
	* opcode/riscv.h: Added INSN_CLASS and pseudo macros for zfh.
opcodes/
	* riscv-opc.c (riscv_opcodes): Added zfh instructions.
This commit is contained in:
Nelson Chu
2020-03-26 18:38:27 +08:00
parent 626d0e40e5
commit 035784e345
10 changed files with 344 additions and 1 deletions

View File

@ -705,6 +705,78 @@
#define MASK_AES64DSM 0xfe00707f
#define MATCH_AES64DS 0x3a000033
#define MASK_AES64DS 0xfe00707f
#define MATCH_FADD_H 0x4000053
#define MASK_FADD_H 0xfe00007f
#define MATCH_FSUB_H 0xc000053
#define MASK_FSUB_H 0xfe00007f
#define MATCH_FMUL_H 0x14000053
#define MASK_FMUL_H 0xfe00007f
#define MATCH_FDIV_H 0x1c000053
#define MASK_FDIV_H 0xfe00007f
#define MATCH_FSGNJ_H 0x24000053
#define MASK_FSGNJ_H 0xfe00707f
#define MATCH_FSGNJN_H 0x24001053
#define MASK_FSGNJN_H 0xfe00707f
#define MATCH_FSGNJX_H 0x24002053
#define MASK_FSGNJX_H 0xfe00707f
#define MATCH_FMIN_H 0x2c000053
#define MASK_FMIN_H 0xfe00707f
#define MATCH_FMAX_H 0x2c001053
#define MASK_FMAX_H 0xfe00707f
#define MATCH_FCVT_H_S 0x44000053
#define MASK_FCVT_H_S 0xfff0007f
#define MATCH_FCVT_S_H 0x40200053
#define MASK_FCVT_S_H 0xfff0007f
#define MATCH_FSQRT_H 0x5c000053
#define MASK_FSQRT_H 0xfff0007f
#define MATCH_FLE_H 0xa4000053
#define MASK_FLE_H 0xfe00707f
#define MATCH_FLT_H 0xa4001053
#define MASK_FLT_H 0xfe00707f
#define MATCH_FEQ_H 0xa4002053
#define MASK_FEQ_H 0xfe00707f
#define MATCH_FCVT_W_H 0xc4000053
#define MASK_FCVT_W_H 0xfff0007f
#define MATCH_FCVT_WU_H 0xc4100053
#define MASK_FCVT_WU_H 0xfff0007f
#define MATCH_FMV_X_H 0xe4000053
#define MASK_FMV_X_H 0xfff0707f
#define MATCH_FCLASS_H 0xe4001053
#define MASK_FCLASS_H 0xfff0707f
#define MATCH_FCVT_H_W 0xd4000053
#define MASK_FCVT_H_W 0xfff0007f
#define MATCH_FCVT_H_WU 0xd4100053
#define MASK_FCVT_H_WU 0xfff0007f
#define MATCH_FMV_H_X 0xf4000053
#define MASK_FMV_H_X 0xfff0707f
#define MATCH_FLH 0x1007
#define MASK_FLH 0x707f
#define MATCH_FSH 0x1027
#define MASK_FSH 0x707f
#define MATCH_FMADD_H 0x4000043
#define MASK_FMADD_H 0x600007f
#define MATCH_FMSUB_H 0x4000047
#define MASK_FMSUB_H 0x600007f
#define MATCH_FNMSUB_H 0x400004b
#define MASK_FNMSUB_H 0x600007f
#define MATCH_FNMADD_H 0x400004f
#define MASK_FNMADD_H 0x600007f
#define MATCH_FCVT_H_D 0x44100053
#define MASK_FCVT_H_D 0xfff0007f
#define MATCH_FCVT_D_H 0x42200053
#define MASK_FCVT_D_H 0xfff0007f
#define MATCH_FCVT_H_Q 0x44300053
#define MASK_FCVT_H_Q 0xfff0007f
#define MATCH_FCVT_Q_H 0x46200053
#define MASK_FCVT_Q_H 0xfff0007f
#define MATCH_FCVT_L_H 0xc4200053
#define MASK_FCVT_L_H 0xfff0007f
#define MATCH_FCVT_LU_H 0xc4300053
#define MASK_FCVT_LU_H 0xfff0007f
#define MATCH_FCVT_H_L 0xd4200053
#define MASK_FCVT_H_L 0xfff0007f
#define MATCH_FCVT_H_LU 0xd4300053
#define MASK_FCVT_H_LU 0xfff0007f
#define MATCH_VSETVL 0x80007057
#define MASK_VSETVL 0xfe00707f
#define MATCH_VSETIVLI 0xc0007057

View File

@ -370,6 +370,9 @@ enum riscv_insn_class
INSN_CLASS_F_OR_ZFINX,
INSN_CLASS_D_OR_ZDINX,
INSN_CLASS_Q_OR_ZQINX,
INSN_CLASS_ZFH,
INSN_CLASS_D_AND_ZFH,
INSN_CLASS_Q_AND_ZFH,
INSN_CLASS_ZBA,
INSN_CLASS_ZBB,
INSN_CLASS_ZBC,
@ -498,6 +501,8 @@ enum
M_SEXTH,
M_VMSGE,
M_VMSGEU,
M_FLH,
M_FSH,
M_NUM_MACROS
};