WebAssembly / spec

WebAssembly specification, reference interpreter, and test suite.
https://webassembly.github.io/spec/
Other
3.09k stars 438 forks source link

Improve SIMD test diversity #1703

Open SoniEx2 opened 8 months ago

SoniEx2 commented 8 months ago

SIMD tests do not have enough diversity to catch e.g. swapped lanes. It would be useful to have tests like:

(assert_return (invoke "i8x16.narrow_i16x8_s" (v128.const i16x8 0 1 2 3 4 5 6 7)
                                              (v128.const i16x8 8 9 10 11 12 13 14 15))
                                              (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))
(assert_return (invoke "i8x16.narrow_i16x8_u" (v128.const i16x8 0 1 2 3 4 5 6 7)
                                              (v128.const i16x8 8 9 10 11 12 13 14 15))
                                              (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))
(assert_return (invoke "i16x8.narrow_i32x4_s" (v128.const i32x4 1 2 3 4)
                                              (v128.const i32x4 5 6 7 8))
                                              (v128.const i16x8 1 2 3 4 5 6 7 8))
(assert_return (invoke "i16x8.narrow_i32x4_u" (v128.const i32x4 1 2 3 4)
                                              (v128.const i32x4 5 6 7 8))
                                              (v128.const i16x8 1 2 3 4 5 6 7 8))
(assert_return (invoke "i32x4.trunc_sat_f64x2_s_zero" (v128.const f64x2 1.0 2.0))
                                                      (v128.const i32x4 1 2 0 0))
(assert_return (invoke "i32x4.trunc_sat_f64x2_u_zero" (v128.const f64x2 1.0 2.0))
                                                      (v128.const i32x4 1 2 0 0))

among others.

rossberg commented 8 months ago

Sounds good. Can you create a PR?