Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArmArch codegen for empty / simple methods is not optimal #64912

Closed
am11 opened this issue Feb 7, 2022 · 3 comments
Closed

ArmArch codegen for empty / simple methods is not optimal #64912

am11 opened this issue Feb 7, 2022 · 3 comments
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI untriaged New issue has not been triaged by the area owner

Comments

@am11
Copy link
Member

am11 commented Feb 7, 2022

The codegen for empty ctor on arm/arm64 is not as optimal when compared with x64. e.g. passing --optimize to CG2 compiles this code:

class C
{
    bool Foo() => true;
}

for arm64 as:

C:.ctor():this:    ; <- this should be just "ret" ?
            stp     fp, lr, [sp,#-16]!
            mov     fp, sp
            ldp     fp, lr, [sp],#16
            ret     lr

C:Foo():bool:this:
            stp     fp, lr, [sp,#-16]!
            mov     fp, sp
            mov     w0, #1
            ldp     fp, lr, [sp],#16
            ret     lr

and x64:

C:.ctor():this:
       ret

C:Foo():bool:this:
       mov      eax, 1
       ret

Similarly for arm, interestingly, which has relatively better codegen than arm64.

codegen:
C#: https://godbolt.org/z/zPhbecqab
C: https://godbolt.org/z/cPoa4ohPo

@dotnet-issue-labeler dotnet-issue-labeler bot added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI untriaged New issue has not been triaged by the area owner labels Feb 7, 2022
@ghost
Copy link

ghost commented Feb 7, 2022

Tagging subscribers to this area: @JulieLeeMSFT
See info in area-owners.md if you want to be subscribed.

Issue Details

The codegen for empty ctor on arm/arm64 is not as optimal when compared with x64. e.g. passing --optimize to CG2 compiles this code:

class C
{
    bool Foo() => true;
}

for arm64 as:

C:.ctor():this:    ; <- this should be just "ret" ?
            stp     fp, lr, [sp,#-16]!
            mov     fp, sp
            ldp     fp, lr, [sp],#16
            ret     lr

C:Foo():bool:this:
            stp     fp, lr, [sp,#-16]!
            mov     fp, sp
            mov     w0, #1
            ldp     fp, lr, [sp],#16
            ret     lr

and x64:

C:.ctor():this:
       ret

C:Foo():bool:this:
       mov      eax, 1
       ret

Similarly for arm, interestingly, which has relatively better codegen than arm64.

codegen:
C#: https://godbolt.org/z/zPhbecqab
C: https://godbolt.org/z/cPoa4ohPo

Author: am11
Assignees: -
Labels:

area-CodeGen-coreclr, untriaged

Milestone: -

@SingleAccretion
Copy link
Contributor

Duplicate of #35274.

@am11
Copy link
Member Author

am11 commented Feb 7, 2022

Yep. Thanks!

@am11 am11 closed this as completed Feb 7, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

2 participants