Stream: git-wasmtime

Topic: wasmtime / issue #5252 Cranelift(Aarch64): Optimize lower...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 11 2022 at 00:20):

fitzgen commented on issue #5252:

Here is an example of what we used to lower these to (i.e. what happens when I comment out the rules that implement these rewrites):

--- expected
+++ actual
@@ -1,4 +1,6 @@
 block0:
-  subs wzr, w0, #1118208
-  cset x0, hi
+  movz w2, #4097
+  movk w2, w2, #17, LSL #16
+  subs wzr, w0, w2
+  cset x0, hs
   ret

view this post on Zulip Wasmtime GitHub notifications bot (Nov 15 2022 at 17:10):

fitzgen commented on issue #5252:

For those following along at home: the test failure from the previous iteration of this PR was because the rules previously implemented for this "same" optimization for turning less-than-or-equal into less-than was incorrect (it would apply if the constant was on the LHS, but was firing when the constant was on the RHS).

In the future, we could try and "rotate" const <= value into value >= const and then go through this same optimization path so that we don't need to duplicate the rules but with tiny tweaks. I opted not to do that in this PR and removed the buggy optimizations to just get this land-able.


Last updated: Nov 22 2024 at 17:03 UTC