Stream: git-wasmtime

Topic: wasmtime / PR #12644 cranelift/x64: implement cls for all...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 03:35):

shreyasravi320 requested alexcrichton for a review on PR #12644.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 03:35):

shreyasravi320 requested wasmtime-compiler-reviewers for a review on PR #12644.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 03:35):

shreyasravi320 opened PR #12644 from shreyasravi320:cls-impl-x86_64 to bytecodealliance:main:

<!--
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
-->
Fixes issue #5107
cls implemented with the identity cls(x) = clz(x ^ (x >> 1)) - 1
All integer types (i8, i16, i32, i64, and i128) handled
Added tests to filetests

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 07:03):

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

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 07:03):

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

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 17:47):

shreyasravi320 edited PR #12644:

<!--
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
-->
Fixes #5107
cls implemented with the identity cls(x) = clz(x ^ (x >> 1)) - 1
All integer types (i8, i16, i32, i64, and i128) handled
Added tests to filetests

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 20:32):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 20:32):

alexcrichton created PR review comment:

These two rules can be merged together through the x64_sar helper perhaps?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 20:32):

alexcrichton created PR review comment:

For runnable tests we typically use the runtest directory instead of isa/x64. I see as well there's already a cls.clif file in that directory, so can that file be enabled for x64, and perhaps these tests merged there too?

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 23:21):

shreyasravi320 updated PR #12644.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 23:22):

shreyasravi320 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 23:22):

shreyasravi320 created PR review comment:

Got it. Added x86 support in the cls test there, and added the i128 tests. The existing tests were pretty comprehensive so I just added the i128 tests in the same format.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 23:24):

shreyasravi320 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 24 2026 at 23:24):

shreyasravi320 created PR review comment:

Sounds good. I decided to keep x64_sarq_mi in the cls rule for i128 since it would be more effort to switch that over to x64_sar.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2026 at 15:16):

alexcrichton commented on PR #12644:

There's a separate i128-cls.clif as well which I believe has a specific option to get it to work with s390x. Given all backends now implement cls for i128 (I think given the test report), want to merge that test into cls.clif? I think adding in the set enable_multi_ret_implicit_sret option for s390x might fix CI as a side effect too.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2026 at 16:51):

shreyasravi320 updated PR #12644.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2026 at 18:55):

alexcrichton submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2026 at 18:55):

alexcrichton added PR #12644 cranelift/x64: implement cls for all integer types to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2026 at 19:40):

alexcrichton merged PR #12644.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 25 2026 at 19:40):

alexcrichton removed PR #12644 cranelift/x64: implement cls for all integer types from the merge queue.


Last updated: Mar 23 2026 at 16:19 UTC