Message ID | 20240122090507.2617720-1-juzhe.zhong@rivai.ai |
---|---|
State | New |
Headers | show |
Series | RISC-V: Fix regressions due to 86de9b66480b710202a2898cf513db105d8c432f | expand |
Hi Juzhe, in principle this seems ok to me but I wonder about: > We shouldn't worry about subreg:...VL_REGNUM since it's impossible > that we can have such situation, I think we allow this in legitimize_move for situations like (subreg:SI (reg:V4QI)). That was not added for correctness but optimization - are we sure we don't undo this optimization with that change? Regards Robin
No, we didn't undo the optimization. We just disallow move pattern for (set (reg) (VL_REGNUM)). juzhe.zhong@rivai.ai From: Robin Dapp Date: 2024-01-22 19:25 To: Juzhe-Zhong; gcc-patches CC: rdapp.gcc; kito.cheng; kito.cheng; jeffreyalaw Subject: Re: [PATCH] RISC-V: Fix regressions due to 86de9b66480b710202a2898cf513db105d8c432f Hi Juzhe, in principle this seems ok to me but I wonder about: > We shouldn't worry about subreg:...VL_REGNUM since it's impossible > that we can have such situation, I think we allow this in legitimize_move for situations like (subreg:SI (reg:V4QI)). That was not added for correctness but optimization - are we sure we don't undo this optimization with that change? Regards Robin
> No, we didn't undo the optimization. > > We just disallow move pattern for (set (reg) (VL_REGNUM)). Ah, what I referred to was the opposite direction. We allow (subreg:V8QI (reg:DI ...)) which is not touched by this patch. Then it is OK. Regards Robin
diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index f8a0f7bbfac..edcaec4a786 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -1776,8 +1776,7 @@ (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" " r,m")))] "TARGET_64BIT && !TARGET_ZBA && !TARGET_XTHEADBB && !TARGET_XTHEADMEMIDX - && !(register_operand (operands[1], SImode) - && reg_or_subregno (operands[1]) == VL_REGNUM)" + && !(REG_P (operands[1]) && VL_REG_P (REGNO (operands[1])))" "@ # lwu\t%0,%1" @@ -2214,8 +2213,7 @@ (match_operand:SI 1 "move_operand" " r,T,m,rJ,*r*J,*m,*f,*f,vp"))] "(register_operand (operands[0], SImode) || reg_or_0_operand (operands[1], SImode)) - && !(register_operand (operands[1], SImode) - && reg_or_subregno (operands[1]) == VL_REGNUM)" + && !(REG_P (operands[1]) && VL_REG_P (REGNO (operands[1])))" { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "move,const,load,store,mtc,fpload,mfc,fpstore,rdvlenb") (set_attr "mode" "SI") diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr109092.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr109092.c new file mode 100644 index 00000000000..4a608da61f5 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr109092.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-mabi=lp64d -march=rv64imafdc" } */ + +void foo(int i) {}