https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121019
Bug ID: 121019 Summary: Explore removal of DI patterns for rv32 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: law at gcc dot gnu.org Target Milestone: --- rv32 has 32bit GPRs, yet the port defines DI patterns. In the past that was commonplace to improve performance, but it can sometimes be harmful. So the goal is to evaluate if removing the DI mode patterns for rv32 would be helpful in general and to address any regressions arising as a result. The testcase that motivated me to dive into this problem is: void bar (long long); long long foo(int x0, int x1, int x2, int x3, int x4, int x5, int x6,long long partial) { return partial; } We get something like this: addi sp,sp,-16 sw a7,12(sp) lw a0,12(sp) lw a1,16(sp) addi sp,sp,16 jr ra The DI mode operation hides the underlying operations from CSE and as a result CSE is unable to clean things up, particularly memory operations involving @12(sp). Better code would be: addi sp,sp,-16 # 31 [c=4 l=4] *addsi3/1 lw a1,16(sp) # 23 [c=28 l=4] *movsi_internal/2 mv a0,a7 # 28 [c=4 l=4] *movsi_internal/0 addi sp,sp,16 # 35 [c=4 l=4] *addsi3/1 jr ra # 36 [c=0 l=4] simple_return_internal