Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

Commit 5128e19

Browse files
committed
Verify that cranelift-wasm can translate SIMD instructions
To do so we must use a new version of wabt-rs that allows us to enable features (e.g. SIMD) when translating the wasmtests
1 parent f1b0155 commit 5128e19

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

cranelift-wasm/tests/wasm_testsuite.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::io::prelude::*;
1010
use std::path::Path;
1111
use std::str::FromStr;
1212
use target_lexicon::triple;
13-
use wabt::wat2wasm;
13+
use wabt::{wat2wasm_with_features, Features};
1414

1515
#[test]
1616
fn testsuite() {
@@ -61,7 +61,9 @@ fn handle_module(path: &Path, flags: &Flags, return_mode: ReturnMode) {
6161
Some("wasm") => read_file(path).expect("error reading wasm file"),
6262
Some("wat") => {
6363
let wat = read_file(path).expect("error reading wat file");
64-
match wat2wasm(&wat) {
64+
let mut features = Features::new();
65+
features.enable_all();
66+
match wat2wasm_with_features(&wat, features) {
6567
Ok(wasm) => wasm,
6668
Err(e) => {
6769
panic!("error converting wat to wasm: {:?}", e);

wasmtests/simd.wat

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
(module
2+
(func $test_splat (result i32)
3+
i32.const 42
4+
i32x4.splat
5+
i32x4.extract_lane 0
6+
)
7+
8+
(func $test_insert_lane (result i32)
9+
v128.const i64x2 0 0
10+
i32.const 99
11+
i32x4.replace_lane 1
12+
i32x4.extract_lane 1
13+
)
14+
15+
(func $test_const (result i32)
16+
v128.const i32x4 1 2 3 4
17+
i32x4.extract_lane 3
18+
)
19+
20+
(export "test_splat" (func $test_splat))
21+
(export "test_insert_lane" (func $test_insert_lane))
22+
(export "test_const" (func $test_const))
23+
)

0 commit comments

Comments
 (0)