This repository was archived by the owner on Dec 22, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -377,6 +377,14 @@ let simd_prefix s =
377377 | 0xcel -> i64x2_add
378378 | 0xd1l -> i64x2_sub
379379 | 0xd5l -> i64x2_mul
380+ | 0xd8l -> f32x4_ceil
381+ | 0xd9l -> f32x4_floor
382+ | 0xdal -> f32x4_trunc
383+ | 0xdbl -> f32x4_nearest
384+ | 0xdcl -> f64x2_ceil
385+ | 0xddl -> f64x2_floor
386+ | 0xdel -> f64x2_trunc
387+ | 0xdfl -> f64x2_nearest
380388 | 0xe0l -> f32x4_abs
381389 | 0xe1l -> f32x4_neg
382390 | 0xe3l -> f32x4_sqrt
Original file line number Diff line number Diff line change @@ -339,6 +339,14 @@ let encode m =
339339 | Unary (V128 V128Op. (I32x4 WidenLowU)) -> simd_op 0xa9l
340340 | Unary (V128 V128Op. (I32x4 WidenHighU)) -> simd_op 0xaal
341341 | Unary (V128 V128Op. (I64x2 Neg)) -> simd_op 0xc1l
342+ | Unary (V128 V128Op. (F32x4 Ceil)) -> simd_op 0xd8l
343+ | Unary (V128 V128Op. (F32x4 Floor)) -> simd_op 0xd9l
344+ | Unary (V128 V128Op. (F32x4 Trunc)) -> simd_op 0xdal
345+ | Unary (V128 V128Op. (F32x4 Nearest)) -> simd_op 0xdbl
346+ | Unary (V128 V128Op. (F64x2 Ceil)) -> simd_op 0xdcl
347+ | Unary (V128 V128Op. (F64x2 Floor)) -> simd_op 0xddl
348+ | Unary (V128 V128Op. (F64x2 Trunc)) -> simd_op 0xdel
349+ | Unary (V128 V128Op. (F64x2 Nearest)) -> simd_op 0xdfl
342350 | Unary (V128 V128Op. (F32x4 Abs)) -> simd_op 0xe0l
343351 | Unary (V128 V128Op. (F32x4 Neg)) -> simd_op 0xe1l
344352 | Unary (V128 V128Op. (F32x4 Sqrt)) -> simd_op 0xe3l
Original file line number Diff line number Diff line change @@ -148,11 +148,19 @@ struct
148148 | F32x4 Abs -> to_value (SXX.F32x4. abs (of_value 1 v))
149149 | F32x4 Neg -> to_value (SXX.F32x4. neg (of_value 1 v))
150150 | F32x4 Sqrt -> to_value (SXX.F32x4. sqrt (of_value 1 v))
151+ | F32x4 Ceil -> to_value (SXX.F32x4. ceil (of_value 1 v))
152+ | F32x4 Floor -> to_value (SXX.F32x4. floor (of_value 1 v))
153+ | F32x4 Trunc -> to_value (SXX.F32x4. trunc (of_value 1 v))
154+ | F32x4 Nearest -> to_value (SXX.F32x4. nearest (of_value 1 v))
151155 | F32x4 ConvertI32x4S -> to_value (SXX.F32x4_convert. convert_i32x4_s (of_value 1 v))
152156 | F32x4 ConvertI32x4U -> to_value (SXX.F32x4_convert. convert_i32x4_u (of_value 1 v))
153157 | F64x2 Abs -> to_value (SXX.F64x2. abs (of_value 1 v))
154158 | F64x2 Neg -> to_value (SXX.F64x2. neg (of_value 1 v))
155159 | F64x2 Sqrt -> to_value (SXX.F64x2. sqrt (of_value 1 v))
160+ | F64x2 Ceil -> to_value (SXX.F64x2. ceil (of_value 1 v))
161+ | F64x2 Floor -> to_value (SXX.F64x2. floor (of_value 1 v))
162+ | F64x2 Trunc -> to_value (SXX.F64x2. trunc (of_value 1 v))
163+ | F64x2 Nearest -> to_value (SXX.F64x2. nearest (of_value 1 v))
156164 | V128 Not -> to_value (SXX.V128. lognot (of_value 1 v))
157165 | _ -> failwith " TODO v128 unimplemented unop"
158166
Original file line number Diff line number Diff line change 109109 val abs : t -> t
110110 val neg : t -> t
111111 val sqrt : t -> t
112+ val ceil : t -> t
113+ val floor : t -> t
114+ val trunc : t -> t
115+ val nearest : t -> t
112116 val add : t -> t -> t
113117 val sub : t -> t -> t
114118 val mul : t -> t -> t
@@ -254,6 +258,10 @@ struct
254258 let abs = unop Float. abs
255259 let neg = unop Float. neg
256260 let sqrt = unop Float. sqrt
261+ let ceil = unop Float. ceil
262+ let floor = unop Float. floor
263+ let trunc = unop Float. trunc
264+ let nearest = unop Float. nearest
257265 let add = binop Float. add
258266 let sub = binop Float. sub
259267 let mul = binop Float. mul
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- type funop = Abs | Neg | Sqrt | ConvertI32x4S | ConvertI32x4U
57+ type funop = Abs | Neg | Sqrt
58+ | Ceil | Floor | Trunc | Nearest
59+ | ConvertI32x4S | ConvertI32x4U
5860 type fbinop = Add | Sub | Mul | Div | Min | Max
5961 | Eq | Ne | Lt | Le | Gt | Ge
6062 type vunop = Not
Original file line number Diff line number Diff line change @@ -385,6 +385,10 @@ let f32x4_ge = Binary (V128 V128Op.(F32x4 Ge))
385385let f32x4_abs = Unary (V128 (V128Op. F32x4 V128Op. Abs ))
386386let f32x4_neg = Unary (V128 (V128Op. F32x4 V128Op. Neg ))
387387let f32x4_sqrt = Unary (V128 (V128Op. F32x4 V128Op. Sqrt ))
388+ let f32x4_ceil = Unary (V128 (V128Op. (F32x4 Ceil )))
389+ let f32x4_floor = Unary (V128 (V128Op. (F32x4 Floor )))
390+ let f32x4_trunc = Unary (V128 (V128Op. (F32x4 Trunc )))
391+ let f32x4_nearest = Unary (V128 (V128Op. (F32x4 Nearest )))
388392let f32x4_add = Binary (V128 (V128Op. F32x4 V128Op. Add ))
389393let f32x4_sub = Binary (V128 (V128Op. F32x4 V128Op. Sub ))
390394let f32x4_mul = Binary (V128 (V128Op. F32x4 V128Op. Mul ))
@@ -405,6 +409,10 @@ let f64x2_gt = Binary (V128 V128Op.(F64x2 Gt))
405409let f64x2_ge = Binary (V128 V128Op. (F64x2 Ge ))
406410let f64x2_neg = Unary (V128 (V128Op. F64x2 V128Op. Neg ))
407411let f64x2_sqrt = Unary (V128 (V128Op. F64x2 V128Op. Sqrt ))
412+ let f64x2_ceil = Unary (V128 (V128Op. (F64x2 Ceil )))
413+ let f64x2_floor = Unary (V128 (V128Op. (F64x2 Floor )))
414+ let f64x2_trunc = Unary (V128 (V128Op. (F64x2 Trunc )))
415+ let f64x2_nearest = Unary (V128 (V128Op. (F64x2 Nearest )))
408416let f64x2_add = Binary (V128 (V128Op. F64x2 V128Op. Add ))
409417let f64x2_sub = Binary (V128 (V128Op. F64x2 V128Op. Sub ))
410418let f64x2_mul = Binary (V128 (V128Op. F64x2 V128Op. Mul ))
Original file line number Diff line number Diff line change @@ -219,6 +219,14 @@ struct
219219 | I32x4 TruncSatF32x4S -> " i32x4.trunc_sat_f32x4_s"
220220 | I32x4 TruncSatF32x4U -> " i32x4.trunc_sat_f32x4_u"
221221 | I64x2 Neg -> " i64x2.neg"
222+ | F32x4 Ceil -> " f32x4.ceil"
223+ | F32x4 Floor -> " f32x4.floor"
224+ | F32x4 Trunc -> " f32x4.trunc"
225+ | F32x4 Nearest -> " f32x4.nearest"
226+ | F64x2 Ceil -> " f64x2.ceil"
227+ | F64x2 Floor -> " f64x2.floor"
228+ | F64x2 Trunc -> " f64x2.trunc"
229+ | F64x2 Nearest -> " f64x2.nearest"
222230 | F32x4 Abs -> " f32x4.abs"
223231 | F32x4 Neg -> " f32x4.neg"
224232 | F32x4 Sqrt -> " f32x4.sqrt"
Original file line number Diff line number Diff line change @@ -490,6 +490,10 @@ rule token = parse
490490 | (simd_shape as s)" .neg"
491491 { UNARY (simdop s i8x16_neg i16x8_neg i32x4_neg i64x2_neg f32x4_neg f64x2_neg) }
492492 | (simd_float_shape as s)" .sqrt" { UNARY (simd_float_op s f32x4_sqrt f64x2_sqrt) }
493+ | (simd_float_shape as s)" .ceil" { UNARY (simd_float_op s f32x4_ceil f64x2_ceil) }
494+ | (simd_float_shape as s)" .floor" { UNARY (simd_float_op s f32x4_floor f64x2_floor) }
495+ | (simd_float_shape as s)" .trunc" { UNARY (simd_float_op s f32x4_trunc f64x2_trunc) }
496+ | (simd_float_shape as s)" .nearest" { UNARY (simd_float_op s f32x4_nearest f64x2_nearest) }
493497 | (simd_shape as s)" .add"
494498 { BINARY (simdop s i8x16_add i16x8_add i32x4_add i64x2_add f32x4_add f64x2_add) }
495499 | (simd_shape as s)" .sub"
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ Currently it only support following simd test files generation.
2222- 'simd_i16x8_sat_arith.wast'
2323- 'simd_f32x4.wast'
2424- 'simd_f64x2.wast'
25+ - 'simd_f32x4_rounding'
26+ - 'simd_f64x2_rounding'
2527
2628
2729Usage:
Original file line number Diff line number Diff line change 2626 'simd_f32x4' ,
2727 'simd_f64x2' ,
2828 'simd_int_arith2' ,
29+ 'simd_f32x4_rounding' ,
30+ 'simd_f64x2_rounding' ,
2931)
3032
3133
@@ -61,4 +63,4 @@ def main():
6163
6264if __name__ == '__main__' :
6365 main ()
64- print ('Done.' )
66+ print ('Done.' )
You can’t perform that action at this time.
0 commit comments