Skip to content

Allow compressed displacement to be used when profitable #117288

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tannergooding
Copy link
Member

This should save 1-byte of encoding space as compared to using imm32, when applicable.

@Copilot Copilot AI review requested due to automatic review settings July 3, 2025 19:20
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 3, 2025
Copy link
Contributor

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

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds logic in emitter::TakesEvexPrefix to detect when a memory displacement can be compressed to 8 bits via EVEX and only emits the prefix when profitable, saving encoding space.

  • Compute stack or address displacement and check if it fits in a signed byte
  • Call TryEvexCompressDisp8Byte for larger displacements and return true when compression succeeds
Comments suppressed due to low confidence (1)

src/coreclr/jit/emitxarch.cpp:1926

  • No tests were added to verify the new compressed displacement logic (TryEvexCompressDisp8Byte); consider adding unit tests covering both compressible and non-compressible displacement cases to ensure correct behavior.
            dsp = TryEvexCompressDisp8Byte(id, dsp, &dspInByte);

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

Successfully merging this pull request may close these issues.

1 participant