Stream: git-wasmtime

Topic: wasmtime / PR #13336 cranelift(aarch64): lower bare `ctz`...


view this post on Zulip Wasmtime GitHub notifications bot (May 11 2026 at 17:17):

ggreif edited PR #13336.

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2026 at 20:17):

github-actions[bot] added the label cranelift on PR #13336.

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2026 at 20:17):

github-actions[bot] added the label cranelift:area:aarch64 on PR #13336.

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2026 at 20:17):

github-actions[bot] added the label cranelift:area:x64 on PR #13336.

view this post on Zulip Wasmtime GitHub notifications bot (May 12 2026 at 16:04):

cfallin commented on PR #13336:

Ideally we would do this in the mid-end, not in every back-end individually (and then revert #13334 as well).

In principle this would work by matching on the brif, not the clz -- your mid-end PR only considered simplifications of the clz itself, which is why you didn't see this option I think. In other words, it's not valid to simplify (clz x) to a bare x & 1, but when used as a condition to a brif, where all we are testing is whether the result is nonzero, it is. So the whole (brif (clz x) a b) should simplify to (brif (band x (iconst 1)) a b) more or less (some syntactical details elided).

I can't seem to get the simplify_skeleton entry point to work for brif right now (quick experiment, I haven't dug into it much); but that's the shape of what we'd want. Does that make sense?

view this post on Zulip Wasmtime GitHub notifications bot (May 12 2026 at 21:38):

ggreif commented on PR #13336:

Closing in favor of #13343 — the mid-end simplify_skeleton-on-brif extension covers the same cases and produces strictly better aarch64 code: tbz w0, #0 (single-instruction test-and-branch) vs this PR's tst+cmp+b.cc. See the comparison table in #13343.

view this post on Zulip Wasmtime GitHub notifications bot (May 12 2026 at 21:38):

:cross_mark: ggreif closed without merge PR #13336.


Last updated: Jun 01 2026 at 09:49 UTC