[Committed] RISC-V: Enable Hoist to GCSE simple constants

2023-08-25 Thread Vineet Gupta
Hoist want_to_gcse_p () calls rtx_cost () to compute max distance for hoist candidates. For a simple const (say 6 which needs seperate insn "LI 6") backend currently returns 0, causing Hoist to bail and elide GCSE. Note that constants requiring more than 1 insns to setup were working fine since ri

Re: [PATCH v2] RISC-V: Enable Hoist to GCSE simple constants

2023-08-25 Thread Jeff Law via Gcc-patches
On 8/24/23 23:16, Vineet Gupta wrote: Hoist want_to_gcse_p () calls rtx_cost () to compute max distance for hoist candidates. For a simple const (say 6 which needs seperate insn "LI 6") backend currently returns 0, causing Hoist to bail and elide GCSE. Note that constants requiring more than

[PATCH v2] RISC-V: Enable Hoist to GCSE simple constants

2023-08-24 Thread Vineet Gupta
Hoist want_to_gcse_p () calls rtx_cost () to compute max distance for hoist candidates. For a simple const (say 6 which needs seperate insn "LI 6") backend currently returns 0, causing Hoist to bail and elide GCSE. Note that constants requiring more than 1 insns to setup were working fine since ri

Re: [PATCH] RISC-V: Enable Hoist to GCSE simple constants

2023-08-24 Thread Jeff Law via Gcc-patches
On 8/23/23 18:42, Vineet Gupta wrote: Seriously, I detest it too, but the irony is I've now made my 2nd change in there and keep adding to ugliness :-( Happens to all of us sometimes. So I think your change makes sense.   But I think it can be refined to simplify the larger chunk of

Re: [PATCH] RISC-V: Enable Hoist to GCSE simple constants

2023-08-23 Thread Vineet Gupta
On 8/23/23 13:04, Jeff Law wrote: Thanks for your patience on this.  I needed a bit of time to gather my thoughts and review some code. No worries at all. index 8b7256108157..1802eef908fc 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -2464,14 +2464,9 @@ riscv_rtx

Re: [PATCH] RISC-V: Enable Hoist to GCSE simple constants

2023-08-23 Thread Jeff Law via Gcc-patches
On 8/9/23 18:30, Vineet Gupta wrote: Hoist want_to_gcse_p () calls rtx_cost () to compute max distance for hoist candidates . For a const with cost 1 backend currently returns 0, causing Hoist to bail and elide GCSE. Note that constants requiring more than 1 insns to setup were working alread

RISC-V: Enable Hoist to GCSE simple constants

2023-08-09 Thread juzhe.zh...@rivai.ai
-/* { dg-final { scan-assembler-times {j\s+\.L[0-9]+\s+\.L[0-9]+:\s+vlm\.v} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" } } } } */ +/* { dg-final { scan-assembler-times {j\s+\.L[0-9]+\s+\.L[0-9]+:\s+vlm\.v} 1 { target { no-opts "-O

[PATCH] RISC-V: Enable Hoist to GCSE simple constants

2023-08-09 Thread Vineet Gupta
Hoist want_to_gcse_p () calls rtx_cost () to compute max distance for hoist candidates . For a const with cost 1 backend currently returns 0, causing Hoist to bail and elide GCSE. Note that constants requiring more than 1 insns to setup were working already since backend is returning 1 as well. Ar