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

[RyuJIT][arm64] Optimize "x<0" and "x>=0" #43440

Closed
EgorBo opened this issue Oct 15, 2020 · 1 comment
Closed

[RyuJIT][arm64] Optimize "x<0" and "x>=0" #43440

EgorBo opened this issue Oct 15, 2020 · 1 comment
Assignees
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI tenet-performance Performance related issue
Milestone

Comments

@EgorBo
Copy link
Member

EgorBo commented Oct 15, 2020

There are two cases:

Case1:

static bool Case1(int x) => x < 0; // probably also `x >= 0`

current codegen:

    cmp     w0, #0
    cset    x0, lt

expected codegen:

    lsr     x0, w0, #31

x86-related PR: #35627

Case2 (jump condition):

static void Case2(int a)
{
    if (a < 0) // and "a >= 0"
        Foo();
}

current codegen:

    cmp     w0, #0
    bge     G_M29168_IG04

expected codegen:

    tbnz    w0, #31, G_M29168_IG04

NOTE: for the second case we already have an optimization for x==0 -> tb(n)z so should be easy to extend.

/cc @kunalspathak @echesakovMSFT

category:cq
theme:codegen
skill-level:intermediate
cost:medium
impact:medium

@EgorBo EgorBo added the tenet-performance Performance related issue label Oct 15, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-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 Oct 15, 2020
@JulieLeeMSFT JulieLeeMSFT removed the untriaged New issue has not been triaged by the area owner label Oct 16, 2020
@JulieLeeMSFT JulieLeeMSFT added this to the Future milestone Oct 16, 2020
@echesakov
Copy link
Contributor

Thanks @EgorBo for opening this. I will add the optimizations to .NET 6 Arm64 "Epic" issue I am working right now as a potential work in .NET 6.

@BruceForstall BruceForstall added arch-arm64 JitUntriaged CLR JIT issues needing additional triage and removed arch-arm64 labels Oct 23, 2020
@BruceForstall BruceForstall added arch-arm64 and removed JitUntriaged CLR JIT issues needing additional triage labels Nov 7, 2020
@TIHan TIHan self-assigned this Oct 31, 2022
@TIHan TIHan modified the milestones: Future, 8.0.0 Jan 17, 2023
@TIHan TIHan closed this as completed Mar 17, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Apr 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

6 participants