ilyas-mallah requested wasmtime-compiler-s390x-reviewers for a review on PR #14883.
ilyas-mallah opened PR #14883 from ilyas-mallah:cranelift-fpromote-fdemote-types to bytecodealliance:main:
The verifier accepts fpromote and fdemote with an f16 or f128 operand. The x64 and aarch64 lowerings match only the result type, and s390x matches any pair. On aarch64 that compiles to a wrong value: fpromote.f64 of an f16 1.0 gives about 2.15e-41, and fdemote.f32 of an f128 gives 0.0. x64 and s390x panic. Wasm doesn't produce these types, so only CLIF reaches this.
The rules now match the source type too, so these pairs fail with the usual unsupported-feature error, as in #14653. riscv64 and Pulley already did. I compiled all 12 type pairs for 8 targets before and after. Only the broken cases changed, and the 24 supported compiles are byte for byte the same.
ilyas-mallah removed the review request for wasmtime-compiler-reviewers from PR #14883.
ilyas-mallah requested alexcrichton for a review on PR #14883.
ilyas-mallah requested wasmtime-compiler-reviewers for a review on PR #14883.
:memo: uweigand submitted PR review.
:speech_balloon: uweigand created PR review comment:
Same here.
:speech_balloon: uweigand created PR review comment:
This isn't wrong, but I don't see why it is necessary - the
fpromote_regrule itself already rejects all unsupported type combinations ...
:memo: ilyas-mallah submitted PR review.
:speech_balloon: ilyas-mallah created PR review comment:
The guard is needed because
fpromote_regisn'tpartial. A pair it has no rule for panics instead of being rejected. On main,clif-util compile --target s390xoffpromote.f64on an f16 value exits 101 with "no rule matched for term fpromote_reg ... should it be partial?". The new s390x filetest fails on main with that panic.The old generic rule sent every f16 pair into the helper, so the explicit pairs keep f16 out of it. I can make the two helpers partial instead. That touches 19 call sites in lower.isle, which would each need to handle a missing match. Do you prefer that?
:memo: ilyas-mallah submitted PR review.
:speech_balloon: ilyas-mallah created PR review comment:
Same reason, see my reply above.
fdemote_regisn'tpartialeither, andfdemote.f16of an f32 value panics in it with "no rule matched for term fdemote_reg".
:memo: uweigand submitted PR review.
:speech_balloon: uweigand created PR review comment:
Ah, I see. No, this change is fine with me then. Thanks!
:thumbs_up: uweigand submitted PR review:
LGTM, thanks!
uweigand added PR #14883 Cranelift: fail cleanly on fpromote/fdemote with f16 or f128 types to the merge queue.
:check: uweigand merged PR #14883.
uweigand removed PR #14883 Cranelift: fail cleanly on fpromote/fdemote with f16 or f128 types from the merge queue.
Last updated: Oct 31 2026 at 23:03 UTC