support SIMD fuzzing in reference interpreter (#3980)

* support SIMD fuzzing in reference interpreter

* formatting
This commit is contained in:
Conrad Watt
2022-03-31 16:07:39 +01:00
committed by GitHub
parent e8dd13cf87
commit c8daf0b8db
8 changed files with 46 additions and 11 deletions

View File

@@ -16,6 +16,7 @@ pub enum Value {
I64(i64),
F32(i32),
F64(i64),
V128(Vec<u8>),
}
#[cfg(feature = "has-libinterpret")]

View File

@@ -59,6 +59,7 @@ mod ocaml_bindings {
Value::I64(i: OCamlInt64),
Value::F32(i: OCamlInt32),
Value::F64(i: OCamlInt64),
Value::V128(i: OCamlBytes),
}
}
@@ -103,4 +104,21 @@ mod tests {
Err("Error(_, \"(Isabelle) trap: load\")".to_string())
);
}
#[test]
fn simd_not() {
let module = wat::parse_file("tests/simd_not.wat").unwrap();
let parameters = Some(vec![Value::V128(vec![
0, 255, 0, 0, 255, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0,
])]);
let results = interpret(&module, parameters.clone()).unwrap();
assert_eq!(
results,
vec![Value::V128(vec![
255, 0, 255, 255, 0, 255, 255, 255, 255, 0, 255, 255, 255, 255, 255, 255
])]
);
}
}