Skip to content
This repository was archived by the owner on Oct 3, 2025. It is now read-only.

Commit 509667d

Browse files
feat: pass all i64 tests, add missing conversion opcodes
Signed-off-by: Henry <[email protected]>
1 parent 88da7cb commit 509667d

File tree

7 files changed

+732
-499
lines changed

7 files changed

+732
-499
lines changed

crates/parser/src/conversion.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,9 @@ pub fn process_operators<'a>(
546546
I32TruncF32U => Instruction::I32TruncF32U,
547547
I32TruncF64S => Instruction::I32TruncF64S,
548548
I32TruncF64U => Instruction::I32TruncF64U,
549+
I64Extend8S => Instruction::I64Extend8S,
550+
I64Extend16S => Instruction::I64Extend16S,
551+
I64Extend32S => Instruction::I64Extend32S,
549552
I64ExtendI32S => Instruction::I64ExtendI32S,
550553
I64ExtendI32U => Instruction::I64ExtendI32U,
551554
I32Extend8S => Instruction::I32Extend8S,
@@ -568,6 +571,14 @@ pub fn process_operators<'a>(
568571
I64ReinterpretF64 => Instruction::I64ReinterpretF64,
569572
F32ReinterpretI32 => Instruction::F32ReinterpretI32,
570573
F64ReinterpretI64 => Instruction::F64ReinterpretI64,
574+
I32TruncSatF32S => Instruction::I32TruncSatF32S,
575+
I32TruncSatF32U => Instruction::I32TruncSatF32U,
576+
I32TruncSatF64S => Instruction::I32TruncSatF64S,
577+
I32TruncSatF64U => Instruction::I32TruncSatF64U,
578+
I64TruncSatF32S => Instruction::I64TruncSatF32S,
579+
I64TruncSatF32U => Instruction::I64TruncSatF32U,
580+
I64TruncSatF64S => Instruction::I64TruncSatF64S,
581+
I64TruncSatF64U => Instruction::I64TruncSatF64U,
571582
op => {
572583
return Err(crate::ParseError::UnsupportedOperator(format!(
573584
"Unsupported instruction: {:?}",

crates/tinywasm/src/runtime/executor/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ fn exec_one(
354354
F64ConvertI64U => conv_2!(i64, u64, f64, stack),
355355
I32Extend8S => conv_2!(i32, i8, i32, stack),
356356
I32Extend16S => conv_2!(i32, i16, i32, stack),
357+
I64Extend8S => conv_2!(i64, i8, i64, stack),
358+
I64Extend16S => conv_2!(i64, i16, i64, stack),
359+
I64Extend32S => conv_2!(i64, i32, i64, stack),
357360
I64ExtendI32U => conv_2!(i32, u32, i64, stack),
358361
I64ExtendI32S => conv_1!(i32, i64, stack),
359362
I32WrapI64 => conv_1!(i64, i32, stack),

crates/tinywasm/tests/generated/mvp.csv

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

crates/tinywasm/tests/generated/progress-mvp.svg

Lines changed: 4 additions & 4 deletions
Loading

crates/types/src/instructions.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ pub enum Instruction {
215215
I32TruncF64U,
216216
I32Extend8S,
217217
I32Extend16S,
218+
I64Extend8S,
219+
I64Extend16S,
220+
I64Extend32S,
218221
I64ExtendI32S,
219222
I64ExtendI32U,
220223
I64TruncF32S,
@@ -235,4 +238,12 @@ pub enum Instruction {
235238
I64ReinterpretF64,
236239
F32ReinterpretI32,
237240
F64ReinterpretI64,
241+
I32TruncSatF32S,
242+
I32TruncSatF32U,
243+
I32TruncSatF64S,
244+
I32TruncSatF64U,
245+
I64TruncSatF32S,
246+
I64TruncSatF32U,
247+
I64TruncSatF64S,
248+
I64TruncSatF64U,
238249
}

0 commit comments

Comments
 (0)