aarch64: Add support for the fmls instruction#5895
Merged
Conversation
This commit adds lowerings to the AArch64 backend for the `fmls` instruction which is intended to be leveraged in the relaxed-simd proposal for WebAssembly. This should hopefully allow for a teeny-bit-more efficient codegen for this operator instead of using the `fmla` instruction plus a negation instruction.
jameysharp
approved these changes
Mar 2, 2023
| (vec_rrr_mod (VecALUModOp.Fmls) z x y (vector_size ty))) | ||
|
|
||
| (rule 2 (lower (has_type ty @ (multi_lane _ _) (fma x (fneg y) z))) | ||
| (vec_rrr_mod (VecALUModOp.Fmls) z x y (vector_size ty))) |
Contributor
There was a problem hiding this comment.
I suppose if both x and y are fneg then this can emit fmla instead of fneg+fmls, right? But I guess that's a rewrite we ought to do in the egraph optimizations instead.
Member
Author
There was a problem hiding this comment.
Indeed! The x64 rules actually end up implementing that (they enable sort of switching back and forth given their structure) but it wasn't as obvious to do here - x64 uses a helper that manages sinking a load as well which adds a fair number of permutations.
I'll send a follow-up which implements the egraph optimization.
alexcrichton
added a commit
to alexcrichton/wasmtime
that referenced
this pull request
Mar 2, 2023
This implements comments from bytecodealliance#5895 to cancel out `fneg` operations in `fma` instructions. Additional support for `fmul` is added as well.
alexcrichton
added a commit
that referenced
this pull request
Mar 2, 2023
This implements comments from #5895 to cancel out `fneg` operations in `fma` instructions. Additional support for `fmul` is added as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds lowerings to the AArch64 backend for the
fmlsinstruction which is intended to be leveraged in the relaxed-simd proposal for WebAssembly. This should hopefully allow for a teeny-bit-more efficient codegen for this operator instead of using thefmlainstruction plus a negation instruction.