wasm_interp: 'reinterpret' instructions

This commit is contained in:
Brian Carroll 2022-11-28 21:43:37 +00:00
parent 46737b4a41
commit 94ca352ed7
No known key found for this signature in database
GPG key ID: 5C7B2EC4101703C0
2 changed files with 53 additions and 12 deletions

View file

@ -1139,10 +1139,26 @@ impl<'a> Instance<'a> {
F64CONVERTUI64 => todo!("{:?} @ {:#x}", op_code, file_offset),
F64PROMOTEF32 => todo!("{:?} @ {:#x}", op_code, file_offset),
I32REINTERPRETF32 => todo!("{:?} @ {:#x}", op_code, file_offset),
I64REINTERPRETF64 => todo!("{:?} @ {:#x}", op_code, file_offset),
F32REINTERPRETI32 => todo!("{:?} @ {:#x}", op_code, file_offset),
F64REINTERPRETI64 => todo!("{:?} @ {:#x}", op_code, file_offset),
I32REINTERPRETF32 => {
let x = self.value_stack.pop_f32();
self.value_stack
.push(Value::I32(i32::from_ne_bytes(x.to_ne_bytes())));
}
I64REINTERPRETF64 => {
let x = self.value_stack.pop_f64();
self.value_stack
.push(Value::I64(i64::from_ne_bytes(x.to_ne_bytes())));
}
F32REINTERPRETI32 => {
let x = self.value_stack.pop_i32();
self.value_stack
.push(Value::F32(f32::from_ne_bytes(x.to_ne_bytes())));
}
F64REINTERPRETI64 => {
let x = self.value_stack.pop_i64();
self.value_stack
.push(Value::F64(f64::from_ne_bytes(x.to_ne_bytes())));
}
}
if let Some(debug_string) = &self.debug_string {