Skip to content

Commit

Permalink
Add iNxM.bitmask instructions (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-t-hansen authored Jun 3, 2020
1 parent 3e61902 commit 886ad50
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions crates/wasmparser/src/binary_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1526,6 +1526,7 @@ impl<'a> BinaryReader<'a> {
0x61 => Operator::I8x16Neg,
0x62 => Operator::I8x16AnyTrue,
0x63 => Operator::I8x16AllTrue,
0x64 => Operator::I8x16Bitmask,
0x65 => Operator::I8x16NarrowI16x8S,
0x66 => Operator::I8x16NarrowI16x8U,
0x6b => Operator::I8x16Shl,
Expand All @@ -1546,6 +1547,7 @@ impl<'a> BinaryReader<'a> {
0x81 => Operator::I16x8Neg,
0x82 => Operator::I16x8AnyTrue,
0x83 => Operator::I16x8AllTrue,
0x84 => Operator::I16x8Bitmask,
0x85 => Operator::I16x8NarrowI32x4S,
0x86 => Operator::I16x8NarrowI32x4U,
0x87 => Operator::I16x8WidenLowI8x16S,
Expand All @@ -1571,6 +1573,7 @@ impl<'a> BinaryReader<'a> {
0xa1 => Operator::I32x4Neg,
0xa2 => Operator::I32x4AnyTrue,
0xa3 => Operator::I32x4AllTrue,
0xa4 => Operator::I32x4Bitmask,
0xa7 => Operator::I32x4WidenLowI16x8S,
0xa8 => Operator::I32x4WidenHighI16x8S,
0xa9 => Operator::I32x4WidenLowI16x8U,
Expand Down
5 changes: 4 additions & 1 deletion crates/wasmparser/src/operators_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1903,10 +1903,13 @@ impl OperatorValidator {
}
Operator::I8x16AnyTrue
| Operator::I8x16AllTrue
| Operator::I8x16Bitmask
| Operator::I16x8AnyTrue
| Operator::I16x8AllTrue
| Operator::I16x8Bitmask
| Operator::I32x4AnyTrue
| Operator::I32x4AllTrue => {
| Operator::I32x4AllTrue
| Operator::I32x4Bitmask => {
self.check_simd_enabled()?;
self.check_operands_1(Type::V128)?;
self.func_state.change_frame_with_type(1, Type::I32)?;
Expand Down
3 changes: 3 additions & 0 deletions crates/wasmparser/src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ pub enum Operator<'a> {
I8x16Neg,
I8x16AnyTrue,
I8x16AllTrue,
I8x16Bitmask,
I8x16Shl,
I8x16ShrS,
I8x16ShrU,
Expand All @@ -634,6 +635,7 @@ pub enum Operator<'a> {
I16x8Neg,
I16x8AnyTrue,
I16x8AllTrue,
I16x8Bitmask,
I16x8Shl,
I16x8ShrS,
I16x8ShrU,
Expand All @@ -652,6 +654,7 @@ pub enum Operator<'a> {
I32x4Neg,
I32x4AnyTrue,
I32x4AllTrue,
I32x4Bitmask,
I32x4Shl,
I32x4ShrS,
I32x4ShrU,
Expand Down
3 changes: 3 additions & 0 deletions crates/wasmprinter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@ impl Printer {
I8x16Neg => self.result.push_str("i8x16.neg"),
I8x16AnyTrue => self.result.push_str("i8x16.any_true"),
I8x16AllTrue => self.result.push_str("i8x16.all_true"),
I8x16Bitmask => self.result.push_str("i8x16.bitmask"),
I8x16Shl => self.result.push_str("i8x16.shl"),
I8x16ShrU => self.result.push_str("i8x16.shr_u"),
I8x16ShrS => self.result.push_str("i8x16.shr_s"),
Expand All @@ -989,6 +990,7 @@ impl Printer {
I16x8Neg => self.result.push_str("i16x8.neg"),
I16x8AnyTrue => self.result.push_str("i16x8.any_true"),
I16x8AllTrue => self.result.push_str("i16x8.all_true"),
I16x8Bitmask => self.result.push_str("i16x8.bitmask"),
I16x8Shl => self.result.push_str("i16x8.shl"),
I16x8ShrU => self.result.push_str("i16x8.shr_u"),
I16x8ShrS => self.result.push_str("i16x8.shr_s"),
Expand All @@ -1004,6 +1006,7 @@ impl Printer {
I32x4Neg => self.result.push_str("i32x4.neg"),
I32x4AnyTrue => self.result.push_str("i32x4.any_true"),
I32x4AllTrue => self.result.push_str("i32x4.all_true"),
I32x4Bitmask => self.result.push_str("i32x4.bitmask"),
I32x4Shl => self.result.push_str("i32x4.shl"),
I32x4ShrU => self.result.push_str("i32x4.shr_u"),
I32x4ShrS => self.result.push_str("i32x4.shr_s"),
Expand Down
3 changes: 3 additions & 0 deletions crates/wast/src/ast/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ instructions! {
I8x16Neg : [0xfd, 0x61] : "i8x16.neg",
I8x16AnyTrue : [0xfd, 0x62] : "i8x16.any_true",
I8x16AllTrue : [0xfd, 0x63] : "i8x16.all_true",
I8x16Bitmask : [0xfd, 0x64] : "i8x16.bitmask",
I8x16NarrowI16x8S : [0xfd, 0x65] : "i8x16.narrow_i16x8_s",
I8x16NarrowI16x8U : [0xfd, 0x66] : "i8x16.narrow_i16x8_u",
I8x16Shl : [0xfd, 0x6b] : "i8x16.shl",
Expand All @@ -802,6 +803,7 @@ instructions! {
I16x8Neg : [0xfd, 0x81] : "i16x8.neg",
I16x8AnyTrue : [0xfd, 0x82] : "i16x8.any_true",
I16x8AllTrue : [0xfd, 0x83] : "i16x8.all_true",
I16x8Bitmask : [0xfd, 0x84] : "i16x8.bitmask",
I16x8NarrowI32x4S : [0xfd, 0x85] : "i16x8.narrow_i32x4_s",
I16x8NarrowI32x4U : [0xfd, 0x86] : "i16x8.narrow_i32x4_u",
I16x8WidenLowI8x16S : [0xfd, 0x87] : "i16x8.widen_low_i8x16_s",
Expand All @@ -828,6 +830,7 @@ instructions! {
I32x4Neg : [0xfd, 0xa1] : "i32x4.neg",
I32x4AnyTrue : [0xfd, 0xa2] : "i32x4.any_true",
I32x4AllTrue : [0xfd, 0xa3] : "i32x4.all_true",
I32x4Bitmask : [0xfd, 0xa4] : "i32x4.bitmask",
I32x4WidenLowI16x8S : [0xfd, 0xa7] : "i32x4.widen_low_i16x8_s",
I32x4WidenHighI16x8S : [0xfd, 0xa8] : "i32x4.widen_high_i16x8_s",
I32x4WidenLowI16x8U : [0xfd, 0xa9] : "i32x4.widen_low_i16x8_u",
Expand Down

0 comments on commit 886ad50

Please sign in to comment.