Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

ARM64: optimize PREPARE_EXTERNAL_VAR (#21) - #8296

Merged
jkotas merged 1 commit into
dotnet:masterfrom
RalfKornmannEnvision:master
Sep 2, 2020
Merged

jkotas merged 1 commit into
dotnet:masterfrom
RalfKornmannEnvision:master

Conversation

@RalfKornmannEnvision

Copy link
Copy Markdown
Contributor

There are multiple cases were we don't need just the pointer for an external variable but the value that is stored at this location.
So far this was done with the PREPARE_EXTERNAL_VAR followed by an ldr x? [x?]. The PREPARE_EXTERNAL_VAR macro needs two instructions (adrp + add). As the ldr instruction supports an offset we can eliminate the add for this use case. The two new macros PREPARE_EXTERNAL_VAR_INDIRECT and PREPARE_EXTERNAL_VAR_INDIRECT_W make use of this.

There are multiple cases were we don't need just the pointer for an external variable but the value that is stored at this location.
So far this was done with the PREPARE_EXTERNAL_VAR followed by an ldr x? [x?]. The PREPARE_EXTERNAL_VAR macro needs two instructions (adrp + add). As the ldr instruction supports an offset we can eliminate the add for this use case. The two new macros PREPARE_EXTERNAL_VAR_INDIRECT and PREPARE_EXTERNAL_VAR_INDIRECT_W make use of this.
@RalfKornmannEnvision

Copy link
Copy Markdown
Contributor Author

I know this might be some unnecessary over optimizing but if we already use assembler for these helpers saving some more cycles might not be worst we can do.

@jkotas jkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jkotas
jkotas merged commit c4193ca into dotnet:master Sep 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants