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

ARM64: Use STLUR/LDUR on arm64-v8.4+ #64457

Closed
EgorBo opened this issue Jan 28, 2022 · 3 comments
Closed

ARM64: Use STLUR/LDUR on arm64-v8.4+ #64457

EgorBo opened this issue Jan 28, 2022 · 3 comments
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI help wanted [up-for-grabs] Good issue for external contributors tenet-performance Performance related issue
Milestone

Comments

@EgorBo
Copy link
Member

EgorBo commented Jan 28, 2022

As per #64354 (comment)

For cases when we need to access a field using Store-Release semantic with an offset we can do that in a single instruction stlur/ldur.

Thanks to @neon-sunset for checking it on Apple M1 (arm64 v8.5), e.g.:

class MyClass
{
public:
    std::atomic<int> x;
    std::atomic<int> y;
};

void Foo(MyClass* cls)
{
    cls->x = 42;
    cls->y = 42;
}

compiles down to:

Foo(MyClass*):
        mov     w1, 42
        stlr    w1, [x0]
        stlur   w1, [x0, 4]
        ret

while we currently emit something like:

        mov     w1, 42
        stlr    w1, [x0]
        add     x0, x0, #4
        stlr    w1, [x0]
        ret

category:cq
theme:basic-cq
skill-level:beginner
cost:small
impact:small

@EgorBo EgorBo added the tenet-performance Performance related issue label Jan 28, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jan 28, 2022
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@EgorBo EgorBo added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI help wanted [up-for-grabs] Good issue for external contributors labels Jan 28, 2022
@ghost
Copy link

ghost commented Jan 28, 2022

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

Issue Details

As per #64354 (comment)

For cases when we need to access a field using Store-Release semantic with an offset we can do that in a single instruction stlur/ldur.

Thanks to @neon-sunset for checking it on M1, e.g.

class MyClass
{
public:
    std::atomic<int> x;
    std::atomic<int> y;
};

void Foo(MyClass* cls)
{
    cls->x = 42;
    cls->y = 42;
}

compiles down to:

Foo(MyClass*):
        mov     w1, 42
        stlr    w1, [x0]
        stlur   w1, [x0, 4]
        ret

On Apple M1 (which is v8.5)

Author: EgorBo
Assignees: -
Labels:

tenet-performance, up-for-grabs, area-CodeGen-coreclr, untriaged

Milestone: -

@EgorBo EgorBo removed the untriaged New issue has not been triaged by the area owner label Jan 28, 2022
@EgorBo EgorBo added this to the Future milestone Jan 28, 2022
@EgorBo
Copy link
Member Author

EgorBo commented Oct 17, 2023

Closed via #89681 and #91553

@EgorBo EgorBo closed this as completed Oct 17, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Nov 16, 2023
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 help wanted [up-for-grabs] Good issue for external contributors tenet-performance Performance related issue
Projects
None yet
Development

No branches or pull requests

1 participant