Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit a5eb71a

Browse files
authored
Remove unnecessary types for Bitmask (#385)
1 parent 8af851e commit a5eb71a

File tree

6 files changed

+15
-18
lines changed

6 files changed

+15
-18
lines changed

interpreter/binary/encode.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,9 +593,9 @@ let encode m =
593593
| SimdShift V128Op.(I64x2 ShrU) -> simd_op 0xcdl
594594
| SimdShift (_) -> assert false
595595

596-
| SimdBitmask V128Op.(I8x16 Bitmask) -> simd_op 0x64l
597-
| SimdBitmask V128Op.(I16x8 Bitmask) -> simd_op 0x84l
598-
| SimdBitmask V128Op.(I32x4 Bitmask) -> simd_op 0xa4l
596+
| SimdBitmask Simd.I8x16 -> simd_op 0x64l
597+
| SimdBitmask Simd.I16x8 -> simd_op 0x84l
598+
| SimdBitmask Simd.I32x4 -> simd_op 0xa4l
599599
| SimdBitmask (_) -> assert false
600600

601601
| _ -> assert false

interpreter/exec/eval_simd.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ module SimdOp (SXX : Simd.S) (Value : ValueType with type t = SXX.t) = struct
215215
| _ -> failwith "unimplemented shr_u"
216216
in fun v s -> to_value (f (of_value 1 v) (of_arg I32Value.of_value 2 s))
217217

218-
let bitmaskop (op : bitmaskop) v =
218+
let bitmaskop (op : Simd.shape) v =
219219
let f = match op with
220-
| I8x16 Bitmask -> SXX.I8x16.bitmask
221-
| I16x8 Bitmask -> SXX.I16x8.bitmask
222-
| I32x4 Bitmask -> SXX.I32x4.bitmask
220+
| Simd.I8x16 -> SXX.I8x16.bitmask
221+
| Simd.I16x8 -> SXX.I16x8.bitmask
222+
| Simd.I32x4 -> SXX.I32x4.bitmask
223223
| _ -> assert false
224224
in I32 (f (of_value 1 v))
225225

interpreter/exec/eval_simd.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ val cvtop : Ast.V128Op.cvtop -> value -> value
1010

1111
val eval_ternop : Ast.V128Op.ternop -> value -> value -> value -> value
1212
val eval_shiftop : Ast.V128Op.shiftop -> value -> value -> value
13-
val eval_bitmaskop : Ast.V128Op.bitmaskop -> value -> value
13+
val eval_bitmaskop : Simd.shape -> value -> value
1414
val eval_extractop : Ast.V128Op.extractop -> value -> value
1515
val eval_replaceop : Ast.V128Op.replaceop -> value -> value -> value

interpreter/syntax/ast.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ struct
8686
type replaceop = (int, int, int, int, int, int, int) v128op
8787
type shift = Shl | ShrS | ShrU
8888
type shiftop = (shift, shift, shift, shift, shift, shift, shift) v128op
89-
type bitmask = Bitmask
90-
type bitmaskop = (bitmask, bitmask, bitmask, bitmask, bitmask, bitmask, bitmask) v128op
9189
end
9290

9391
module I32Op = IntOp
@@ -106,7 +104,6 @@ type replaceop = V128Op.replaceop
106104
(* Ternary operators only exist for V128 types for now *)
107105
type ternop = V128Op.ternop
108106
type shiftop = V128Op.shiftop
109-
type bitmaskop = V128Op.bitmaskop
110107

111108
type 'a memop =
112109
{ty : value_type; align : int; offset : Memory.offset; sz : 'a option}
@@ -161,7 +158,7 @@ and instr' =
161158
| SimdExtract of extractop (* extract lane from v128 value *)
162159
| SimdReplace of replaceop (* replace lane of v128 value *)
163160
| SimdShift of shiftop (* shifts for v128 value *)
164-
| SimdBitmask of bitmaskop (* bitmask for v128 value *)
161+
| SimdBitmask of Simd.shape (* bitmask for v128 value *)
165162

166163

167164
(* Globals & Functions *)

interpreter/syntax/operators.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ let i8x16_ge_s = Binary (V128 V128Op.(I8x16 GeS))
266266
let i8x16_ge_u = Binary (V128 V128Op.(I8x16 GeU))
267267
let i8x16_neg = Unary (V128 V128Op.(I8x16 Neg))
268268
let i8x16_any_true = Test (V128 V128Op.(I8x16 AnyTrue))
269-
let i8x16_bitmask = SimdBitmask V128Op.(I8x16 Bitmask)
269+
let i8x16_bitmask = SimdBitmask Simd.I8x16
270270
let i8x16_all_true = Test (V128 V128Op.(I8x16 AllTrue))
271271
let i8x16_narrow_i16x8_s = Binary (V128 V128Op.(I8x16 NarrowS))
272272
let i8x16_narrow_i16x8_u = Binary (V128 V128Op.(I8x16 NarrowU))
@@ -306,7 +306,7 @@ let i16x8_ge_s = Binary (V128 V128Op.(I16x8 GeS))
306306
let i16x8_ge_u = Binary (V128 V128Op.(I16x8 GeU))
307307
let i16x8_neg = Unary (V128 V128Op.(I16x8 Neg))
308308
let i16x8_any_true = Test (V128 V128Op.(I16x8 AnyTrue))
309-
let i16x8_bitmask = SimdBitmask V128Op.(I16x8 Bitmask)
309+
let i16x8_bitmask = SimdBitmask Simd.I16x8
310310
let i16x8_all_true = Test (V128 V128Op.(I16x8 AllTrue))
311311
let i16x8_narrow_i32x4_s = Binary (V128 V128Op.(I16x8 NarrowS))
312312
let i16x8_narrow_i32x4_u = Binary (V128 V128Op.(I16x8 NarrowU))
@@ -343,7 +343,7 @@ let i32x4_ge_u = Binary (V128 V128Op.(I32x4 GeU))
343343
let i32x4_abs = Unary (V128 V128Op.(I32x4 Abs))
344344
let i32x4_neg = Unary (V128 V128Op.(I32x4 Neg))
345345
let i32x4_any_true = Test (V128 V128Op.(I32x4 AnyTrue))
346-
let i32x4_bitmask = SimdBitmask V128Op.(I32x4 Bitmask)
346+
let i32x4_bitmask = SimdBitmask Simd.I32x4
347347
let i32x4_all_true = Test (V128 V128Op.(I32x4 AllTrue))
348348
let i32x4_widen_low_i16x8_s = Unary (V128 V128Op.(I32x4 WidenLowS))
349349
let i32x4_widen_high_i16x8_s = Unary (V128 V128Op.(I32x4 WidenHighS))

interpreter/text/arrange.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,9 @@ struct
390390
| _ -> assert false
391391

392392
let bitmaskop = function
393-
| I8x16 Bitmask -> "i8x16.bitmask"
394-
| I16x8 Bitmask -> "i16x8.bitmask"
395-
| I32x4 Bitmask -> "i32x4.bitmask"
393+
| Simd.I8x16 -> "i8x16.bitmask"
394+
| Simd.I16x8 -> "i16x8.bitmask"
395+
| Simd.I32x4 -> "i32x4.bitmask"
396396
| _ -> assert false
397397

398398
end

0 commit comments

Comments
 (0)