Skip to content
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

Implement a few minor optimizations around 128-bit integers #9136

Merged
merged 3 commits into from
Aug 16, 2024

Conversation

alexcrichton
Copy link
Member

This commit implements a few minor changes for i128 in both the egraph optimizations and lowerings for x64. The optimization pass will now transform iconcat into a uextend or sextend where appropriate. The x64 backend then pattern-matches this to produce slightly more optimal machine code. Additionally the x64 backend now handles memory/immediate operands a bit better when the argument to a 128-bit operation is an iconcat.

This commit implements a few minor changes for `i128` in both the egraph
optimizations and lowerings for x64. The optimization pass will now
transform `iconcat` into a `uextend` or `sextend` where appropriate.
The x64 backend then pattern-matches this to produce slightly more
optimal machine code. Additionally the x64 backend now handles
memory/immediate operands a bit better when the argument to a 128-bit
operation is an `iconcat`.
@alexcrichton alexcrichton requested a review from a team as a code owner August 16, 2024 16:38
@alexcrichton alexcrichton requested review from elliottt and removed request for a team August 16, 2024 16:38
Copy link
Member

@elliottt elliottt left a comment

Choose a reason for hiding this comment

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

Nice!

@alexcrichton alexcrichton added this pull request to the merge queue Aug 16, 2024
Merged via the queue into bytecodealliance:main with commit 69b005f Aug 16, 2024
67 checks passed
@alexcrichton alexcrichton deleted the i128-opts branch August 16, 2024 18:57
alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request Aug 19, 2024
This commit is similar to bytecodealliance#8976 where it's fixing some typos in the
encoding of the `adc` and `sbb` instructions used in Cranelift. These
appear to have copy/paste typos where the non-register-based opcodes
weren't updated from the `add` and `sub` opcodes. This problem was
exposed from a fuzz test case after bytecodealliance#9136 landed. The fuzz test case is
minimized and included here as a new runtest and new emit tests are
additionally added.
github-merge-queue bot pushed a commit that referenced this pull request Aug 19, 2024
This commit is similar to #8976 where it's fixing some typos in the
encoding of the `adc` and `sbb` instructions used in Cranelift. These
appear to have copy/paste typos where the non-register-based opcodes
weren't updated from the `add` and `sub` opcodes. This problem was
exposed from a fuzz test case after #9136 landed. The fuzz test case is
minimized and included here as a new runtest and new emit tests are
additionally added.
alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request Sep 5, 2024
This commit adds a special case to the lowering of 128-bit
multiplication on the aarch64 backend along the same lines as was done
in bytecodealliance#9136 for the x64 backend. Notably zero and sign-extended values
which are multiplied to produce a 128-bit result can skip some of the
arithmetic of the fully general 128-bit lowering.
github-merge-queue bot pushed a commit that referenced this pull request Sep 6, 2024
This commit adds a special case to the lowering of 128-bit
multiplication on the aarch64 backend along the same lines as was done
in #9136 for the x64 backend. Notably zero and sign-extended values
which are multiplied to produce a 128-bit result can skip some of the
arithmetic of the fully general 128-bit lowering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants