Skip to content

ARM64: Optimize pair of "ldr reg, [fp]" to ldp #35130

Description

@kunalspathak
ldr     x2, [fp,#24]
ldr     x3, [fp,#32]

can be combined into ldp if the loads are happening from subsequent memory.

ldp x2, x3, [fp, #24]

I collected no. of such ldr pairs in framework libraries and found approx. 28K pairs in 13K methods.

Details:

ldr_ldr_fp_to_ldp.txt

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

Activity

  1. Dotnet-GitSync-Bot commented on Apr 17, 2020

    @Dotnet-GitSync-Bot
    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.

  2. BruceForstall commented on Apr 18, 2020

    @BruceForstall
    Contributor

    Related: #35132

  3. BruceForstall commented on Apr 18, 2020

    @BruceForstall
    Contributor

    I noticed a few things from the attached file:

    • Sometimes the low offset comes first, sometimes it comes second in the instruction stream. A peep would need to handle both cases.
    • There are a few cases in the attached examples of non-contiguous loads that wouldn't be mergeable (e.g., [fp,#72] / [fp,#32])
    • Were there any cases of consecutive loads of the w sub-registers? Or the floating-point registers?
  4. BruceForstall commented on Apr 18, 2020

    @BruceForstall
    Contributor

    Extending this to arm32, we could use STM with a register mask to collapse multiple store (if the consecutive stores were using increasing register numbers, and possibly other conditions were met).

  5. added this to the Future milestone on Apr 20, 2020
  6. removed
    untriagedNew issue has not been triaged by the area owner
    on Apr 20, 2020
  7. modified the milestones: Future, 6.0.0 on Nov 9, 2020
  8. modified the milestones: 6.0.0, Future on Mar 23, 2021
  9. kunalspathak commented on Apr 27, 2023

    @kunalspathak
    ContributorAuthor

    Fixed in various peepholes, latest being #85032.

  10. ghost locked as resolved and limited conversation to collaborators on May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-arm64area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions