This repository was archived by the owner on Dec 22, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 12 files changed +189
-0
lines changed Expand file tree Collapse file tree 12 files changed +189
-0
lines changed Original file line number Diff line number Diff line change @@ -370,6 +370,7 @@ let simd_prefix s =
370370 | 0xb7l -> i32x4_min_u
371371 | 0xb8l -> i32x4_max_s
372372 | 0xb9l -> i32x4_max_u
373+ | 0xbal -> i32x4_dot_i16x8_s
373374 | 0xc1l -> i64x2_neg
374375 | 0xcbl -> i64x2_shl
375376 | 0xccl -> i64x2_shr_s
Original file line number Diff line number Diff line change @@ -466,6 +466,7 @@ let encode m =
466466 | Binary (V128 V128Op. (I32x4 MinU)) -> simd_op 0xb7l
467467 | Binary (V128 V128Op. (I32x4 MaxS)) -> simd_op 0xb8l
468468 | Binary (V128 V128Op. (I32x4 MaxU)) -> simd_op 0xb9l
469+ | Binary (V128 V128Op. (I32x4 DotI16x8S)) -> simd_op 0xbal
469470 | Binary (V128 V128Op. (I32x4 Mul)) -> simd_op 0xb5l
470471 | Binary (V128 V128Op. (I32x4 Eq)) -> simd_op 0x37l
471472 | Binary (V128 V128Op. (I32x4 Ne)) -> simd_op 0x38l
Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ module SimdOp (SXX : Simd.S) (Value : ValueType with type t = SXX.t) = struct
118118 | I32x4 GtU -> SXX.I32x4. gt_u
119119 | I32x4 GeS -> SXX.I32x4. ge_s
120120 | I32x4 GeU -> SXX.I32x4. ge_u
121+ | I32x4 DotI16x8S -> SXX.I32x4_convert. dot_i16x8_s
121122 | I64x2 Add -> SXX.I64x2. add
122123 | I64x2 Sub -> SXX.I64x2. sub
123124 | I64x2 Mul -> SXX.I64x2. mul
Original file line number Diff line number Diff line change 185185 val widen_high_s : t -> t
186186 val widen_low_u : t -> t
187187 val widen_high_u : t -> t
188+ val dot_i16x8_s : t -> t -> t
188189 end
189190 module I64x2_convert : sig
190191 val widen_low_s : t -> t
@@ -429,6 +430,17 @@ struct
429430 let widen_high_s = widen Lib.List. drop 0xffffffffl
430431 let widen_low_u = widen Lib.List. take 0xffffl
431432 let widen_high_u = widen Lib.List. drop 0xffffl
433+
434+ let dot_i16x8_s x y =
435+ let xs = Rep. to_i16x8 x in
436+ let ys = Rep. to_i16x8 y in
437+ let rec dot xs ys =
438+ match xs, ys with
439+ | x1 ::x2 ::xss , y1 ::y2 ::yss ->
440+ Int32. (add (mul x1 y1) (mul x2 y2)) :: dot xss yss
441+ | [] , [] -> []
442+ | _ , _ -> assert false
443+ in Rep. of_i32x4 (dot xs ys)
432444 end
433445
434446 module I64x2_convert = struct
Original file line number Diff line number Diff line change 5454 | Eq | Ne | LtS | LtU | LeS | LeU | GtS | GtU | GeS | GeU
5555 | Swizzle | Shuffle of int list | NarrowS | NarrowU
5656 | AddSatS | AddSatU | SubSatS | SubSatU
57+ | DotI16x8S
5758 type funop = Abs | Neg | Sqrt
5859 | Ceil | Floor | Trunc | Nearest
5960 | ConvertI32x4S | ConvertI32x4U
Original file line number Diff line number Diff line change @@ -367,6 +367,7 @@ let i32x4_max_u = Binary (V128 V128Op.(I32x4 MaxU))
367367let i32x4_mul = Binary (V128 V128Op. (I32x4 Mul ))
368368let i32x4_trunc_sat_f32x4_s = Unary (V128 V128Op. (I32x4 TruncSatF32x4S ))
369369let i32x4_trunc_sat_f32x4_u = Unary (V128 V128Op. (I32x4 TruncSatF32x4U ))
370+ let i32x4_dot_i16x8_s = Binary (V128 V128Op. (I32x4 DotI16x8S ))
370371
371372let i64x2_splat = Convert (V128 V128Op. (I64x2 Splat ))
372373let i64x2_extract_lane imm = SimdExtract (V128Op. I64x2 (ZX , imm))
Original file line number Diff line number Diff line change @@ -305,6 +305,7 @@ struct
305305 | I32x4 MinU -> " i32x4.min_u"
306306 | I32x4 MaxS -> " i32x4.max_s"
307307 | I32x4 MaxU -> " i32x4.max_u"
308+ | I32x4 DotI16x8S -> " i32x4.dot_i16x8_s"
308309 | I64x2 Add -> " i64x2.add"
309310 | I64x2 Sub -> " i64x2.sub"
310311 | I64x2 Mul -> " i64x2.mul"
Original file line number Diff line number Diff line change @@ -569,6 +569,9 @@ rule token = parse
569569 | " i16x8.sub_sat_" (sign as s)
570570 { BINARY (ext s i16x8_sub_sat_s i16x8_sub_sat_u) }
571571
572+ | " i32x4.dot_i16x8_s"
573+ { BINARY i32x4_dot_i16x8_s }
574+
572575 | (simd_shape as s) { SIMD_SHAPE (simd_shape s) }
573576
574577 | name as s { VAR s }
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ Currently it only support following simd test files generation.
2626- 'simd_f64x2_rounding'
2727- 'simd_f32x4_pmin_pmax'
2828- 'simd_f64x2_pmin_pmax'
29+ - 'simd_i32x4_dot_i16x8'
2930
3031
3132Usage:
Original file line number Diff line number Diff line change 3030 'simd_f64x2_rounding' ,
3131 'simd_f32x4_pmin_pmax' ,
3232 'simd_f64x2_pmin_pmax' ,
33+ 'simd_i32x4_dot_i16x8' ,
3334)
3435
3536
You can’t perform that action at this time.
0 commit comments