Takashiidobe opened issue #14693:
.clifTest Casefunction %cas_i32_junk_upper_bits(i64) -> i32 { ss0 = explicit_slot 4 block0(v0: i64): v1 = iconst.i32 7 v2 = stack_addr.i64 ss0 store.i32 v1, v2 v3 = ireduce.i32 v0 v4 = iconst.i32 9 v5 = atomic_cas.i32 v2, v3, v4 v6 = load.i32 v2 return v6 }Steps to Reproduce
- Compile this test on aarch64 without has_lse set
Expected Results
this should return 9
Actual Results
this returns 7
Versions and Environment
Cranelift version or commit: 0.136.2
Operating system: linux
Architecture: x86_64 emulating aarch64 with qemu
Extra Info
This is similar to https://github.com/bytecodealliance/wasmtime/issues/14691 where after an ireduce an op still reads the top bits.
I believe this just requires special casing for i32 like i8 and i64 do as well in aarch64/inst/emit.rs around line 1985.
Takashiidobe added the bug label to Issue #14693.
Takashiidobe added the cranelift label to Issue #14693.
alexcrichton added the cranelift:area:aarch64 label to Issue #14693.
alexcrichton commented on issue #14693:
cfallin closed issue #14693:
.clifTest Casefunction %cas_i32_junk_upper_bits(i64) -> i32 { ss0 = explicit_slot 4 block0(v0: i64): v1 = iconst.i32 7 v2 = stack_addr.i64 ss0 store.i32 v1, v2 v3 = ireduce.i32 v0 v4 = iconst.i32 9 v5 = atomic_cas.i32 v2, v3, v4 v6 = load.i32 v2 return v6 }Steps to Reproduce
- Compile this test on aarch64 without has_lse set
Expected Results
this should return 9
Actual Results
this returns 7
Versions and Environment
Cranelift version or commit: 0.136.2
Operating system: linux
Architecture: x86_64 emulating aarch64 with qemu
Extra Info
This is similar to https://github.com/bytecodealliance/wasmtime/issues/14691 where after an ireduce an op still reads the top bits.
I believe this just requires special casing for i32 like i8 and i64 do as well in aarch64/inst/emit.rs around line 1985.
Last updated: Oct 31 2026 at 23:03 UTC