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

stp/ldp optimization doesn't kick in for negative offsets #93382

Open
EgorBo opened this issue Oct 12, 2023 · 2 comments
Open

stp/ldp optimization doesn't kick in for negative offsets #93382

EgorBo opened this issue Oct 12, 2023 · 2 comments
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@EgorBo
Copy link
Member

EgorBo commented Oct 12, 2023

void Test(ref IntPtr ip)
{
    Unsafe.Add(ref ip, -1) = 0;
    Unsafe.Add(ref ip, -2) = 0;
    Unsafe.Add(ref ip, -3) = 0;
    Unsafe.Add(ref ip, -4) = 0;
}

Emits:

            str     xzr, [x1, #-0x08]
            str     xzr, [x1, #-0x10]
            str     xzr, [x1, #-0x18]
            str     xzr, [x1, #-0x20]

Expected:

            stp     xzr, xzr, [x1, #-0x08]
            stp     xzr, xzr, [x1, #-0x18]

Negative offsets are used e.g. in SpanHelpers.ClearWithReferences.

cc @kunalspathak @dotnet/jit-contrib

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

ghost commented Oct 12, 2023

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

Issue Details
void Test(ref IntPtr ip)
{
    Unsafe.Add(ref ip, -1) = 0;
    Unsafe.Add(ref ip, -2) = 0;
    Unsafe.Add(ref ip, -3) = 0;
    Unsafe.Add(ref ip, -4) = 0;
}

Emits:

            str     xzr, [x1, #-0x08]
            str     xzr, [x1, #-0x10]
            str     xzr, [x1, #-0x18]
            str     xzr, [x1, #-0x20]

Expected:

            stp     xzr, xzr, [x1, #-0x08]
            stp     xzr, xzr, [x1, #-0x18]

Negative offsets are used e.g. in SpanHelpers.ClearWithReferences.

cc @kunalspathak @dotnet/jit-contrib

Author: EgorBo
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@EgorBo EgorBo added this to the Future milestone Oct 12, 2023
@EgorBo EgorBo removed the untriaged New issue has not been triaged by the area owner label Oct 12, 2023
@kunalspathak
Copy link
Member

This pattern was disabled in #90700. I will check with @TIHan to get the context of why we decided to disable it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

No branches or pull requests

2 participants