Enable SIMD in WAST testsuites

This commit is contained in:
Andrew Brown
2019-08-14 11:12:00 -07:00
committed by Dan Gohman
parent bb244d52d5
commit ce8e8662ff
2 changed files with 8 additions and 3 deletions

View File

@@ -55,7 +55,7 @@ fn test_directory(out: &mut File, testsuite: &str) -> io::Result<()> {
)?;
writeln!(
out,
" use super::{{native_isa, Path, WastContext, Compiler}};"
" use super::{{native_isa, Path, WastContext, Compiler, Features}};"
)?;
for dir_entry in dir_entries {
write_testsuite_tests(out, dir_entry, testsuite)?;
@@ -81,7 +81,11 @@ fn write_testsuite_tests(out: &mut File, dir_entry: DirEntry, testsuite: &str) -
writeln!(out, " let compiler = Compiler::new(isa);")?;
writeln!(
out,
" let mut wast_context = WastContext::new(Box::new(compiler));"
" let features = Features {{ simd: true, ..Default::default() }};"
)?;
writeln!(
out,
" let mut wast_context = WastContext::new(Box::new(compiler)).with_features(features);"
)?;
writeln!(out, " wast_context")?;
writeln!(out, " .register_spectest()")?;

View File

@@ -4,7 +4,7 @@ use cranelift_codegen::isa;
use cranelift_codegen::settings;
use cranelift_codegen::settings::Configurable;
use std::path::Path;
use wasmtime_jit::Compiler;
use wasmtime_jit::{Compiler, Features};
use wasmtime_wast::WastContext;
include!(concat!(env!("OUT_DIR"), "/wast_testsuite_tests.rs"));
@@ -14,6 +14,7 @@ fn native_isa() -> Box<dyn isa::TargetIsa> {
let mut flag_builder = settings::builder();
flag_builder.enable("enable_verifier").unwrap();
flag_builder.enable("avoid_div_traps").unwrap();
flag_builder.enable("enable_simd").unwrap();
let isa_builder = cranelift_native::builder().unwrap_or_else(|_| {
panic!("host machine is not a supported target");