This repository was archived by the owner on Dec 22, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 16 files changed +23510
-3
lines changed Expand file tree Collapse file tree 16 files changed +23510
-3
lines changed Original file line number Diff line number Diff line change @@ -394,6 +394,8 @@ let simd_prefix s =
394394 | 0xe7l -> f32x4_div
395395 | 0xe8l -> f32x4_min
396396 | 0xe9l -> f32x4_max
397+ | 0xeal -> f32x4_pmin
398+ | 0xebl -> f32x4_pmax
397399 | 0xecl -> f64x2_abs
398400 | 0xedl -> f64x2_neg
399401 | 0xefl -> f64x2_sqrt
@@ -403,6 +405,8 @@ let simd_prefix s =
403405 | 0xf3l -> f64x2_div
404406 | 0xf4l -> f64x2_min
405407 | 0xf5l -> f64x2_max
408+ | 0xf6l -> f64x2_pmin
409+ | 0xf7l -> f64x2_pmax
406410 | 0xf8l -> i32x4_trunc_sat_f32x4_s
407411 | 0xf9l -> i32x4_trunc_sat_f32x4_u
408412 | 0xfal -> f32x4_convert_i32x4_s
Original file line number Diff line number Diff line change @@ -488,6 +488,8 @@ let encode m =
488488 | Binary (V128 V128Op. (F32x4 Div)) -> simd_op 0xe7l
489489 | Binary (V128 V128Op. (F32x4 Min)) -> simd_op 0xe8l
490490 | Binary (V128 V128Op. (F32x4 Max)) -> simd_op 0xe9l
491+ | Binary (V128 V128Op. (F32x4 Pmin)) -> simd_op 0xeal
492+ | Binary (V128 V128Op. (F32x4 Pmax)) -> simd_op 0xebl
491493 | Binary (V128 V128Op. (F64x2 Eq)) -> simd_op 0x47l
492494 | Binary (V128 V128Op. (F64x2 Ne)) -> simd_op 0x48l
493495 | Binary (V128 V128Op. (F64x2 Lt)) -> simd_op 0x49l
@@ -500,6 +502,8 @@ let encode m =
500502 | Binary (V128 V128Op. (F64x2 Div)) -> simd_op 0xf3l
501503 | Binary (V128 V128Op. (F64x2 Min)) -> simd_op 0xf4l
502504 | Binary (V128 V128Op. (F64x2 Max)) -> simd_op 0xf5l
505+ | Binary (V128 V128Op. (F64x2 Pmin)) -> simd_op 0xf6l
506+ | Binary (V128 V128Op. (F64x2 Pmax)) -> simd_op 0xf7l
503507 | Binary (V128 V128Op. (V128 And)) -> simd_op 0x4el
504508 | Binary (V128 V128Op. (V128 AndNot)) -> simd_op 0x4fl
505509 | Binary (V128 V128Op. (V128 Or)) -> simd_op 0x50l
Original file line number Diff line number Diff line change @@ -247,6 +247,8 @@ struct
247247 | F32x4 Div -> SXX.F32x4. div
248248 | F32x4 Min -> SXX.F32x4. min
249249 | F32x4 Max -> SXX.F32x4. max
250+ | F32x4 Pmin -> SXX.F32x4. pmin
251+ | F32x4 Pmax -> SXX.F32x4. pmax
250252 | F64x2 Eq -> SXX.F64x2. eq
251253 | F64x2 Ne -> SXX.F64x2. ne
252254 | F64x2 Lt -> SXX.F64x2. lt
@@ -259,6 +261,8 @@ struct
259261 | F64x2 Div -> SXX.F64x2. div
260262 | F64x2 Min -> SXX.F64x2. min
261263 | F64x2 Max -> SXX.F64x2. max
264+ | F64x2 Pmin -> SXX.F64x2. pmin
265+ | F64x2 Pmax -> SXX.F64x2. pmax
262266 | V128 And -> SXX.V128. and_
263267 | V128 Or -> SXX.V128. or_
264268 | V128 Xor -> SXX.V128. xor
Original file line number Diff line number Diff line change 119119 val div : t -> t -> t
120120 val min : t -> t -> t
121121 val max : t -> t -> t
122+ val pmin : t -> t -> t
123+ val pmax : t -> t -> t
122124end
123125
124126module type Vec =
@@ -268,6 +270,8 @@ struct
268270 let div = binop Float. div
269271 let min = binop Float. min
270272 let max = binop Float. max
273+ let pmin = binop (fun x y -> if Float. lt y x then y else x)
274+ let pmax = binop (fun x y -> if Float. lt x y then y else x)
271275 end
272276
273277 module MakeInt (Int : Int.S ) (Convert : sig
Original file line number Diff line number Diff line change 5757 type funop = Abs | Neg | Sqrt
5858 | Ceil | Floor | Trunc | Nearest
5959 | ConvertI32x4S | ConvertI32x4U
60- type fbinop = Add | Sub | Mul | Div | Min | Max
60+ type fbinop = Add | Sub | Mul | Div | Min | Max | Pmin | Pmax
6161 | Eq | Ne | Lt | Le | Gt | Ge
6262 type vunop = Not
6363 type vbinop = And | Or | Xor | AndNot
Original file line number Diff line number Diff line change @@ -397,6 +397,8 @@ let f32x4_min = Binary (V128 (V128Op.F32x4 V128Op.Min))
397397let f32x4_max = Binary (V128 (V128Op. F32x4 V128Op. Max ))
398398let f32x4_convert_i32x4_s = Unary (V128 V128Op. (F32x4 ConvertI32x4S ))
399399let f32x4_convert_i32x4_u = Unary (V128 V128Op. (F32x4 ConvertI32x4U ))
400+ let f32x4_pmin = Binary (V128 (V128Op. F32x4 V128Op. Pmin ))
401+ let f32x4_pmax = Binary (V128 (V128Op. F32x4 V128Op. Pmax ))
400402
401403let f64x2_splat = Convert (V128 (V128Op. F64x2 V128Op. Splat ))
402404let f64x2_extract_lane imm = SimdExtract (V128Op. F64x2 (ZX , imm))
@@ -420,3 +422,5 @@ let f64x2_div = Binary (V128 (V128Op.F64x2 V128Op.Div))
420422let f64x2_min = Binary (V128 (V128Op. F64x2 V128Op. Min ))
421423let f64x2_max = Binary (V128 (V128Op. F64x2 V128Op. Max ))
422424let f64x2_abs = Unary (V128 (V128Op. F64x2 V128Op. Abs ))
425+ let f64x2_pmin = Binary (V128 (V128Op. F64x2 V128Op. Pmin ))
426+ let f64x2_pmax = Binary (V128 (V128Op. F64x2 V128Op. Pmax ))
Original file line number Diff line number Diff line change @@ -320,6 +320,8 @@ struct
320320 | F32x4 Div -> " f32x4.div"
321321 | F32x4 Min -> " f32x4.min"
322322 | F32x4 Max -> " f32x4.max"
323+ | F32x4 Pmin -> " f32x4.pmin"
324+ | F32x4 Pmax -> " f32x4.pmax"
323325 | F64x2 Eq -> " f64x2.eq"
324326 | F64x2 Ne -> " f64x2.ne"
325327 | F64x2 Lt -> " f64x2.lt"
@@ -332,6 +334,8 @@ struct
332334 | F64x2 Div -> " f64x2.div"
333335 | F64x2 Min -> " f64x2.min"
334336 | F64x2 Max -> " f64x2.max"
337+ | F64x2 Pmin -> " f64x2.pmin"
338+ | F64x2 Pmax -> " f64x2.pmax"
335339 | V128 And -> " v128.and"
336340 | V128 AndNot -> " v128.andnot"
337341 | V128 Or -> " v128.or"
Original file line number Diff line number Diff line change @@ -494,6 +494,8 @@ rule token = parse
494494 | (simd_float_shape as s)" .floor" { UNARY (simd_float_op s f32x4_floor f64x2_floor) }
495495 | (simd_float_shape as s)" .trunc" { UNARY (simd_float_op s f32x4_trunc f64x2_trunc) }
496496 | (simd_float_shape as s)" .nearest" { UNARY (simd_float_op s f32x4_nearest f64x2_nearest) }
497+ | (simd_float_shape as s)" .pmin" { BINARY (simd_float_op s f32x4_pmin f64x2_pmin) }
498+ | (simd_float_shape as s)" .pmax" { BINARY (simd_float_op s f32x4_pmax f64x2_pmax) }
497499 | (simd_shape as s)" .add"
498500 { BINARY (simdop s i8x16_add i16x8_add i32x4_add i64x2_add f32x4_add f64x2_add) }
499501 | (simd_shape as s)" .sub"
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ Currently it only support following simd test files generation.
2424- 'simd_f64x2.wast'
2525- 'simd_f32x4_rounding'
2626- 'simd_f64x2_rounding'
27+ - 'simd_f32x4_pmin_pmax'
28+ - 'simd_f64x2_pmin_pmax'
2729
2830
2931Usage:
Original file line number Diff line number Diff line change 2828 'simd_int_arith2' ,
2929 'simd_f32x4_rounding' ,
3030 'simd_f64x2_rounding' ,
31+ 'simd_f32x4_pmin_pmax' ,
32+ 'simd_f64x2_pmin_pmax' ,
3133)
3234
3335
You can’t perform that action at this time.
0 commit comments