mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 22:25:40 +00:00
Added simd tests for llvm
This commit is contained in:
parent
702125eef2
commit
a14d2b27b4
@ -72,11 +72,13 @@ const TESTS: &[&str] = &[
|
|||||||
"spectests/typecheck.wast",
|
"spectests/typecheck.wast",
|
||||||
"spectests/types.wast",
|
"spectests/types.wast",
|
||||||
"spectests/unwind.wast",
|
"spectests/unwind.wast",
|
||||||
|
#[cfg(feature = "llvm")]
|
||||||
|
"spectests/simd.wast",
|
||||||
];
|
];
|
||||||
|
|
||||||
static COMMON: &'static str = r##"
|
static COMMON: &'static str = r##"
|
||||||
use std::{{f32, f64}};
|
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::import::ImportObject;
|
||||||
use wasmer_runtime_core::types::Value;
|
use wasmer_runtime_core::types::Value;
|
||||||
use wasmer_runtime_core::{{Instance, module::Module}};
|
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)))
|
(global $global_i32 (export "global_i32") i32 (i32.const 666)))
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
|
fn wat2wasm<S: AsRef<[u8]>>(
|
||||||
|
source: S,
|
||||||
|
) -> Result<Vec<u8>, WabtError> {
|
||||||
|
let mut features = wabt::Features::new();
|
||||||
|
features.enable_simd();
|
||||||
|
wabt::wat2wasm_with_features(source, features)
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "clif")]
|
#[cfg(feature = "clif")]
|
||||||
fn get_compiler() -> impl Compiler {
|
fn get_compiler() -> impl Compiler {
|
||||||
use wasmer_clif_backend::CraneliftCompiler;
|
use wasmer_clif_backend::CraneliftCompiler;
|
||||||
@ -291,7 +301,8 @@ impl WastTestGenerator {
|
|||||||
fn new(path: &PathBuf) -> Self {
|
fn new(path: &PathBuf) -> Self {
|
||||||
let filename = path.file_name().unwrap().to_str().unwrap();
|
let filename = path.file_name().unwrap().to_str().unwrap();
|
||||||
let source = fs::read(&path).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();
|
let buffer = String::new();
|
||||||
WastTestGenerator {
|
WastTestGenerator {
|
||||||
last_module: 0,
|
last_module: 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user