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: Optimize pair of "str wzr, [reg]" to "str xzr" #35136

Closed
kunalspathak opened this issue Apr 17, 2020 · 3 comments · Fixed by #84350
Closed

ARM64: Optimize pair of "str wzr, [reg]" to "str xzr" #35136

kunalspathak opened this issue Apr 17, 2020 · 3 comments · Fixed by #84350
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@kunalspathak
Copy link
Member

kunalspathak commented Apr 17, 2020

str     wzr, [x1,#8]
str     wzr, [x1,#12]

can be combined into str xzr if the stores are happening in subsequent memory.

str     xzr, [x1,#8]

I collected no. of such str pairs in framework libraries and found approx. 450 pairs in 353 methods.

Details:

str_str_wzr_to_str_xzr.txt

category:cq
theme:optimization
skill-level:intermediate
cost:small
impact:medium

@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this issue. Please help me learn by adding exactly one area label.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Apr 17, 2020
@kunalspathak kunalspathak added arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Apr 17, 2020
@BruceForstall
Copy link
Member

In addition, a sequence of 4 str wzr could be collapsed down to a single stp xzr, xzr by further optimizing using #35134.

@BruceForstall
Copy link
Member

In the attached file, there are some interesting example that are more complicated than simple adjacency peephole optimization. E.g.,

; Assembly listing for method System.Data.ExpressionParser:StartScan():this
[0024]        B9003C1F          str     wzr, [x0,#60]
[0025]        B900301F          str     wzr, [x0,#48]
[0026]        B900341F          str     wzr, [x0,#52]
[0027]        B900401F          str     wzr, [x0,#64]

Could be:

str     xzr, [x0,#48]
str     xzr, [x0,#60]

but it require recognizing that the non-contiguous offsets 60 and 64 can be combined.

@BruceForstall BruceForstall added this to the Future milestone Apr 20, 2020
@BruceForstall BruceForstall removed the untriaged New issue has not been triaged by the area owner label Apr 20, 2020
@BruceForstall BruceForstall added the JitUntriaged CLR JIT issues needing additional triage label Oct 28, 2020
@kunalspathak kunalspathak removed the JitUntriaged CLR JIT issues needing additional triage label Nov 9, 2020
@kunalspathak kunalspathak modified the milestones: Future, 6.0.0 Nov 9, 2020
@JulieLeeMSFT JulieLeeMSFT modified the milestones: 6.0.0, Future Mar 23, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Apr 5, 2023
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Apr 6, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 6, 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
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants