alexcrichton added the fuzz-bug label to Issue #10460.
alexcrichton added the wasm-proposal:simd label to Issue #10460.
alexcrichton added the winch label to Issue #10460.
alexcrichton opened issue #10460:
This input:
(module (func (export "x") (param i32 v128 i32) (param v128 i32 v128 i32 v128) (param i32 v128 i32 v128 i32) (param v128 i32 v128 i32) (param $last v128) (result v128) local.get $last ) ) (assert_return (invoke "x" (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) ) (v128.const i64x2 0 0))
yields:
$ cargo run -q wast -Ccompiler=winch repro.wat Error: failed to run script file 'repro.wat' Caused by: 0: failed directive on repro.wat:13:1 1: result 0 didn't match 2: expected [ 0, 0] actual [ 94750456038144, 0] expected (hex) [0000000000000000, 0000000000000000] actual (hex) [0000562ccf464300, 0000000000000000]
cc @jeffcharles @saulecabrera
saulecabrera commented on issue #10460:
Thanks for the report! We'll take a look into it.
jeffcharles commented on issue #10460:
I wasn't able to resolve this today but I narrowed down the repro case to:
(module (func (export "x") (param f32 f32 f32 f32 f32 f32 f32 f32 f32) (param $last v128) (result v128) local.get $last ) ) (assert_return (invoke "x" (f32.const 1) (f32.const 2) (f32.const 3) (f32.const 4) (f32.const 5) (f32.const 6) (f32.const 7) (f32.const 8) (f32.const 9) (v128.const i64x2 10 11) ) (v128.const i64x2 10 11))
The key detail is there needs to be enough float/vector parameters to require using the stack for the last two and the last parameter must be a vector. Cranelift seems to be using offsets of 0 for the f32 and 16 for the v128 for the last two parameters whereas it'll use offsets of 0 and 8 for two f32 parameters. Winch uses offsets of 16 for the f32 and 24 for the v128 from the base pointer in both cases. I'm not very familiar with exactly how Cranelift uses those offsets so I can't speak to whether there's an issue with the offsets being different for the different argument types.
saulecabrera assigned saulecabrera to issue #10460.
fitzgen closed issue #10460:
This input:
(module (func (export "x") (param i32 v128 i32) (param v128 i32 v128 i32 v128) (param i32 v128 i32 v128 i32) (param v128 i32 v128 i32) (param $last v128) (result v128) local.get $last ) ) (assert_return (invoke "x" (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) (i32.const 0) (v128.const i64x2 0 0) ) (v128.const i64x2 0 0))
yields:
$ cargo run -q wast -Ccompiler=winch repro.wat Error: failed to run script file 'repro.wat' Caused by: 0: failed directive on repro.wat:13:1 1: result 0 didn't match 2: expected [ 0, 0] actual [ 94750456038144, 0] expected (hex) [0000000000000000, 0000000000000000] actual (hex) [0000562ccf464300, 0000000000000000]
cc @jeffcharles @saulecabrera
Last updated: Apr 18 2025 at 22:03 UTC