Stream: git-wasmtime

Topic: wasmtime / PR #6181 x64: Clarify and shrink up ModRM/SIB ...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2023 at 20:00):

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:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2023 at 20:00):

alexcrichton requested abrown for a review on PR #6181.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2023 at 20:00):

alexcrichton requested fitzgen for a review on PR #6181.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 07 2023 at 20:00):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #6181.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 10 2023 at 19:37):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 10 2023 at 20:14):

fitzgen merged PR #6181.


Last updated: Dec 23 2024 at 12:05 UTC