Thanks kito. It makes sense, should not reach default, may I prepare v3(add gcc_unreachable to default) if no more comments?
Pan -----Original Message----- From: Kito Cheng <kito.ch...@gmail.com> Sent: Thursday, August 10, 2023 10:12 AM To: Li, Pan2 <pan2...@intel.com> Cc: gcc-patches@gcc.gnu.org; juzhe.zh...@rivai.ai; jeffreya...@gmail.com; Wang, Yanzhang <yanzhang.w...@intel.com>; Kito Cheng <kito.ch...@sifive.com> Subject: Re: [PATCH v2] RISC-V: Refactor RVV frm_mode attr for rounding mode intrinsic > +/* Get the frm mode with given CONST_INT rtx, the default mode is > + FRM_DYN. */ > +enum floating_point_rounding_mode > +get_frm_mode (rtx operand) > +{ > + gcc_assert (CONST_INT_P (operand)); > + > + switch (INTVAL (operand)) > + { > + case FRM_RNE: > + return FRM_RNE; > + case FRM_RTZ: > + return FRM_RTZ; > + case FRM_RDN: > + return FRM_RDN; > + case FRM_RUP: > + return FRM_RUP; > + case FRM_RMM: > + return FRM_RMM; > + case FRM_DYN: > + return FRM_DYN; > + default: > + return FRM_DYN; Should we put a gcc_unreachable or gcc_assert here? I am not sure if another value is valid when it appeared for this operand? > + } > + > + gcc_unreachable (); > +}