forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
egraphs: Add some
select
optimizations (bytecodealliance#6843)
* egraphs: Remove extends before selects when possible * egraphs: Rewrite `select+{i,fcmp}` when select arms match cmp result * egraphs: Simplify double `bmask` * egraphs: Simplify double `bswap` * egraphs: Modularize select optimizations Co-Authored-By: Jamey Sharp <jsharp@fastly.com> * egraphs: Remove `bmask+{i,f}cmp` optimizations These were unsound since we only represent the results of `{i,f}cmp` as `-1` for vectors, and not for scalars, scalars get the output of `1` * egraphs: Optimize `bitrev` in `select` and `bmask` * egraphs: Optimize `popcnt` in `select` and `bmask` * egraphs: Optimize double `bitrev` * egraphs: Add `thruthy` expression matcher Cleans up the previous logic a bit. This also adds `rotl`/`rotr` as thruth preserving expressions. As well as `select` when it's branches match certain constants. Co-Authored-By: Jamey Sharp <jsharp@fastly.com> * egraphs: Make `icmp ne x, 0` a thruthy expression * egraphs: Add `icmp ne x, 0` as an expression that can delete thruthy inputs * egraphs: Add tests for comutative versions of the `icmp ne` thruthy rules * egraphs: Restrict `icmp ne` optimization to arms with the This also cleans up some merge conflicts that happened when rebasing. * egraphs: Restore some accidentally deleted tests * egraphs: Use `t` and `f` as names for select arms Co-authored-by: Jamey Sharp <jamey@minilop.net> * egraphs: Allow `icmp ne` opt to match arms of different types Co-authored-by: Jamey Sharp <jamey@minilop.net> --------- Co-authored-by: Jamey Sharp <jsharp@fastly.com> Co-authored-by: Jamey Sharp <jamey@minilop.net>
- Loading branch information
1 parent
858c1d8
commit af35da6
Showing
2 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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