From a14d2b27b41124f7b4a314640f105e713a320dd3 Mon Sep 17 00:00:00 2001 From: Syrus Date: Wed, 10 Jul 2019 14:41:02 -0700 Subject: [PATCH] Added simd tests for llvm --- lib/spectests/build/spectests.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/spectests/build/spectests.rs b/lib/spectests/build/spectests.rs index 10fb45678..5505f51a3 100644 --- a/lib/spectests/build/spectests.rs +++ b/lib/spectests/build/spectests.rs @@ -72,11 +72,13 @@ const TESTS: &[&str] = &[ "spectests/typecheck.wast", "spectests/types.wast", "spectests/unwind.wast", + #[cfg(feature = "llvm")] + "spectests/simd.wast", ]; static COMMON: &'static str = r##" use std::{{f32, f64}}; -use wabt::wat2wasm; +use wabt::{{wat2wasm_with_features, Error as WabtError}}; use wasmer_runtime_core::import::ImportObject; use wasmer_runtime_core::types::Value; use wasmer_runtime_core::{{Instance, module::Module}}; @@ -95,6 +97,14 @@ static IMPORT_MODULE: &str = r#" (global $global_i32 (export "global_i32") i32 (i32.const 666))) "#; +fn wat2wasm>( + source: S, +) -> Result, WabtError> { + let mut features = wabt::Features::new(); + features.enable_simd(); + wabt::wat2wasm_with_features(source, features) +} + #[cfg(feature = "clif")] fn get_compiler() -> impl Compiler { use wasmer_clif_backend::CraneliftCompiler; @@ -291,7 +301,8 @@ impl WastTestGenerator { fn new(path: &PathBuf) -> Self { let filename = path.file_name().unwrap().to_str().unwrap(); let source = fs::read(&path).unwrap(); - let script: ScriptParser = ScriptParser::from_source_and_name(&source, filename).unwrap(); + let script: ScriptParser = ScriptParser::from_source_and_name(&source, filename) + .expect(&format!("Failed to parse script {}", &filename)); let buffer = String::new(); WastTestGenerator { last_module: 0,