https://gcc.gnu.org/g:ac0fea67b9591197a3f21dd4fb924d87cc559e7e
commit r16-1288-gac0fea67b9591197a3f21dd4fb924d87cc559e7e Author: Vineet Gupta <vine...@rivosinc.com> Date: Sun Jun 8 14:44:29 2025 -0700 RISC-V: frm/mode-switch: remove TARGET_MODE_CONFLUENCE This is effectively reverting e5d1f538bb7d "(RISC-V: Allow different dynamic floating point mode to be merged)" while retaining the testcase. The change itself is valid, however it obfuscates the deficiencies in current frm mode switching code. Also for a SPEC2017 -Ofast -march=rv64gcv build, it ends up generating net more FRM restores (writes) vs. the rest of this changeset. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_dynamic_frm_mode_p): Remove. (riscv_mode_confluence): Ditto. (TARGET_MODE_CONFLUENCE): Ditto. Signed-off-by: Vineet Gupta <vine...@rivosinc.com> Diff: --- gcc/config/riscv/riscv.cc | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index aa8cd97b3102..d032578f19a4 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -12485,41 +12485,6 @@ riscv_mode_needed (int entity, rtx_insn *insn, HARD_REG_SET) } } -/* Return TRUE if the rouding mode is dynamic. */ - -static bool -riscv_dynamic_frm_mode_p (int mode) -{ - return mode == riscv_vector::FRM_DYN - || mode == riscv_vector::FRM_DYN_CALL - || mode == riscv_vector::FRM_DYN_EXIT; -} - -/* Implement TARGET_MODE_CONFLUENCE. */ - -static int -riscv_mode_confluence (int entity, int mode1, int mode2) -{ - switch (entity) - { - case RISCV_VXRM: - return VXRM_MODE_NONE; - case RISCV_FRM: - { - /* FRM_DYN, FRM_DYN_CALL and FRM_DYN_EXIT are all compatible. - Although we already try to set the mode needed to FRM_DYN after a - function call, there are still some corner cases where both FRM_DYN - and FRM_DYN_CALL may appear on incoming edges. */ - if (riscv_dynamic_frm_mode_p (mode1) - && riscv_dynamic_frm_mode_p (mode2)) - return riscv_vector::FRM_DYN; - return riscv_vector::FRM_NONE; - } - default: - gcc_unreachable (); - } -} - /* Return TRUE that an insn is asm. */ static bool @@ -15123,8 +15088,6 @@ synthesize_and (rtx operands[3]) #define TARGET_MODE_EMIT riscv_emit_mode_set #undef TARGET_MODE_NEEDED #define TARGET_MODE_NEEDED riscv_mode_needed -#undef TARGET_MODE_CONFLUENCE -#define TARGET_MODE_CONFLUENCE riscv_mode_confluence #undef TARGET_MODE_AFTER #define TARGET_MODE_AFTER riscv_mode_after #undef TARGET_MODE_ENTRY