Stream: git-wasmtime

Topic: wasmtime / PR #11128 x64: Add lowerings for the `bt` inst...


view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 17:34):

alexcrichton opened PR #11128 from alexcrichton:x64-bt to bytecodealliance:main:

This commit builds on the previous refactorings to leverage the bt instruction on x64 which moves a specific bit into the CF bit of EFLAGS which can be useful for comparisons/branches/selects/etc.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 17:34):

alexcrichton requested wasmtime-compiler-reviewers for a review on PR #11128.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 17:34):

alexcrichton requested wasmtime-core-reviewers for a review on PR #11128.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 17:34):

alexcrichton requested fitzgen for a review on PR #11128.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 19:38):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 19:38):

fitzgen created PR review comment:

Do we expect this to use a bt instruction? If not, then why not?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 19:38):

fitzgen created PR review comment:

Slightly easier to understand, for me at least, like this:

        if val.count_ones() == 1 {
            Some(u8::try_from(val.trailing_zeros()).unwrap())
        } else {
            None
        }

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 19:38):

fitzgen created PR review comment:

Same here?

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 20:45):

alexcrichton updated PR #11128.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 20:46):

github-actions[bot] commented on PR #11128:

Subscribe to Label Action

cc @cfallin, @fitzgen

<details>
This issue or pull request has been labeled: "cranelift", "cranelift:area:x64", "isle"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 20:47):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 20:47):

alexcrichton created PR review comment:

It's intentional yeah, and corresponds to this lowering rule. My rationale is "LLVM is probably smarter than I" and I'm assuming LLVM did things like micro-op tests or something to figure out that test has a lower latency than bt or something like that. No idea if that's actually the case though, just mirroring them.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 20:58):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 20:58):

cfallin created PR review comment:

According to Agner Fog's tables, taking Skylake as a random reasonable baseline µarch, test has one cycle latency and a throughput of 4/cycle (four ALU ports can execute it) while bt has one cycle latency and a throughput of 2/cycle (two ALU ports can execute it). So probably reasonable to prefer test to bt where possible.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 21:19):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 21:19):

alexcrichton created PR review comment:

Nice that sounds like an excellent reference to put as documentation in the lowering rules so I'll do that.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 24 2025 at 22:56):

alexcrichton updated PR #11128.

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2025 at 15:06):

fitzgen submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Jun 25 2025 at 15:29):

fitzgen merged PR #11128.


Last updated: Dec 06 2025 at 06:05 UTC