alexcrichton opened PR #6181 from alexcrichton:improve-modrm
to bytecodealliance:main
:
I noticed recently that for the
ImmRegRegShift
addressing mode Cranelift will unconditionally emit at least a 1-byte immediate for the offset to be added to the register addition computation, even when the offset is zero. In this case though the instruction encoding can be slightly more compact and remove a byte. This commit started off by applying this optimization, which resulted in the*.clif
test changes in this commit.Further reading this code, however, I personally found it quite hard to follow what was happening with all the various branches and ModRM/SIB bits. I reviewed these encodings in the x64 architecture manual and attempted to improve the logic for encoding here. The new version in this commit is intended to be functionally equivalent to the prior version where dropping a zero-offset from the
ImmRegRegShift
variant is the only change.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested abrown for a review on PR #6181.
alexcrichton requested fitzgen for a review on PR #6181.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #6181.
fitzgen submitted PR review.
fitzgen merged PR #6181.
Last updated: Nov 22 2024 at 16:03 UTC