aniasse opened PR #13583 from aniasse:cranelift-imm-s-u-builders to bytecodealliance:main:
Fixes #13529. Follow-up to the discussion in #13527.
Today the generated
<inst>_immbuilder picks sign- vs zero-extension from
a hardcoded list of opcodes inbuild_imm_const, which is easy to trip on.
This adds explicit<inst>_imm_s(sign-extend) and<inst>_imm_u
(zero-extend) variants instead, andbuild_imm_constnow takes a plain
signed: bool. The extension only matters fori128; below that the masked
immediate is the same either way.
<inst>_immstays for back-compat but is now#[deprecated]in favor of the
explicit ones. I migrated the ~100 in-tree callers over by their historical
signedness — that part is a no-op (nothing internal uses these oni128),
which is why the diff is big but boring.Skipped the
SImm128/UImm128newtype idea for now since the_s/_u
names already carry the signedness — can do it as a follow-up if you want.Tested with the cranelift-codegen/frontend suites and the filetests, plus a
new unit test for thei128extension behavior.
aniasse requested cfallin for a review on PR #13583.
aniasse requested wasmtime-compiler-reviewers for a review on PR #13583.
github-actions[bot] added the label cranelift on PR #13583.
github-actions[bot] added the label cranelift:meta on PR #13583.
:thumbs_up: cfallin submitted PR review:
Thanks very much!
cfallin added PR #13583 Cranelift: add _imm_s/_imm_u instruction builder helpers to the merge queue.
:check: cfallin merged PR #13583.
cfallin removed PR #13583 Cranelift: add _imm_s/_imm_u instruction builder helpers from the merge queue.
Last updated: Jul 29 2026 at 05:03 UTC