|
| 1 | +;; Tests for relaxed dot products. |
| 2 | + |
| 3 | +(module |
| 4 | + (func (export "i16x8.dot_i8x16_i7x16_s") (param v128 v128) (result v128) (i16x8.dot_i8x16_i7x16_s (local.get 0) (local.get 1))) |
| 5 | + (func (export "i32x4.dot_i8x16_i7x16_add_s") (param v128 v128 v128) (result v128) (i32x4.dot_i8x16_i7x16_add_s (local.get 0) (local.get 1) (local.get 2))) |
| 6 | + (func (export "f32x4.relaxed_dot_bf16x8_add_f32x4") (param v128 v128 v128) (result v128) (f32x4.relaxed_dot_bf16x8_add_f32x4 (local.get 0) (local.get 1) (local.get 2))) |
| 7 | +) |
| 8 | + |
| 9 | +;; Simple values to ensure things are functional. |
| 10 | +(assert_return (invoke "i16x8.dot_i8x16_i7x16_s" |
| 11 | + (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) |
| 12 | + (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)) |
| 13 | + (v128.const i16x8 1 13 41 85 145 221 313 421)) |
| 14 | + |
| 15 | +;; Test max and min i8 values; |
| 16 | +(assert_return (invoke "i16x8.dot_i8x16_i7x16_s" |
| 17 | + (v128.const i8x16 -128 -128 127 127 0 0 0 0 0 0 0 0 0 0 0 0) |
| 18 | + (v128.const i8x16 127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0)) |
| 19 | + (v128.const i16x8 -32512 32512 0 0 0 0 0 0)) |
| 20 | + |
| 21 | +;; Simple values to ensure things are functional. |
| 22 | +(assert_return (invoke "i32x4.dot_i8x16_i7x16_add_s" |
| 23 | + (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) |
| 24 | + (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) |
| 25 | + (v128.const i32x4 0 1 2 3)) |
| 26 | + ;; intermediate result is [14, 126, 366, 734] |
| 27 | + (v128.const f32x4 14 127 368 737)) |
| 28 | + |
| 29 | +;; Test max and min i8 values; |
| 30 | +(assert_return (invoke "i32x4.dot_i8x16_i7x16_add_s" |
| 31 | + (v128.const i8x16 -128 -128 -128 -128 127 127 127 127 0 0 0 0 0 0 0 0) |
| 32 | + (v128.const i8x16 127 127 127 127 127 127 127 127 0 0 0 0 0 0 0 0) |
| 33 | + (v128.const i32x4 0 1 2 3)) |
| 34 | + ;; intermediate result is [-65024, 65024, 0, 0] |
| 35 | + (v128.const f32x4 -65024 65024 0 0)) |
| 36 | + |
| 37 | +;; Simple values to ensure things are functional. |
| 38 | +(assert_return (invoke "f32x4.relaxed_dot_bf16x8_add_f32x4" |
| 39 | + (v128.const i16x8 0x0000 0x3f80 0x4000 0x4040 0x4080 0x40a0 0x40c0 0x40e0) ;; [0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f] |
| 40 | + (v128.const i16x8 0x0000 0x3f80 0x4000 0x4040 0x4080 0x40a0 0x40c0 0x40e0) |
| 41 | + (v128.const f32x4 0 1 2 3)) |
| 42 | + ;; intermediate result is [1, 13, 41, 85] |
| 43 | + (v128.const f32x4 1 14 43 88)) |
0 commit comments