Thanks Jeff and Kito for comments, update the V3 version as below.

https://gcc.gnu.org/pipermail/gcc-patches/2023-July/624347.html

> Extract vxrm reg to a local static variable to prevent construct that again 
> and again.

The "static const_rtx vxrm_rtx = gen_rtx_REG (SImode, VXRM_REGMU)" results in 
some error when selftest like below, thus patch v3 doesn't include this change.

/home/pli/repos/gcc/111/riscv-gnu-toolchain/build-gcc-newlib-stage1/./gcc/xgcc 
-B/home/pli/repos/gcc/111/riscv-gnu-toolchain/build-gcc-newlib-stage1/./gcc/  
-xc -nostdinc /dev/null -S -o /dev/null 
-fself-test=../.././gcc/gcc/testsuite/selftests
virtual memory exhausted: Invalid argument
make[2]: *** [../.././gcc/gcc/c/Make-lang.in:153: s-selftest-c] Error 1

Pan

-----Original Message-----
From: Jeff Law <jeffreya...@gmail.com> 
Sent: Wednesday, July 12, 2023 11:31 PM
To: Li, Pan2 <pan2...@intel.com>; gcc-patches@gcc.gnu.org
Cc: juzhe.zh...@rivai.ai; rdapp....@gmail.com; Wang, Yanzhang 
<yanzhang.w...@intel.com>; kito.ch...@gmail.com
Subject: Re: [PATCH v2] RISC-V: Refactor riscv mode after for VXRM and FRM



On 7/11/23 23:50, pan2...@intel.com wrote:
> From: Pan Li <pan2...@intel.com>
> 
> When investigate the FRM dynmaic rounding mode, we find the global
> unknown status is quite different between the fixed-point and
> floating-point. Thus, we separate the unknown function with extracting
> some inner common functions.
> 
> We will also prepare more test cases in another PATCH.
> 
> Signed-off-by: Pan Li <pan2...@intel.com>
> 
> gcc/ChangeLog:
> 
>       * config/riscv/riscv.cc (regnum_definition_p): New function.
>       (insn_asm_p): Ditto.
>       (riscv_vxrm_mode_after): New function for fixed-point.
>       (global_vxrm_state_unknown_p): Ditto.
>       (riscv_frm_mode_after): New function for floating-point.
>       (global_frm_state_unknown_p): Ditto.
>       (riscv_mode_after): Leverage new functions.
>       (riscv_entity_mode_after): Removed.
> ---
>   gcc/config/riscv/riscv.cc | 96 +++++++++++++++++++++++++++++++++------
>   1 file changed, 82 insertions(+), 14 deletions(-)
> 
> diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
> index 38d8eb2fcf5..553fbb4435a 100644
> --- a/gcc/config/riscv/riscv.cc
> +++ b/gcc/config/riscv/riscv.cc
> @@ -7742,19 +7742,91 @@ global_state_unknown_p (rtx_insn *insn, unsigned int 
> regno)
>     return false;
>   }
>   
> +static bool
> +regnum_definition_p (rtx_insn *insn, unsigned int regno)
Needs a function comment.  This is true for each new function added.  In 
this specific case somethign like this might be appropriate

/* Return TRUE if REGNO is set in INSN, FALSE otherwise.  */

Which begs the question, is there some reason why we're not using the 
existing reg_set_p or simple_regno_set from rtlanal.cc?



Jeff

Reply via email to