Add support for Wasm-SIMD ops.

This commit is contained in:
Chris Fallin 2024-03-27 16:01:14 -07:00
parent 1878db1c1d
commit cea6e7a403
5 changed files with 2377 additions and 1 deletions

View file

@ -514,6 +514,401 @@ impl<'a> WasmFuncBackend<'a> {
Operator::MemoryGrow { mem } => { Operator::MemoryGrow { mem } => {
Some(wasm_encoder::Instruction::MemoryGrow(mem.index() as u32)) Some(wasm_encoder::Instruction::MemoryGrow(mem.index() as u32))
} }
Operator::V128Load { memory } => Some(wasm_encoder::Instruction::V128Load(
wasm_encoder::MemArg::from(*memory),
)),
Operator::V128Load8x8S { memory } => Some(wasm_encoder::Instruction::V128Load8x8S(
wasm_encoder::MemArg::from(*memory),
)),
Operator::V128Load8x8U { memory } => Some(wasm_encoder::Instruction::V128Load8x8U(
wasm_encoder::MemArg::from(*memory),
)),
Operator::V128Load16x4S { memory } => Some(wasm_encoder::Instruction::V128Load16x4S(
wasm_encoder::MemArg::from(*memory),
)),
Operator::V128Load16x4U { memory } => Some(wasm_encoder::Instruction::V128Load16x4U(
wasm_encoder::MemArg::from(*memory),
)),
Operator::V128Load32x2S { memory } => Some(wasm_encoder::Instruction::V128Load32x2S(
wasm_encoder::MemArg::from(*memory),
)),
Operator::V128Load32x2U { memory } => Some(wasm_encoder::Instruction::V128Load32x2U(
wasm_encoder::MemArg::from(*memory),
)),
Operator::V128Load8Splat { memory } => Some(wasm_encoder::Instruction::V128Load8Splat(
wasm_encoder::MemArg::from(*memory),
)),
Operator::V128Load16Splat { memory } => Some(
wasm_encoder::Instruction::V128Load16Splat(wasm_encoder::MemArg::from(*memory)),
),
Operator::V128Load32Splat { memory } => Some(
wasm_encoder::Instruction::V128Load32Splat(wasm_encoder::MemArg::from(*memory)),
),
Operator::V128Load64Splat { memory } => Some(
wasm_encoder::Instruction::V128Load64Splat(wasm_encoder::MemArg::from(*memory)),
),
Operator::V128Load32Zero { memory } => Some(wasm_encoder::Instruction::V128Load32Zero(
wasm_encoder::MemArg::from(*memory),
)),
Operator::V128Load64Zero { memory } => Some(wasm_encoder::Instruction::V128Load64Zero(
wasm_encoder::MemArg::from(*memory),
)),
Operator::V128Store { memory } => Some(wasm_encoder::Instruction::V128Store(
wasm_encoder::MemArg::from(*memory),
)),
Operator::V128Load8Lane { memory, lane } => {
Some(wasm_encoder::Instruction::V128Load8Lane {
memarg: wasm_encoder::MemArg::from(*memory),
lane: *lane,
})
}
Operator::V128Load16Lane { memory, lane } => {
Some(wasm_encoder::Instruction::V128Load16Lane {
memarg: wasm_encoder::MemArg::from(*memory),
lane: *lane,
})
}
Operator::V128Load32Lane { memory, lane } => {
Some(wasm_encoder::Instruction::V128Load32Lane {
memarg: wasm_encoder::MemArg::from(*memory),
lane: *lane,
})
}
Operator::V128Load64Lane { memory, lane } => {
Some(wasm_encoder::Instruction::V128Load64Lane {
memarg: wasm_encoder::MemArg::from(*memory),
lane: *lane,
})
}
Operator::V128Store8Lane { memory, lane } => {
Some(wasm_encoder::Instruction::V128Store8Lane {
memarg: wasm_encoder::MemArg::from(*memory),
lane: *lane,
})
}
Operator::V128Store16Lane { memory, lane } => {
Some(wasm_encoder::Instruction::V128Store16Lane {
memarg: wasm_encoder::MemArg::from(*memory),
lane: *lane,
})
}
Operator::V128Store32Lane { memory, lane } => {
Some(wasm_encoder::Instruction::V128Store32Lane {
memarg: wasm_encoder::MemArg::from(*memory),
lane: *lane,
})
}
Operator::V128Store64Lane { memory, lane } => {
Some(wasm_encoder::Instruction::V128Store64Lane {
memarg: wasm_encoder::MemArg::from(*memory),
lane: *lane,
})
}
Operator::V128Const { value } => {
Some(wasm_encoder::Instruction::V128Const(*value as i128))
}
Operator::I8x16Shuffle { lanes } => {
Some(wasm_encoder::Instruction::I8x16Shuffle(lanes.clone()))
}
Operator::I8x16ExtractLaneS { lane } => {
Some(wasm_encoder::Instruction::I8x16ExtractLaneS(*lane))
}
Operator::I8x16ExtractLaneU { lane } => {
Some(wasm_encoder::Instruction::I8x16ExtractLaneU(*lane))
}
Operator::I8x16ReplaceLane { lane } => {
Some(wasm_encoder::Instruction::I8x16ReplaceLane(*lane))
}
Operator::I16x8ExtractLaneS { lane } => {
Some(wasm_encoder::Instruction::I16x8ExtractLaneS(*lane))
}
Operator::I16x8ExtractLaneU { lane } => {
Some(wasm_encoder::Instruction::I16x8ExtractLaneU(*lane))
}
Operator::I16x8ReplaceLane { lane } => {
Some(wasm_encoder::Instruction::I16x8ReplaceLane(*lane))
}
Operator::I32x4ExtractLane { lane } => {
Some(wasm_encoder::Instruction::I32x4ExtractLane(*lane))
}
Operator::I32x4ReplaceLane { lane } => {
Some(wasm_encoder::Instruction::I32x4ReplaceLane(*lane))
}
Operator::I64x2ExtractLane { lane } => {
Some(wasm_encoder::Instruction::I64x2ExtractLane(*lane))
}
Operator::I64x2ReplaceLane { lane } => {
Some(wasm_encoder::Instruction::I64x2ReplaceLane(*lane))
}
Operator::F32x4ExtractLane { lane } => {
Some(wasm_encoder::Instruction::F32x4ExtractLane(*lane))
}
Operator::F32x4ReplaceLane { lane } => {
Some(wasm_encoder::Instruction::F32x4ReplaceLane(*lane))
}
Operator::F64x2ExtractLane { lane } => {
Some(wasm_encoder::Instruction::F64x2ExtractLane(*lane))
}
Operator::F64x2ReplaceLane { lane } => {
Some(wasm_encoder::Instruction::F64x2ReplaceLane(*lane))
}
Operator::I8x16Swizzle => Some(wasm_encoder::Instruction::I8x16Swizzle),
Operator::I8x16Splat => Some(wasm_encoder::Instruction::I8x16Splat),
Operator::I16x8Splat => Some(wasm_encoder::Instruction::I16x8Splat),
Operator::I32x4Splat => Some(wasm_encoder::Instruction::I32x4Splat),
Operator::I64x2Splat => Some(wasm_encoder::Instruction::I64x2Splat),
Operator::F32x4Splat => Some(wasm_encoder::Instruction::F32x4Splat),
Operator::F64x2Splat => Some(wasm_encoder::Instruction::F64x2Splat),
Operator::I8x16Eq => Some(wasm_encoder::Instruction::I8x16Eq),
Operator::I8x16Ne => Some(wasm_encoder::Instruction::I8x16Ne),
Operator::I8x16LtS => Some(wasm_encoder::Instruction::I8x16LtS),
Operator::I8x16LtU => Some(wasm_encoder::Instruction::I8x16LtU),
Operator::I8x16GtS => Some(wasm_encoder::Instruction::I8x16GtS),
Operator::I8x16GtU => Some(wasm_encoder::Instruction::I8x16GtU),
Operator::I8x16LeS => Some(wasm_encoder::Instruction::I8x16LeS),
Operator::I8x16LeU => Some(wasm_encoder::Instruction::I8x16LeU),
Operator::I8x16GeS => Some(wasm_encoder::Instruction::I8x16GeS),
Operator::I8x16GeU => Some(wasm_encoder::Instruction::I8x16GeU),
Operator::I16x8Eq => Some(wasm_encoder::Instruction::I16x8Eq),
Operator::I16x8Ne => Some(wasm_encoder::Instruction::I16x8Ne),
Operator::I16x8LtS => Some(wasm_encoder::Instruction::I16x8LtS),
Operator::I16x8LtU => Some(wasm_encoder::Instruction::I16x8LtU),
Operator::I16x8GtS => Some(wasm_encoder::Instruction::I16x8GtS),
Operator::I16x8GtU => Some(wasm_encoder::Instruction::I16x8GtU),
Operator::I16x8LeS => Some(wasm_encoder::Instruction::I16x8LeS),
Operator::I16x8LeU => Some(wasm_encoder::Instruction::I16x8LeU),
Operator::I16x8GeS => Some(wasm_encoder::Instruction::I16x8GeS),
Operator::I16x8GeU => Some(wasm_encoder::Instruction::I16x8GeU),
Operator::I32x4Eq => Some(wasm_encoder::Instruction::I32x4Eq),
Operator::I32x4Ne => Some(wasm_encoder::Instruction::I32x4Ne),
Operator::I32x4LtS => Some(wasm_encoder::Instruction::I32x4LtS),
Operator::I32x4LtU => Some(wasm_encoder::Instruction::I32x4LtU),
Operator::I32x4GtS => Some(wasm_encoder::Instruction::I32x4GtS),
Operator::I32x4GtU => Some(wasm_encoder::Instruction::I32x4GtU),
Operator::I32x4LeS => Some(wasm_encoder::Instruction::I32x4LeS),
Operator::I32x4LeU => Some(wasm_encoder::Instruction::I32x4LeU),
Operator::I32x4GeS => Some(wasm_encoder::Instruction::I32x4GeS),
Operator::I32x4GeU => Some(wasm_encoder::Instruction::I32x4GeU),
Operator::I64x2Eq => Some(wasm_encoder::Instruction::I64x2Eq),
Operator::I64x2Ne => Some(wasm_encoder::Instruction::I64x2Ne),
Operator::I64x2LtS => Some(wasm_encoder::Instruction::I64x2LtS),
Operator::I64x2GtS => Some(wasm_encoder::Instruction::I64x2GtS),
Operator::I64x2LeS => Some(wasm_encoder::Instruction::I64x2LeS),
Operator::I64x2GeS => Some(wasm_encoder::Instruction::I64x2GeS),
Operator::F32x4Eq => Some(wasm_encoder::Instruction::F32x4Eq),
Operator::F32x4Ne => Some(wasm_encoder::Instruction::F32x4Ne),
Operator::F32x4Lt => Some(wasm_encoder::Instruction::F32x4Lt),
Operator::F32x4Gt => Some(wasm_encoder::Instruction::F32x4Gt),
Operator::F32x4Le => Some(wasm_encoder::Instruction::F32x4Le),
Operator::F32x4Ge => Some(wasm_encoder::Instruction::F32x4Ge),
Operator::F64x2Eq => Some(wasm_encoder::Instruction::F64x2Eq),
Operator::F64x2Ne => Some(wasm_encoder::Instruction::F64x2Ne),
Operator::F64x2Lt => Some(wasm_encoder::Instruction::F64x2Lt),
Operator::F64x2Gt => Some(wasm_encoder::Instruction::F64x2Gt),
Operator::F64x2Le => Some(wasm_encoder::Instruction::F64x2Le),
Operator::F64x2Ge => Some(wasm_encoder::Instruction::F64x2Ge),
Operator::V128Not => Some(wasm_encoder::Instruction::V128Not),
Operator::V128And => Some(wasm_encoder::Instruction::V128And),
Operator::V128AndNot => Some(wasm_encoder::Instruction::V128AndNot),
Operator::V128Or => Some(wasm_encoder::Instruction::V128Or),
Operator::V128Xor => Some(wasm_encoder::Instruction::V128Xor),
Operator::V128Bitselect => Some(wasm_encoder::Instruction::V128Bitselect),
Operator::V128AnyTrue => Some(wasm_encoder::Instruction::V128AnyTrue),
Operator::I8x16Abs => Some(wasm_encoder::Instruction::I8x16Abs),
Operator::I8x16Neg => Some(wasm_encoder::Instruction::I8x16Neg),
Operator::I8x16Popcnt => Some(wasm_encoder::Instruction::I8x16Popcnt),
Operator::I8x16AllTrue => Some(wasm_encoder::Instruction::I8x16AllTrue),
Operator::I8x16Bitmask => Some(wasm_encoder::Instruction::I8x16Bitmask),
Operator::I8x16NarrowI16x8S => Some(wasm_encoder::Instruction::I8x16NarrowI16x8S),
Operator::I8x16NarrowI16x8U => Some(wasm_encoder::Instruction::I8x16NarrowI16x8U),
Operator::I8x16Shl => Some(wasm_encoder::Instruction::I8x16Shl),
Operator::I8x16ShrS => Some(wasm_encoder::Instruction::I8x16ShrS),
Operator::I8x16ShrU => Some(wasm_encoder::Instruction::I8x16ShrU),
Operator::I8x16Add => Some(wasm_encoder::Instruction::I8x16Add),
Operator::I8x16AddSatS => Some(wasm_encoder::Instruction::I8x16AddSatS),
Operator::I8x16AddSatU => Some(wasm_encoder::Instruction::I8x16AddSatU),
Operator::I8x16Sub => Some(wasm_encoder::Instruction::I8x16Sub),
Operator::I8x16SubSatS => Some(wasm_encoder::Instruction::I8x16SubSatS),
Operator::I8x16SubSatU => Some(wasm_encoder::Instruction::I8x16SubSatU),
Operator::I8x16MinS => Some(wasm_encoder::Instruction::I8x16MinS),
Operator::I8x16MinU => Some(wasm_encoder::Instruction::I8x16MinU),
Operator::I8x16MaxS => Some(wasm_encoder::Instruction::I8x16MaxS),
Operator::I8x16MaxU => Some(wasm_encoder::Instruction::I8x16MaxU),
Operator::I8x16AvgrU => Some(wasm_encoder::Instruction::I8x16AvgrU),
Operator::I16x8ExtAddPairwiseI8x16S => {
Some(wasm_encoder::Instruction::I16x8ExtAddPairwiseI8x16S)
}
Operator::I16x8ExtAddPairwiseI8x16U => {
Some(wasm_encoder::Instruction::I16x8ExtAddPairwiseI8x16U)
}
Operator::I16x8Abs => Some(wasm_encoder::Instruction::I16x8Abs),
Operator::I16x8Neg => Some(wasm_encoder::Instruction::I16x8Neg),
Operator::I16x8Q15MulrSatS => Some(wasm_encoder::Instruction::I16x8Q15MulrSatS),
Operator::I16x8AllTrue => Some(wasm_encoder::Instruction::I16x8AllTrue),
Operator::I16x8Bitmask => Some(wasm_encoder::Instruction::I16x8Bitmask),
Operator::I16x8NarrowI32x4S => Some(wasm_encoder::Instruction::I16x8NarrowI32x4S),
Operator::I16x8NarrowI32x4U => Some(wasm_encoder::Instruction::I16x8NarrowI32x4U),
Operator::I16x8ExtendLowI8x16S => Some(wasm_encoder::Instruction::I16x8ExtendLowI8x16S),
Operator::I16x8ExtendHighI8x16S => {
Some(wasm_encoder::Instruction::I16x8ExtendHighI8x16S)
}
Operator::I16x8ExtendLowI8x16U => Some(wasm_encoder::Instruction::I16x8ExtendLowI8x16U),
Operator::I16x8ExtendHighI8x16U => {
Some(wasm_encoder::Instruction::I16x8ExtendHighI8x16U)
}
Operator::I16x8Shl => Some(wasm_encoder::Instruction::I16x8Shl),
Operator::I16x8ShrS => Some(wasm_encoder::Instruction::I16x8ShrS),
Operator::I16x8ShrU => Some(wasm_encoder::Instruction::I16x8ShrU),
Operator::I16x8Add => Some(wasm_encoder::Instruction::I16x8Add),
Operator::I16x8AddSatS => Some(wasm_encoder::Instruction::I16x8AddSatS),
Operator::I16x8AddSatU => Some(wasm_encoder::Instruction::I16x8AddSatU),
Operator::I16x8Sub => Some(wasm_encoder::Instruction::I16x8Sub),
Operator::I16x8SubSatS => Some(wasm_encoder::Instruction::I16x8SubSatS),
Operator::I16x8SubSatU => Some(wasm_encoder::Instruction::I16x8SubSatU),
Operator::I16x8Mul => Some(wasm_encoder::Instruction::I16x8Mul),
Operator::I16x8MinS => Some(wasm_encoder::Instruction::I16x8MinS),
Operator::I16x8MinU => Some(wasm_encoder::Instruction::I16x8MinU),
Operator::I16x8MaxS => Some(wasm_encoder::Instruction::I16x8MaxS),
Operator::I16x8MaxU => Some(wasm_encoder::Instruction::I16x8MaxU),
Operator::I16x8AvgrU => Some(wasm_encoder::Instruction::I16x8AvgrU),
Operator::I16x8ExtMulLowI8x16S => Some(wasm_encoder::Instruction::I16x8ExtMulLowI8x16S),
Operator::I16x8ExtMulHighI8x16S => {
Some(wasm_encoder::Instruction::I16x8ExtMulHighI8x16S)
}
Operator::I16x8ExtMulLowI8x16U => Some(wasm_encoder::Instruction::I16x8ExtMulLowI8x16U),
Operator::I16x8ExtMulHighI8x16U => {
Some(wasm_encoder::Instruction::I16x8ExtMulHighI8x16U)
}
Operator::I32x4ExtAddPairwiseI16x8S => {
Some(wasm_encoder::Instruction::I32x4ExtAddPairwiseI16x8S)
}
Operator::I32x4ExtAddPairwiseI16x8U => {
Some(wasm_encoder::Instruction::I32x4ExtAddPairwiseI16x8U)
}
Operator::I32x4Abs => Some(wasm_encoder::Instruction::I32x4Abs),
Operator::I32x4Neg => Some(wasm_encoder::Instruction::I32x4Neg),
Operator::I32x4AllTrue => Some(wasm_encoder::Instruction::I32x4AllTrue),
Operator::I32x4Bitmask => Some(wasm_encoder::Instruction::I32x4Bitmask),
Operator::I32x4ExtendLowI16x8S => Some(wasm_encoder::Instruction::I32x4ExtendLowI16x8S),
Operator::I32x4ExtendHighI16x8S => {
Some(wasm_encoder::Instruction::I32x4ExtendHighI16x8S)
}
Operator::I32x4ExtendLowI16x8U => Some(wasm_encoder::Instruction::I32x4ExtendLowI16x8U),
Operator::I32x4ExtendHighI16x8U => {
Some(wasm_encoder::Instruction::I32x4ExtendHighI16x8U)
}
Operator::I32x4Shl => Some(wasm_encoder::Instruction::I32x4Shl),
Operator::I32x4ShrS => Some(wasm_encoder::Instruction::I32x4ShrS),
Operator::I32x4ShrU => Some(wasm_encoder::Instruction::I32x4ShrU),
Operator::I32x4Add => Some(wasm_encoder::Instruction::I32x4Add),
Operator::I32x4Sub => Some(wasm_encoder::Instruction::I32x4Sub),
Operator::I32x4Mul => Some(wasm_encoder::Instruction::I32x4Mul),
Operator::I32x4MinS => Some(wasm_encoder::Instruction::I32x4MinS),
Operator::I32x4MinU => Some(wasm_encoder::Instruction::I32x4MinU),
Operator::I32x4MaxS => Some(wasm_encoder::Instruction::I32x4MaxS),
Operator::I32x4MaxU => Some(wasm_encoder::Instruction::I32x4MaxU),
Operator::I32x4DotI16x8S => Some(wasm_encoder::Instruction::I32x4DotI16x8S),
Operator::I32x4ExtMulLowI16x8S => Some(wasm_encoder::Instruction::I32x4ExtMulLowI16x8S),
Operator::I32x4ExtMulHighI16x8S => {
Some(wasm_encoder::Instruction::I32x4ExtMulHighI16x8S)
}
Operator::I32x4ExtMulLowI16x8U => Some(wasm_encoder::Instruction::I32x4ExtMulLowI16x8U),
Operator::I32x4ExtMulHighI16x8U => {
Some(wasm_encoder::Instruction::I32x4ExtMulHighI16x8U)
}
Operator::I64x2Abs => Some(wasm_encoder::Instruction::I64x2Abs),
Operator::I64x2Neg => Some(wasm_encoder::Instruction::I64x2Neg),
Operator::I64x2AllTrue => Some(wasm_encoder::Instruction::I64x2AllTrue),
Operator::I64x2Bitmask => Some(wasm_encoder::Instruction::I64x2Bitmask),
Operator::I64x2ExtendLowI32x4S => Some(wasm_encoder::Instruction::I64x2ExtendLowI32x4S),
Operator::I64x2ExtendHighI32x4S => {
Some(wasm_encoder::Instruction::I64x2ExtendHighI32x4S)
}
Operator::I64x2ExtendLowI32x4U => Some(wasm_encoder::Instruction::I64x2ExtendLowI32x4U),
Operator::I64x2ExtendHighI32x4U => {
Some(wasm_encoder::Instruction::I64x2ExtendHighI32x4U)
}
Operator::I64x2Shl => Some(wasm_encoder::Instruction::I64x2Shl),
Operator::I64x2ShrS => Some(wasm_encoder::Instruction::I64x2ShrS),
Operator::I64x2ShrU => Some(wasm_encoder::Instruction::I64x2ShrU),
Operator::I64x2Add => Some(wasm_encoder::Instruction::I64x2Add),
Operator::I64x2Sub => Some(wasm_encoder::Instruction::I64x2Sub),
Operator::I64x2Mul => Some(wasm_encoder::Instruction::I64x2Mul),
Operator::I64x2ExtMulLowI32x4S => Some(wasm_encoder::Instruction::I64x2ExtMulLowI32x4S),
Operator::I64x2ExtMulHighI32x4S => {
Some(wasm_encoder::Instruction::I64x2ExtMulHighI32x4S)
}
Operator::I64x2ExtMulLowI32x4U => Some(wasm_encoder::Instruction::I64x2ExtMulLowI32x4U),
Operator::I64x2ExtMulHighI32x4U => {
Some(wasm_encoder::Instruction::I64x2ExtMulHighI32x4U)
}
Operator::F32x4Ceil => Some(wasm_encoder::Instruction::F32x4Ceil),
Operator::F32x4Floor => Some(wasm_encoder::Instruction::F32x4Floor),
Operator::F32x4Trunc => Some(wasm_encoder::Instruction::F32x4Trunc),
Operator::F32x4Nearest => Some(wasm_encoder::Instruction::F32x4Nearest),
Operator::F32x4Abs => Some(wasm_encoder::Instruction::F32x4Abs),
Operator::F32x4Neg => Some(wasm_encoder::Instruction::F32x4Neg),
Operator::F32x4Sqrt => Some(wasm_encoder::Instruction::F32x4Sqrt),
Operator::F32x4Add => Some(wasm_encoder::Instruction::F32x4Add),
Operator::F32x4Sub => Some(wasm_encoder::Instruction::F32x4Sub),
Operator::F32x4Mul => Some(wasm_encoder::Instruction::F32x4Mul),
Operator::F32x4Div => Some(wasm_encoder::Instruction::F32x4Div),
Operator::F32x4Min => Some(wasm_encoder::Instruction::F32x4Min),
Operator::F32x4Max => Some(wasm_encoder::Instruction::F32x4Max),
Operator::F32x4PMin => Some(wasm_encoder::Instruction::F32x4PMin),
Operator::F32x4PMax => Some(wasm_encoder::Instruction::F32x4PMax),
Operator::F64x2Ceil => Some(wasm_encoder::Instruction::F64x2Ceil),
Operator::F64x2Floor => Some(wasm_encoder::Instruction::F64x2Floor),
Operator::F64x2Trunc => Some(wasm_encoder::Instruction::F64x2Trunc),
Operator::F64x2Nearest => Some(wasm_encoder::Instruction::F64x2Nearest),
Operator::F64x2Abs => Some(wasm_encoder::Instruction::F64x2Abs),
Operator::F64x2Neg => Some(wasm_encoder::Instruction::F64x2Neg),
Operator::F64x2Sqrt => Some(wasm_encoder::Instruction::F64x2Sqrt),
Operator::F64x2Add => Some(wasm_encoder::Instruction::F64x2Add),
Operator::F64x2Sub => Some(wasm_encoder::Instruction::F64x2Sub),
Operator::F64x2Mul => Some(wasm_encoder::Instruction::F64x2Mul),
Operator::F64x2Div => Some(wasm_encoder::Instruction::F64x2Div),
Operator::F64x2Min => Some(wasm_encoder::Instruction::F64x2Min),
Operator::F64x2Max => Some(wasm_encoder::Instruction::F64x2Max),
Operator::F64x2PMin => Some(wasm_encoder::Instruction::F64x2PMin),
Operator::F64x2PMax => Some(wasm_encoder::Instruction::F64x2PMax),
Operator::I32x4TruncSatF32x4S => Some(wasm_encoder::Instruction::I32x4TruncSatF32x4S),
Operator::I32x4TruncSatF32x4U => Some(wasm_encoder::Instruction::I32x4TruncSatF32x4U),
Operator::F32x4ConvertI32x4S => Some(wasm_encoder::Instruction::F32x4ConvertI32x4S),
Operator::F32x4ConvertI32x4U => Some(wasm_encoder::Instruction::F32x4ConvertI32x4U),
Operator::I32x4TruncSatF64x2SZero => {
Some(wasm_encoder::Instruction::I32x4TruncSatF64x2SZero)
}
Operator::I32x4TruncSatF64x2UZero => {
Some(wasm_encoder::Instruction::I32x4TruncSatF64x2UZero)
}
Operator::F64x2ConvertLowI32x4S => {
Some(wasm_encoder::Instruction::F64x2ConvertLowI32x4S)
}
Operator::F64x2ConvertLowI32x4U => {
Some(wasm_encoder::Instruction::F64x2ConvertLowI32x4U)
}
Operator::F32x4DemoteF64x2Zero => Some(wasm_encoder::Instruction::F32x4DemoteF64x2Zero),
Operator::F64x2PromoteLowF32x4 => Some(wasm_encoder::Instruction::F64x2PromoteLowF32x4),
}; };
if let Some(inst) = inst { if let Some(inst) = inst {

View file

@ -1151,7 +1151,243 @@ impl<'a, 'b> FunctionBodyBuilder<'a, 'b> {
| wasmparser::Operator::TableGet { .. } | wasmparser::Operator::TableGet { .. }
| wasmparser::Operator::TableSet { .. } | wasmparser::Operator::TableSet { .. }
| wasmparser::Operator::TableGrow { .. } | wasmparser::Operator::TableGrow { .. }
| wasmparser::Operator::TableSize { .. } => { | wasmparser::Operator::TableSize { .. }
| wasmparser::Operator::V128Load { .. }
| wasmparser::Operator::V128Load8x8S { .. }
| wasmparser::Operator::V128Load8x8U { .. }
| wasmparser::Operator::V128Load16x4S { .. }
| wasmparser::Operator::V128Load16x4U { .. }
| wasmparser::Operator::V128Load32x2S { .. }
| wasmparser::Operator::V128Load32x2U { .. }
| wasmparser::Operator::V128Load8Splat { .. }
| wasmparser::Operator::V128Load16Splat { .. }
| wasmparser::Operator::V128Load32Splat { .. }
| wasmparser::Operator::V128Load64Splat { .. }
| wasmparser::Operator::V128Load32Zero { .. }
| wasmparser::Operator::V128Load64Zero { .. }
| wasmparser::Operator::V128Store { .. }
| wasmparser::Operator::V128Load8Lane { .. }
| wasmparser::Operator::V128Load16Lane { .. }
| wasmparser::Operator::V128Load32Lane { .. }
| wasmparser::Operator::V128Load64Lane { .. }
| wasmparser::Operator::V128Store8Lane { .. }
| wasmparser::Operator::V128Store16Lane { .. }
| wasmparser::Operator::V128Store32Lane { .. }
| wasmparser::Operator::V128Store64Lane { .. }
| wasmparser::Operator::V128Const { .. }
| wasmparser::Operator::I8x16Shuffle { .. }
| wasmparser::Operator::I8x16ExtractLaneS { .. }
| wasmparser::Operator::I8x16ExtractLaneU { .. }
| wasmparser::Operator::I8x16ReplaceLane { .. }
| wasmparser::Operator::I16x8ExtractLaneS { .. }
| wasmparser::Operator::I16x8ExtractLaneU { .. }
| wasmparser::Operator::I16x8ReplaceLane { .. }
| wasmparser::Operator::I32x4ExtractLane { .. }
| wasmparser::Operator::I32x4ReplaceLane { .. }
| wasmparser::Operator::I64x2ExtractLane { .. }
| wasmparser::Operator::I64x2ReplaceLane { .. }
| wasmparser::Operator::F32x4ExtractLane { .. }
| wasmparser::Operator::F32x4ReplaceLane { .. }
| wasmparser::Operator::F64x2ExtractLane { .. }
| wasmparser::Operator::F64x2ReplaceLane { .. }
| wasmparser::Operator::I8x16Swizzle
| wasmparser::Operator::I8x16Splat
| wasmparser::Operator::I16x8Splat
| wasmparser::Operator::I32x4Splat
| wasmparser::Operator::I64x2Splat
| wasmparser::Operator::F32x4Splat
| wasmparser::Operator::F64x2Splat
| wasmparser::Operator::I8x16Eq
| wasmparser::Operator::I8x16Ne
| wasmparser::Operator::I8x16LtS
| wasmparser::Operator::I8x16LtU
| wasmparser::Operator::I8x16GtS
| wasmparser::Operator::I8x16GtU
| wasmparser::Operator::I8x16LeS
| wasmparser::Operator::I8x16LeU
| wasmparser::Operator::I8x16GeS
| wasmparser::Operator::I8x16GeU
| wasmparser::Operator::I16x8Eq
| wasmparser::Operator::I16x8Ne
| wasmparser::Operator::I16x8LtS
| wasmparser::Operator::I16x8LtU
| wasmparser::Operator::I16x8GtS
| wasmparser::Operator::I16x8GtU
| wasmparser::Operator::I16x8LeS
| wasmparser::Operator::I16x8LeU
| wasmparser::Operator::I16x8GeS
| wasmparser::Operator::I16x8GeU
| wasmparser::Operator::I32x4Eq
| wasmparser::Operator::I32x4Ne
| wasmparser::Operator::I32x4LtS
| wasmparser::Operator::I32x4LtU
| wasmparser::Operator::I32x4GtS
| wasmparser::Operator::I32x4GtU
| wasmparser::Operator::I32x4LeS
| wasmparser::Operator::I32x4LeU
| wasmparser::Operator::I32x4GeS
| wasmparser::Operator::I32x4GeU
| wasmparser::Operator::I64x2Eq
| wasmparser::Operator::I64x2Ne
| wasmparser::Operator::I64x2LtS
| wasmparser::Operator::I64x2GtS
| wasmparser::Operator::I64x2LeS
| wasmparser::Operator::I64x2GeS
| wasmparser::Operator::F32x4Eq
| wasmparser::Operator::F32x4Ne
| wasmparser::Operator::F32x4Lt
| wasmparser::Operator::F32x4Gt
| wasmparser::Operator::F32x4Le
| wasmparser::Operator::F32x4Ge
| wasmparser::Operator::F64x2Eq
| wasmparser::Operator::F64x2Ne
| wasmparser::Operator::F64x2Lt
| wasmparser::Operator::F64x2Gt
| wasmparser::Operator::F64x2Le
| wasmparser::Operator::F64x2Ge
| wasmparser::Operator::V128Not
| wasmparser::Operator::V128And
| wasmparser::Operator::V128AndNot
| wasmparser::Operator::V128Or
| wasmparser::Operator::V128Xor
| wasmparser::Operator::V128Bitselect
| wasmparser::Operator::V128AnyTrue
| wasmparser::Operator::I8x16Abs
| wasmparser::Operator::I8x16Neg
| wasmparser::Operator::I8x16Popcnt
| wasmparser::Operator::I8x16AllTrue
| wasmparser::Operator::I8x16Bitmask
| wasmparser::Operator::I8x16NarrowI16x8S
| wasmparser::Operator::I8x16NarrowI16x8U
| wasmparser::Operator::I8x16Shl
| wasmparser::Operator::I8x16ShrS
| wasmparser::Operator::I8x16ShrU
| wasmparser::Operator::I8x16Add
| wasmparser::Operator::I8x16AddSatS
| wasmparser::Operator::I8x16AddSatU
| wasmparser::Operator::I8x16Sub
| wasmparser::Operator::I8x16SubSatS
| wasmparser::Operator::I8x16SubSatU
| wasmparser::Operator::I8x16MinS
| wasmparser::Operator::I8x16MinU
| wasmparser::Operator::I8x16MaxS
| wasmparser::Operator::I8x16MaxU
| wasmparser::Operator::I8x16AvgrU
| wasmparser::Operator::I16x8ExtAddPairwiseI8x16S
| wasmparser::Operator::I16x8ExtAddPairwiseI8x16U
| wasmparser::Operator::I16x8Abs
| wasmparser::Operator::I16x8Neg
| wasmparser::Operator::I16x8Q15MulrSatS
| wasmparser::Operator::I16x8AllTrue
| wasmparser::Operator::I16x8Bitmask
| wasmparser::Operator::I16x8NarrowI32x4S
| wasmparser::Operator::I16x8NarrowI32x4U
| wasmparser::Operator::I16x8ExtendLowI8x16S
| wasmparser::Operator::I16x8ExtendHighI8x16S
| wasmparser::Operator::I16x8ExtendLowI8x16U
| wasmparser::Operator::I16x8ExtendHighI8x16U
| wasmparser::Operator::I16x8Shl
| wasmparser::Operator::I16x8ShrS
| wasmparser::Operator::I16x8ShrU
| wasmparser::Operator::I16x8Add
| wasmparser::Operator::I16x8AddSatS
| wasmparser::Operator::I16x8AddSatU
| wasmparser::Operator::I16x8Sub
| wasmparser::Operator::I16x8SubSatS
| wasmparser::Operator::I16x8SubSatU
| wasmparser::Operator::I16x8Mul
| wasmparser::Operator::I16x8MinS
| wasmparser::Operator::I16x8MinU
| wasmparser::Operator::I16x8MaxS
| wasmparser::Operator::I16x8MaxU
| wasmparser::Operator::I16x8AvgrU
| wasmparser::Operator::I16x8ExtMulLowI8x16S
| wasmparser::Operator::I16x8ExtMulHighI8x16S
| wasmparser::Operator::I16x8ExtMulLowI8x16U
| wasmparser::Operator::I16x8ExtMulHighI8x16U
| wasmparser::Operator::I32x4ExtAddPairwiseI16x8S
| wasmparser::Operator::I32x4ExtAddPairwiseI16x8U
| wasmparser::Operator::I32x4Abs
| wasmparser::Operator::I32x4Neg
| wasmparser::Operator::I32x4AllTrue
| wasmparser::Operator::I32x4Bitmask
| wasmparser::Operator::I32x4ExtendLowI16x8S
| wasmparser::Operator::I32x4ExtendHighI16x8S
| wasmparser::Operator::I32x4ExtendLowI16x8U
| wasmparser::Operator::I32x4ExtendHighI16x8U
| wasmparser::Operator::I32x4Shl
| wasmparser::Operator::I32x4ShrS
| wasmparser::Operator::I32x4ShrU
| wasmparser::Operator::I32x4Add
| wasmparser::Operator::I32x4Sub
| wasmparser::Operator::I32x4Mul
| wasmparser::Operator::I32x4MinS
| wasmparser::Operator::I32x4MinU
| wasmparser::Operator::I32x4MaxS
| wasmparser::Operator::I32x4MaxU
| wasmparser::Operator::I32x4DotI16x8S
| wasmparser::Operator::I32x4ExtMulLowI16x8S
| wasmparser::Operator::I32x4ExtMulHighI16x8S
| wasmparser::Operator::I32x4ExtMulLowI16x8U
| wasmparser::Operator::I32x4ExtMulHighI16x8U
| wasmparser::Operator::I64x2Abs
| wasmparser::Operator::I64x2Neg
| wasmparser::Operator::I64x2AllTrue
| wasmparser::Operator::I64x2Bitmask
| wasmparser::Operator::I64x2ExtendLowI32x4S
| wasmparser::Operator::I64x2ExtendHighI32x4S
| wasmparser::Operator::I64x2ExtendLowI32x4U
| wasmparser::Operator::I64x2ExtendHighI32x4U
| wasmparser::Operator::I64x2Shl
| wasmparser::Operator::I64x2ShrS
| wasmparser::Operator::I64x2ShrU
| wasmparser::Operator::I64x2Add
| wasmparser::Operator::I64x2Sub
| wasmparser::Operator::I64x2Mul
| wasmparser::Operator::I64x2ExtMulLowI32x4S
| wasmparser::Operator::I64x2ExtMulHighI32x4S
| wasmparser::Operator::I64x2ExtMulLowI32x4U
| wasmparser::Operator::I64x2ExtMulHighI32x4U
| wasmparser::Operator::F32x4Ceil
| wasmparser::Operator::F32x4Floor
| wasmparser::Operator::F32x4Trunc
| wasmparser::Operator::F32x4Nearest
| wasmparser::Operator::F32x4Abs
| wasmparser::Operator::F32x4Neg
| wasmparser::Operator::F32x4Sqrt
| wasmparser::Operator::F32x4Add
| wasmparser::Operator::F32x4Sub
| wasmparser::Operator::F32x4Mul
| wasmparser::Operator::F32x4Div
| wasmparser::Operator::F32x4Min
| wasmparser::Operator::F32x4Max
| wasmparser::Operator::F32x4PMin
| wasmparser::Operator::F32x4PMax
| wasmparser::Operator::F64x2Ceil
| wasmparser::Operator::F64x2Floor
| wasmparser::Operator::F64x2Trunc
| wasmparser::Operator::F64x2Nearest
| wasmparser::Operator::F64x2Abs
| wasmparser::Operator::F64x2Neg
| wasmparser::Operator::F64x2Sqrt
| wasmparser::Operator::F64x2Add
| wasmparser::Operator::F64x2Sub
| wasmparser::Operator::F64x2Mul
| wasmparser::Operator::F64x2Div
| wasmparser::Operator::F64x2Min
| wasmparser::Operator::F64x2Max
| wasmparser::Operator::F64x2PMin
| wasmparser::Operator::F64x2PMax
| wasmparser::Operator::I32x4TruncSatF32x4S
| wasmparser::Operator::I32x4TruncSatF32x4U
| wasmparser::Operator::F32x4ConvertI32x4S
| wasmparser::Operator::F32x4ConvertI32x4U
| wasmparser::Operator::I32x4TruncSatF64x2SZero
| wasmparser::Operator::I32x4TruncSatF64x2UZero
| wasmparser::Operator::F64x2ConvertLowI32x4S
| wasmparser::Operator::F64x2ConvertLowI32x4U
| wasmparser::Operator::F32x4DemoteF64x2Zero
| wasmparser::Operator::F64x2PromoteLowF32x4 => {
self.emit(Operator::try_from(&op).unwrap(), loc)? self.emit(Operator::try_from(&op).unwrap(), loc)?
} }

File diff suppressed because it is too large Load diff

View file

@ -295,6 +295,341 @@ pub enum Operator {
MemoryGrow { MemoryGrow {
mem: Memory, mem: Memory,
}, },
V128Load {
memory: MemoryArg,
},
V128Load8x8S {
memory: MemoryArg,
},
V128Load8x8U {
memory: MemoryArg,
},
V128Load16x4S {
memory: MemoryArg,
},
V128Load16x4U {
memory: MemoryArg,
},
V128Load32x2S {
memory: MemoryArg,
},
V128Load32x2U {
memory: MemoryArg,
},
V128Load8Splat {
memory: MemoryArg,
},
V128Load16Splat {
memory: MemoryArg,
},
V128Load32Splat {
memory: MemoryArg,
},
V128Load64Splat {
memory: MemoryArg,
},
V128Load32Zero {
memory: MemoryArg,
},
V128Load64Zero {
memory: MemoryArg,
},
V128Store {
memory: MemoryArg,
},
V128Load8Lane {
memory: MemoryArg,
lane: u8,
},
V128Load16Lane {
memory: MemoryArg,
lane: u8,
},
V128Load32Lane {
memory: MemoryArg,
lane: u8,
},
V128Load64Lane {
memory: MemoryArg,
lane: u8,
},
V128Store8Lane {
memory: MemoryArg,
lane: u8,
},
V128Store16Lane {
memory: MemoryArg,
lane: u8,
},
V128Store32Lane {
memory: MemoryArg,
lane: u8,
},
V128Store64Lane {
memory: MemoryArg,
lane: u8,
},
V128Const {
value: u128,
},
I8x16Shuffle {
lanes: [u8; 16],
},
I8x16ExtractLaneS {
lane: u8,
},
I8x16ExtractLaneU {
lane: u8,
},
I8x16ReplaceLane {
lane: u8,
},
I16x8ExtractLaneS {
lane: u8,
},
I16x8ExtractLaneU {
lane: u8,
},
I16x8ReplaceLane {
lane: u8,
},
I32x4ExtractLane {
lane: u8,
},
I32x4ReplaceLane {
lane: u8,
},
I64x2ExtractLane {
lane: u8,
},
I64x2ReplaceLane {
lane: u8,
},
F32x4ExtractLane {
lane: u8,
},
F32x4ReplaceLane {
lane: u8,
},
F64x2ExtractLane {
lane: u8,
},
F64x2ReplaceLane {
lane: u8,
},
I8x16Swizzle,
I8x16Splat,
I16x8Splat,
I32x4Splat,
I64x2Splat,
F32x4Splat,
F64x2Splat,
I8x16Eq,
I8x16Ne,
I8x16LtS,
I8x16LtU,
I8x16GtS,
I8x16GtU,
I8x16LeS,
I8x16LeU,
I8x16GeS,
I8x16GeU,
I16x8Eq,
I16x8Ne,
I16x8LtS,
I16x8LtU,
I16x8GtS,
I16x8GtU,
I16x8LeS,
I16x8LeU,
I16x8GeS,
I16x8GeU,
I32x4Eq,
I32x4Ne,
I32x4LtS,
I32x4LtU,
I32x4GtS,
I32x4GtU,
I32x4LeS,
I32x4LeU,
I32x4GeS,
I32x4GeU,
I64x2Eq,
I64x2Ne,
I64x2LtS,
I64x2GtS,
I64x2LeS,
I64x2GeS,
F32x4Eq,
F32x4Ne,
F32x4Lt,
F32x4Gt,
F32x4Le,
F32x4Ge,
F64x2Eq,
F64x2Ne,
F64x2Lt,
F64x2Gt,
F64x2Le,
F64x2Ge,
V128Not,
V128And,
V128AndNot,
V128Or,
V128Xor,
V128Bitselect,
V128AnyTrue,
I8x16Abs,
I8x16Neg,
I8x16Popcnt,
I8x16AllTrue,
I8x16Bitmask,
I8x16NarrowI16x8S,
I8x16NarrowI16x8U,
I8x16Shl,
I8x16ShrS,
I8x16ShrU,
I8x16Add,
I8x16AddSatS,
I8x16AddSatU,
I8x16Sub,
I8x16SubSatS,
I8x16SubSatU,
I8x16MinS,
I8x16MinU,
I8x16MaxS,
I8x16MaxU,
I8x16AvgrU,
I16x8ExtAddPairwiseI8x16S,
I16x8ExtAddPairwiseI8x16U,
I16x8Abs,
I16x8Neg,
I16x8Q15MulrSatS,
I16x8AllTrue,
I16x8Bitmask,
I16x8NarrowI32x4S,
I16x8NarrowI32x4U,
I16x8ExtendLowI8x16S,
I16x8ExtendHighI8x16S,
I16x8ExtendLowI8x16U,
I16x8ExtendHighI8x16U,
I16x8Shl,
I16x8ShrS,
I16x8ShrU,
I16x8Add,
I16x8AddSatS,
I16x8AddSatU,
I16x8Sub,
I16x8SubSatS,
I16x8SubSatU,
I16x8Mul,
I16x8MinS,
I16x8MinU,
I16x8MaxS,
I16x8MaxU,
I16x8AvgrU,
I16x8ExtMulLowI8x16S,
I16x8ExtMulHighI8x16S,
I16x8ExtMulLowI8x16U,
I16x8ExtMulHighI8x16U,
I32x4ExtAddPairwiseI16x8S,
I32x4ExtAddPairwiseI16x8U,
I32x4Abs,
I32x4Neg,
I32x4AllTrue,
I32x4Bitmask,
I32x4ExtendLowI16x8S,
I32x4ExtendHighI16x8S,
I32x4ExtendLowI16x8U,
I32x4ExtendHighI16x8U,
I32x4Shl,
I32x4ShrS,
I32x4ShrU,
I32x4Add,
I32x4Sub,
I32x4Mul,
I32x4MinS,
I32x4MinU,
I32x4MaxS,
I32x4MaxU,
I32x4DotI16x8S,
I32x4ExtMulLowI16x8S,
I32x4ExtMulHighI16x8S,
I32x4ExtMulLowI16x8U,
I32x4ExtMulHighI16x8U,
I64x2Abs,
I64x2Neg,
I64x2AllTrue,
I64x2Bitmask,
I64x2ExtendLowI32x4S,
I64x2ExtendHighI32x4S,
I64x2ExtendLowI32x4U,
I64x2ExtendHighI32x4U,
I64x2Shl,
I64x2ShrS,
I64x2ShrU,
I64x2Add,
I64x2Sub,
I64x2Mul,
I64x2ExtMulLowI32x4S,
I64x2ExtMulHighI32x4S,
I64x2ExtMulLowI32x4U,
I64x2ExtMulHighI32x4U,
F32x4Ceil,
F32x4Floor,
F32x4Trunc,
F32x4Nearest,
F32x4Abs,
F32x4Neg,
F32x4Sqrt,
F32x4Add,
F32x4Sub,
F32x4Mul,
F32x4Div,
F32x4Min,
F32x4Max,
F32x4PMin,
F32x4PMax,
F64x2Ceil,
F64x2Floor,
F64x2Trunc,
F64x2Nearest,
F64x2Abs,
F64x2Neg,
F64x2Sqrt,
F64x2Add,
F64x2Sub,
F64x2Mul,
F64x2Div,
F64x2Min,
F64x2Max,
F64x2PMin,
F64x2PMax,
I32x4TruncSatF32x4S,
I32x4TruncSatF32x4U,
F32x4ConvertI32x4S,
F32x4ConvertI32x4U,
I32x4TruncSatF64x2SZero,
I32x4TruncSatF64x2UZero,
F64x2ConvertLowI32x4S,
F64x2ConvertLowI32x4U,
F32x4DemoteF64x2Zero,
F64x2PromoteLowF32x4,
} }
#[test] #[test]
@ -568,6 +903,362 @@ impl<'a, 'b> std::convert::TryFrom<&'b wasmparser::Operator<'a>> for Operator {
&wasmparser::Operator::MemoryGrow { mem, .. } => Ok(Operator::MemoryGrow { &wasmparser::Operator::MemoryGrow { mem, .. } => Ok(Operator::MemoryGrow {
mem: Memory::from(mem), mem: Memory::from(mem),
}), }),
&wasmparser::Operator::V128Load { memarg } => Ok(Operator::V128Load {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load8x8S { memarg } => Ok(Operator::V128Load8x8S {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load8x8U { memarg } => Ok(Operator::V128Load8x8U {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load16x4S { memarg } => Ok(Operator::V128Load16x4S {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load16x4U { memarg } => Ok(Operator::V128Load16x4U {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load32x2S { memarg } => Ok(Operator::V128Load32x2S {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load32x2U { memarg } => Ok(Operator::V128Load32x2U {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load8Splat { memarg } => Ok(Operator::V128Load8Splat {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load16Splat { memarg } => Ok(Operator::V128Load16Splat {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load32Splat { memarg } => Ok(Operator::V128Load32Splat {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load64Splat { memarg } => Ok(Operator::V128Load64Splat {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load32Zero { memarg } => Ok(Operator::V128Load32Zero {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load64Zero { memarg } => Ok(Operator::V128Load64Zero {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Store { memarg } => Ok(Operator::V128Store {
memory: memarg.into(),
}),
&wasmparser::Operator::V128Load8Lane { memarg, lane } => Ok(Operator::V128Load8Lane {
memory: memarg.into(),
lane,
}),
&wasmparser::Operator::V128Load16Lane { memarg, lane } => {
Ok(Operator::V128Load16Lane {
memory: memarg.into(),
lane,
})
}
&wasmparser::Operator::V128Load32Lane { memarg, lane } => {
Ok(Operator::V128Load32Lane {
memory: memarg.into(),
lane,
})
}
&wasmparser::Operator::V128Load64Lane { memarg, lane } => {
Ok(Operator::V128Load64Lane {
memory: memarg.into(),
lane,
})
}
&wasmparser::Operator::V128Store8Lane { memarg, lane } => {
Ok(Operator::V128Store8Lane {
memory: memarg.into(),
lane,
})
}
&wasmparser::Operator::V128Store16Lane { memarg, lane } => {
Ok(Operator::V128Store16Lane {
memory: memarg.into(),
lane,
})
}
&wasmparser::Operator::V128Store32Lane { memarg, lane } => {
Ok(Operator::V128Store32Lane {
memory: memarg.into(),
lane,
})
}
&wasmparser::Operator::V128Store64Lane { memarg, lane } => {
Ok(Operator::V128Store64Lane {
memory: memarg.into(),
lane,
})
}
&wasmparser::Operator::V128Const { value } => Ok(Operator::V128Const {
value: value.i128() as u128,
}),
&wasmparser::Operator::I8x16Shuffle { lanes } => Ok(Operator::I8x16Shuffle { lanes }),
&wasmparser::Operator::I8x16ExtractLaneS { lane } => {
Ok(Operator::I8x16ExtractLaneS { lane })
}
&wasmparser::Operator::I8x16ExtractLaneU { lane } => {
Ok(Operator::I8x16ExtractLaneU { lane })
}
&wasmparser::Operator::I8x16ReplaceLane { lane } => {
Ok(Operator::I8x16ReplaceLane { lane })
}
&wasmparser::Operator::I16x8ExtractLaneS { lane } => {
Ok(Operator::I16x8ExtractLaneS { lane })
}
&wasmparser::Operator::I16x8ExtractLaneU { lane } => {
Ok(Operator::I16x8ExtractLaneU { lane })
}
&wasmparser::Operator::I16x8ReplaceLane { lane } => {
Ok(Operator::I16x8ReplaceLane { lane })
}
&wasmparser::Operator::I32x4ExtractLane { lane } => {
Ok(Operator::I32x4ExtractLane { lane })
}
&wasmparser::Operator::I32x4ReplaceLane { lane } => {
Ok(Operator::I32x4ReplaceLane { lane })
}
&wasmparser::Operator::I64x2ExtractLane { lane } => {
Ok(Operator::I64x2ExtractLane { lane })
}
&wasmparser::Operator::I64x2ReplaceLane { lane } => {
Ok(Operator::I64x2ReplaceLane { lane })
}
&wasmparser::Operator::F32x4ExtractLane { lane } => {
Ok(Operator::F32x4ExtractLane { lane })
}
&wasmparser::Operator::F32x4ReplaceLane { lane } => {
Ok(Operator::F32x4ReplaceLane { lane })
}
&wasmparser::Operator::F64x2ExtractLane { lane } => {
Ok(Operator::F64x2ExtractLane { lane })
}
&wasmparser::Operator::F64x2ReplaceLane { lane } => {
Ok(Operator::F64x2ReplaceLane { lane })
}
&wasmparser::Operator::I8x16Swizzle => Ok(Operator::I8x16Swizzle),
&wasmparser::Operator::I8x16Splat => Ok(Operator::I8x16Splat),
&wasmparser::Operator::I16x8Splat => Ok(Operator::I16x8Splat),
&wasmparser::Operator::I32x4Splat => Ok(Operator::I32x4Splat),
&wasmparser::Operator::I64x2Splat => Ok(Operator::I64x2Splat),
&wasmparser::Operator::F32x4Splat => Ok(Operator::F32x4Splat),
&wasmparser::Operator::F64x2Splat => Ok(Operator::F64x2Splat),
&wasmparser::Operator::I8x16Eq => Ok(Operator::I8x16Eq),
&wasmparser::Operator::I8x16Ne => Ok(Operator::I8x16Ne),
&wasmparser::Operator::I8x16LtS => Ok(Operator::I8x16LtS),
&wasmparser::Operator::I8x16LtU => Ok(Operator::I8x16LtU),
&wasmparser::Operator::I8x16GtS => Ok(Operator::I8x16GtS),
&wasmparser::Operator::I8x16GtU => Ok(Operator::I8x16GtU),
&wasmparser::Operator::I8x16LeS => Ok(Operator::I8x16LeS),
&wasmparser::Operator::I8x16LeU => Ok(Operator::I8x16LeU),
&wasmparser::Operator::I8x16GeS => Ok(Operator::I8x16GeS),
&wasmparser::Operator::I8x16GeU => Ok(Operator::I8x16GeU),
&wasmparser::Operator::I16x8Eq => Ok(Operator::I16x8Eq),
&wasmparser::Operator::I16x8Ne => Ok(Operator::I16x8Ne),
&wasmparser::Operator::I16x8LtS => Ok(Operator::I16x8LtS),
&wasmparser::Operator::I16x8LtU => Ok(Operator::I16x8LtU),
&wasmparser::Operator::I16x8GtS => Ok(Operator::I16x8GtS),
&wasmparser::Operator::I16x8GtU => Ok(Operator::I16x8GtU),
&wasmparser::Operator::I16x8LeS => Ok(Operator::I16x8LeS),
&wasmparser::Operator::I16x8LeU => Ok(Operator::I16x8LeU),
&wasmparser::Operator::I16x8GeS => Ok(Operator::I16x8GeS),
&wasmparser::Operator::I16x8GeU => Ok(Operator::I16x8GeU),
&wasmparser::Operator::I32x4Eq => Ok(Operator::I32x4Eq),
&wasmparser::Operator::I32x4Ne => Ok(Operator::I32x4Ne),
&wasmparser::Operator::I32x4LtS => Ok(Operator::I32x4LtS),
&wasmparser::Operator::I32x4LtU => Ok(Operator::I32x4LtU),
&wasmparser::Operator::I32x4GtS => Ok(Operator::I32x4GtS),
&wasmparser::Operator::I32x4GtU => Ok(Operator::I32x4GtU),
&wasmparser::Operator::I32x4LeS => Ok(Operator::I32x4LeS),
&wasmparser::Operator::I32x4LeU => Ok(Operator::I32x4LeU),
&wasmparser::Operator::I32x4GeS => Ok(Operator::I32x4GeS),
&wasmparser::Operator::I32x4GeU => Ok(Operator::I32x4GeU),
&wasmparser::Operator::I64x2Eq => Ok(Operator::I64x2Eq),
&wasmparser::Operator::I64x2Ne => Ok(Operator::I64x2Ne),
&wasmparser::Operator::I64x2LtS => Ok(Operator::I64x2LtS),
&wasmparser::Operator::I64x2GtS => Ok(Operator::I64x2GtS),
&wasmparser::Operator::I64x2LeS => Ok(Operator::I64x2LeS),
&wasmparser::Operator::I64x2GeS => Ok(Operator::I64x2GeS),
&wasmparser::Operator::F32x4Eq => Ok(Operator::F32x4Eq),
&wasmparser::Operator::F32x4Ne => Ok(Operator::F32x4Ne),
&wasmparser::Operator::F32x4Lt => Ok(Operator::F32x4Lt),
&wasmparser::Operator::F32x4Gt => Ok(Operator::F32x4Gt),
&wasmparser::Operator::F32x4Le => Ok(Operator::F32x4Le),
&wasmparser::Operator::F32x4Ge => Ok(Operator::F32x4Ge),
&wasmparser::Operator::F64x2Eq => Ok(Operator::F64x2Eq),
&wasmparser::Operator::F64x2Ne => Ok(Operator::F64x2Ne),
&wasmparser::Operator::F64x2Lt => Ok(Operator::F64x2Lt),
&wasmparser::Operator::F64x2Gt => Ok(Operator::F64x2Gt),
&wasmparser::Operator::F64x2Le => Ok(Operator::F64x2Le),
&wasmparser::Operator::F64x2Ge => Ok(Operator::F64x2Ge),
&wasmparser::Operator::V128Not => Ok(Operator::V128Not),
&wasmparser::Operator::V128And => Ok(Operator::V128And),
&wasmparser::Operator::V128AndNot => Ok(Operator::V128AndNot),
&wasmparser::Operator::V128Or => Ok(Operator::V128Or),
&wasmparser::Operator::V128Xor => Ok(Operator::V128Xor),
&wasmparser::Operator::V128Bitselect => Ok(Operator::V128Bitselect),
&wasmparser::Operator::V128AnyTrue => Ok(Operator::V128AnyTrue),
&wasmparser::Operator::I8x16Abs => Ok(Operator::I8x16Abs),
&wasmparser::Operator::I8x16Neg => Ok(Operator::I8x16Neg),
&wasmparser::Operator::I8x16Popcnt => Ok(Operator::I8x16Popcnt),
&wasmparser::Operator::I8x16AllTrue => Ok(Operator::I8x16AllTrue),
&wasmparser::Operator::I8x16Bitmask => Ok(Operator::I8x16Bitmask),
&wasmparser::Operator::I8x16NarrowI16x8S => Ok(Operator::I8x16NarrowI16x8S),
&wasmparser::Operator::I8x16NarrowI16x8U => Ok(Operator::I8x16NarrowI16x8U),
&wasmparser::Operator::I8x16Shl => Ok(Operator::I8x16Shl),
&wasmparser::Operator::I8x16ShrS => Ok(Operator::I8x16ShrS),
&wasmparser::Operator::I8x16ShrU => Ok(Operator::I8x16ShrU),
&wasmparser::Operator::I8x16Add => Ok(Operator::I8x16Add),
&wasmparser::Operator::I8x16AddSatS => Ok(Operator::I8x16AddSatS),
&wasmparser::Operator::I8x16AddSatU => Ok(Operator::I8x16AddSatU),
&wasmparser::Operator::I8x16Sub => Ok(Operator::I8x16Sub),
&wasmparser::Operator::I8x16SubSatS => Ok(Operator::I8x16SubSatS),
&wasmparser::Operator::I8x16SubSatU => Ok(Operator::I8x16SubSatU),
&wasmparser::Operator::I8x16MinS => Ok(Operator::I8x16MinS),
&wasmparser::Operator::I8x16MinU => Ok(Operator::I8x16MinU),
&wasmparser::Operator::I8x16MaxS => Ok(Operator::I8x16MaxS),
&wasmparser::Operator::I8x16MaxU => Ok(Operator::I8x16MaxU),
&wasmparser::Operator::I8x16AvgrU => Ok(Operator::I8x16AvgrU),
&wasmparser::Operator::I16x8ExtAddPairwiseI8x16S => {
Ok(Operator::I16x8ExtAddPairwiseI8x16S)
}
&wasmparser::Operator::I16x8ExtAddPairwiseI8x16U => {
Ok(Operator::I16x8ExtAddPairwiseI8x16U)
}
&wasmparser::Operator::I16x8Abs => Ok(Operator::I16x8Abs),
&wasmparser::Operator::I16x8Neg => Ok(Operator::I16x8Neg),
&wasmparser::Operator::I16x8Q15MulrSatS => Ok(Operator::I16x8Q15MulrSatS),
&wasmparser::Operator::I16x8AllTrue => Ok(Operator::I16x8AllTrue),
&wasmparser::Operator::I16x8Bitmask => Ok(Operator::I16x8Bitmask),
&wasmparser::Operator::I16x8NarrowI32x4S => Ok(Operator::I16x8NarrowI32x4S),
&wasmparser::Operator::I16x8NarrowI32x4U => Ok(Operator::I16x8NarrowI32x4U),
&wasmparser::Operator::I16x8ExtendLowI8x16S => Ok(Operator::I16x8ExtendLowI8x16S),
&wasmparser::Operator::I16x8ExtendHighI8x16S => Ok(Operator::I16x8ExtendHighI8x16S),
&wasmparser::Operator::I16x8ExtendLowI8x16U => Ok(Operator::I16x8ExtendLowI8x16U),
&wasmparser::Operator::I16x8ExtendHighI8x16U => Ok(Operator::I16x8ExtendHighI8x16U),
&wasmparser::Operator::I16x8Shl => Ok(Operator::I16x8Shl),
&wasmparser::Operator::I16x8ShrS => Ok(Operator::I16x8ShrS),
&wasmparser::Operator::I16x8ShrU => Ok(Operator::I16x8ShrU),
&wasmparser::Operator::I16x8Add => Ok(Operator::I16x8Add),
&wasmparser::Operator::I16x8AddSatS => Ok(Operator::I16x8AddSatS),
&wasmparser::Operator::I16x8AddSatU => Ok(Operator::I16x8AddSatU),
&wasmparser::Operator::I16x8Sub => Ok(Operator::I16x8Sub),
&wasmparser::Operator::I16x8SubSatS => Ok(Operator::I16x8SubSatS),
&wasmparser::Operator::I16x8SubSatU => Ok(Operator::I16x8SubSatU),
&wasmparser::Operator::I16x8Mul => Ok(Operator::I16x8Mul),
&wasmparser::Operator::I16x8MinS => Ok(Operator::I16x8MinS),
&wasmparser::Operator::I16x8MinU => Ok(Operator::I16x8MinU),
&wasmparser::Operator::I16x8MaxS => Ok(Operator::I16x8MaxS),
&wasmparser::Operator::I16x8MaxU => Ok(Operator::I16x8MaxU),
&wasmparser::Operator::I16x8AvgrU => Ok(Operator::I16x8AvgrU),
&wasmparser::Operator::I16x8ExtMulLowI8x16S => Ok(Operator::I16x8ExtMulLowI8x16S),
&wasmparser::Operator::I16x8ExtMulHighI8x16S => Ok(Operator::I16x8ExtMulHighI8x16S),
&wasmparser::Operator::I16x8ExtMulLowI8x16U => Ok(Operator::I16x8ExtMulLowI8x16U),
&wasmparser::Operator::I16x8ExtMulHighI8x16U => Ok(Operator::I16x8ExtMulHighI8x16U),
&wasmparser::Operator::I32x4ExtAddPairwiseI16x8S => {
Ok(Operator::I32x4ExtAddPairwiseI16x8S)
}
&wasmparser::Operator::I32x4ExtAddPairwiseI16x8U => {
Ok(Operator::I32x4ExtAddPairwiseI16x8U)
}
&wasmparser::Operator::I32x4Abs => Ok(Operator::I32x4Abs),
&wasmparser::Operator::I32x4Neg => Ok(Operator::I32x4Neg),
&wasmparser::Operator::I32x4AllTrue => Ok(Operator::I32x4AllTrue),
&wasmparser::Operator::I32x4Bitmask => Ok(Operator::I32x4Bitmask),
&wasmparser::Operator::I32x4ExtendLowI16x8S => Ok(Operator::I32x4ExtendLowI16x8S),
&wasmparser::Operator::I32x4ExtendHighI16x8S => Ok(Operator::I32x4ExtendHighI16x8S),
&wasmparser::Operator::I32x4ExtendLowI16x8U => Ok(Operator::I32x4ExtendLowI16x8U),
&wasmparser::Operator::I32x4ExtendHighI16x8U => Ok(Operator::I32x4ExtendHighI16x8U),
&wasmparser::Operator::I32x4Shl => Ok(Operator::I32x4Shl),
&wasmparser::Operator::I32x4ShrS => Ok(Operator::I32x4ShrS),
&wasmparser::Operator::I32x4ShrU => Ok(Operator::I32x4ShrU),
&wasmparser::Operator::I32x4Add => Ok(Operator::I32x4Add),
&wasmparser::Operator::I32x4Sub => Ok(Operator::I32x4Sub),
&wasmparser::Operator::I32x4Mul => Ok(Operator::I32x4Mul),
&wasmparser::Operator::I32x4MinS => Ok(Operator::I32x4MinS),
&wasmparser::Operator::I32x4MinU => Ok(Operator::I32x4MinU),
&wasmparser::Operator::I32x4MaxS => Ok(Operator::I32x4MaxS),
&wasmparser::Operator::I32x4MaxU => Ok(Operator::I32x4MaxU),
&wasmparser::Operator::I32x4DotI16x8S => Ok(Operator::I32x4DotI16x8S),
&wasmparser::Operator::I32x4ExtMulLowI16x8S => Ok(Operator::I32x4ExtMulLowI16x8S),
&wasmparser::Operator::I32x4ExtMulHighI16x8S => Ok(Operator::I32x4ExtMulHighI16x8S),
&wasmparser::Operator::I32x4ExtMulLowI16x8U => Ok(Operator::I32x4ExtMulLowI16x8U),
&wasmparser::Operator::I32x4ExtMulHighI16x8U => Ok(Operator::I32x4ExtMulHighI16x8U),
&wasmparser::Operator::I64x2Abs => Ok(Operator::I64x2Abs),
&wasmparser::Operator::I64x2Neg => Ok(Operator::I64x2Neg),
&wasmparser::Operator::I64x2AllTrue => Ok(Operator::I64x2AllTrue),
&wasmparser::Operator::I64x2Bitmask => Ok(Operator::I64x2Bitmask),
&wasmparser::Operator::I64x2ExtendLowI32x4S => Ok(Operator::I64x2ExtendLowI32x4S),
&wasmparser::Operator::I64x2ExtendHighI32x4S => Ok(Operator::I64x2ExtendHighI32x4S),
&wasmparser::Operator::I64x2ExtendLowI32x4U => Ok(Operator::I64x2ExtendLowI32x4U),
&wasmparser::Operator::I64x2ExtendHighI32x4U => Ok(Operator::I64x2ExtendHighI32x4U),
&wasmparser::Operator::I64x2Shl => Ok(Operator::I64x2Shl),
&wasmparser::Operator::I64x2ShrS => Ok(Operator::I64x2ShrS),
&wasmparser::Operator::I64x2ShrU => Ok(Operator::I64x2ShrU),
&wasmparser::Operator::I64x2Add => Ok(Operator::I64x2Add),
&wasmparser::Operator::I64x2Sub => Ok(Operator::I64x2Sub),
&wasmparser::Operator::I64x2Mul => Ok(Operator::I64x2Mul),
&wasmparser::Operator::I64x2ExtMulLowI32x4S => Ok(Operator::I64x2ExtMulLowI32x4S),
&wasmparser::Operator::I64x2ExtMulHighI32x4S => Ok(Operator::I64x2ExtMulHighI32x4S),
&wasmparser::Operator::I64x2ExtMulLowI32x4U => Ok(Operator::I64x2ExtMulLowI32x4U),
&wasmparser::Operator::I64x2ExtMulHighI32x4U => Ok(Operator::I64x2ExtMulHighI32x4U),
&wasmparser::Operator::F32x4Ceil => Ok(Operator::F32x4Ceil),
&wasmparser::Operator::F32x4Floor => Ok(Operator::F32x4Floor),
&wasmparser::Operator::F32x4Trunc => Ok(Operator::F32x4Trunc),
&wasmparser::Operator::F32x4Nearest => Ok(Operator::F32x4Nearest),
&wasmparser::Operator::F32x4Abs => Ok(Operator::F32x4Abs),
&wasmparser::Operator::F32x4Neg => Ok(Operator::F32x4Neg),
&wasmparser::Operator::F32x4Sqrt => Ok(Operator::F32x4Sqrt),
&wasmparser::Operator::F32x4Add => Ok(Operator::F32x4Add),
&wasmparser::Operator::F32x4Sub => Ok(Operator::F32x4Sub),
&wasmparser::Operator::F32x4Mul => Ok(Operator::F32x4Mul),
&wasmparser::Operator::F32x4Div => Ok(Operator::F32x4Div),
&wasmparser::Operator::F32x4Min => Ok(Operator::F32x4Min),
&wasmparser::Operator::F32x4Max => Ok(Operator::F32x4Max),
&wasmparser::Operator::F32x4PMin => Ok(Operator::F32x4PMin),
&wasmparser::Operator::F32x4PMax => Ok(Operator::F32x4PMax),
&wasmparser::Operator::F64x2Ceil => Ok(Operator::F64x2Ceil),
&wasmparser::Operator::F64x2Floor => Ok(Operator::F64x2Floor),
&wasmparser::Operator::F64x2Trunc => Ok(Operator::F64x2Trunc),
&wasmparser::Operator::F64x2Nearest => Ok(Operator::F64x2Nearest),
&wasmparser::Operator::F64x2Abs => Ok(Operator::F64x2Abs),
&wasmparser::Operator::F64x2Neg => Ok(Operator::F64x2Neg),
&wasmparser::Operator::F64x2Sqrt => Ok(Operator::F64x2Sqrt),
&wasmparser::Operator::F64x2Add => Ok(Operator::F64x2Add),
&wasmparser::Operator::F64x2Sub => Ok(Operator::F64x2Sub),
&wasmparser::Operator::F64x2Mul => Ok(Operator::F64x2Mul),
&wasmparser::Operator::F64x2Div => Ok(Operator::F64x2Div),
&wasmparser::Operator::F64x2Min => Ok(Operator::F64x2Min),
&wasmparser::Operator::F64x2Max => Ok(Operator::F64x2Max),
&wasmparser::Operator::F64x2PMin => Ok(Operator::F64x2PMin),
&wasmparser::Operator::F64x2PMax => Ok(Operator::F64x2PMax),
&wasmparser::Operator::I32x4TruncSatF32x4S => Ok(Operator::I32x4TruncSatF32x4S),
&wasmparser::Operator::I32x4TruncSatF32x4U => Ok(Operator::I32x4TruncSatF32x4U),
&wasmparser::Operator::F32x4ConvertI32x4S => Ok(Operator::F32x4ConvertI32x4S),
&wasmparser::Operator::F32x4ConvertI32x4U => Ok(Operator::F32x4ConvertI32x4U),
&wasmparser::Operator::I32x4TruncSatF64x2SZero => Ok(Operator::I32x4TruncSatF64x2SZero),
&wasmparser::Operator::I32x4TruncSatF64x2UZero => Ok(Operator::I32x4TruncSatF64x2UZero),
&wasmparser::Operator::F64x2ConvertLowI32x4S => Ok(Operator::F64x2ConvertLowI32x4S),
&wasmparser::Operator::F64x2ConvertLowI32x4U => Ok(Operator::F64x2ConvertLowI32x4U),
&wasmparser::Operator::F32x4DemoteF64x2Zero => Ok(Operator::F32x4DemoteF64x2Zero),
&wasmparser::Operator::F64x2PromoteLowF32x4 => Ok(Operator::F64x2PromoteLowF32x4),
_ => Err(()), _ => Err(()),
} }
} }

22
wasm_tests/test-simd.wat Normal file
View file

@ -0,0 +1,22 @@
(module
(memory 1 1)
(func (export "pack") (param i64 i64) (result v128)
v128.const i64x2 0 0
local.get 0
i64x2.replace_lane 0
local.get 1
i64x2.replace_lane 1
return)
(func (export "unpack") (param v128) (result i64 i64)
local.get 0
i64x2.extract_lane 0
local.get 0
i64x2.extract_lane 1
return)
(func (export "load") (param i32) (result v128)
local.get 0
v128.load)
(func (export "store") (param i32 v128)
local.get 0
local.get 1
v128.store))