Skip to content
Snippets Groups Projects
Commit 4cede0de authored by Pan Li's avatar Pan Li
Browse files

RISC-V: Refactor RVV frm_mode attr for rounding mode intrinsic


The frm_mode attr has some assumptions for each define insn as below.

1. The define insn has at least 9 operands.
2. The operands[9] must be frm reg.
3. The operands[9] must be const int.

Actually, the frm operand can be operands[8], operands[9] or
operands[10], and not all the define insn has frm operands.

This patch would like to refactor frm and eliminate the above
assumptions, as well as unblock the underlying rounding mode intrinsic
API support.

After refactor, the default frm will be none, and the selected insn type
will be dyn. For the floating point which honors the frm, we will
set the frm_mode attr explicitly in define_insn.

Signed-off-by: default avatarPan Li <pan2.li@intel.com>
Co-Authored-by: default avatarKito Cheng <kito.cheng@sifive.com>

gcc/ChangeLog:

	* config/riscv/riscv-protos.h
	(enum floating_point_rounding_mode): Add NONE, DYN_EXIT and DYN_CALL.
	(get_frm_mode): New declaration.
	* config/riscv/riscv-v.cc (get_frm_mode): New function to get frm mode.
	* config/riscv/riscv-vector-builtins.cc
	(function_expander::use_ternop_insn): Take care of frm reg.
	* config/riscv/riscv.cc (riscv_static_frm_mode_p): Migrate to FRM_XXX.
	(riscv_emit_frm_mode_set): Ditto.
	(riscv_emit_mode_set): Ditto.
	(riscv_frm_adjust_mode_after_call): Ditto.
	(riscv_frm_mode_needed): Ditto.
	(riscv_frm_mode_after): Ditto.
	(riscv_mode_entry): Ditto.
	(riscv_mode_exit): Ditto.
	* config/riscv/riscv.h (NUM_MODES_FOR_MODE_SWITCHING): Ditto.
	* config/riscv/vector.md
	(rne,rtz,rdn,rup,rmm,dyn,dyn_exit,dyn_call,none): Removed
	(symbol_ref): * config/riscv/vector.md: Set frm_mode attr explicitly.
parent 9b099a83
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment