Skip to content

Commit

Permalink
feat: pass all i64 tests, add missing conversion opcodes
Browse files Browse the repository at this point in the history
Signed-off-by: Henry <mail@henrygressmann.de>
  • Loading branch information
explodingcamera committed Dec 25, 2023
1 parent 88da7cb commit 509667d
Show file tree
Hide file tree
Showing 7 changed files with 732 additions and 499 deletions.
11 changes: 11 additions & 0 deletions crates/parser/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,9 @@ pub fn process_operators<'a>(
I32TruncF32U => Instruction::I32TruncF32U,
I32TruncF64S => Instruction::I32TruncF64S,
I32TruncF64U => Instruction::I32TruncF64U,
I64Extend8S => Instruction::I64Extend8S,
I64Extend16S => Instruction::I64Extend16S,
I64Extend32S => Instruction::I64Extend32S,
I64ExtendI32S => Instruction::I64ExtendI32S,
I64ExtendI32U => Instruction::I64ExtendI32U,
I32Extend8S => Instruction::I32Extend8S,
Expand All @@ -568,6 +571,14 @@ pub fn process_operators<'a>(
I64ReinterpretF64 => Instruction::I64ReinterpretF64,
F32ReinterpretI32 => Instruction::F32ReinterpretI32,
F64ReinterpretI64 => Instruction::F64ReinterpretI64,
I32TruncSatF32S => Instruction::I32TruncSatF32S,
I32TruncSatF32U => Instruction::I32TruncSatF32U,
I32TruncSatF64S => Instruction::I32TruncSatF64S,
I32TruncSatF64U => Instruction::I32TruncSatF64U,
I64TruncSatF32S => Instruction::I64TruncSatF32S,
I64TruncSatF32U => Instruction::I64TruncSatF32U,
I64TruncSatF64S => Instruction::I64TruncSatF64S,
I64TruncSatF64U => Instruction::I64TruncSatF64U,
op => {
return Err(crate::ParseError::UnsupportedOperator(format!(
"Unsupported instruction: {:?}",
Expand Down
3 changes: 3 additions & 0 deletions crates/tinywasm/src/runtime/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ fn exec_one(
F64ConvertI64U => conv_2!(i64, u64, f64, stack),
I32Extend8S => conv_2!(i32, i8, i32, stack),
I32Extend16S => conv_2!(i32, i16, i32, stack),
I64Extend8S => conv_2!(i64, i8, i64, stack),
I64Extend16S => conv_2!(i64, i16, i64, stack),
I64Extend32S => conv_2!(i64, i32, i64, stack),
I64ExtendI32U => conv_2!(i32, u32, i64, stack),
I64ExtendI32S => conv_1!(i32, i64, stack),
I32WrapI64 => conv_1!(i64, i32, stack),
Expand Down
2 changes: 1 addition & 1 deletion crates/tinywasm/tests/generated/mvp.csv

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions crates/tinywasm/tests/generated/progress-mvp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions crates/types/src/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ pub enum Instruction {
I32TruncF64U,
I32Extend8S,
I32Extend16S,
I64Extend8S,
I64Extend16S,
I64Extend32S,
I64ExtendI32S,
I64ExtendI32U,
I64TruncF32S,
Expand All @@ -235,4 +238,12 @@ pub enum Instruction {
I64ReinterpretF64,
F32ReinterpretI32,
F64ReinterpretI64,
I32TruncSatF32S,
I32TruncSatF32U,
I32TruncSatF64S,
I32TruncSatF64U,
I64TruncSatF32S,
I64TruncSatF32U,
I64TruncSatF64S,
I64TruncSatF64U,
}
Loading

0 comments on commit 509667d

Please sign in to comment.