| 1 | module wasm |
| 2 | |
| 3 | fn test_relaxed_simd_implies_simd() { |
| 4 | // requesting relaxed SIMD on its own must also pull in the base SIMD feature |
| 5 | feats := apply_feature_implications([WasmFeature.relaxed_simd]) |
| 6 | assert WasmFeature.simd in feats |
| 7 | assert WasmFeature.relaxed_simd in feats |
| 8 | } |
| 9 | |
| 10 | fn test_relaxed_simd_does_not_duplicate_simd() { |
| 11 | // when SIMD is already present, the implication must not add a duplicate |
| 12 | feats := apply_feature_implications([WasmFeature.simd, .relaxed_simd]) |
| 13 | assert feats.filter(it == WasmFeature.simd).len == 1 |
| 14 | } |
| 15 | |
| 16 | fn test_simd_without_relaxed_is_unchanged() { |
| 17 | feats := apply_feature_implications([WasmFeature.simd]) |
| 18 | assert WasmFeature.simd in feats |
| 19 | assert WasmFeature.relaxed_simd !in feats |
| 20 | } |
| 21 | |
| 22 | fn test_relaxed_simd_renders_simd_in_tool_flags() { |
| 23 | feats := apply_feature_implications([WasmFeature.relaxed_simd]) |
| 24 | // wasm-opt must be told to enable SIMD as well as relaxed SIMD |
| 25 | binaryen := binaryen_feature_flags(feats) |
| 26 | assert binaryen.contains('--enable-simd') |
| 27 | assert binaryen.contains('--enable-relaxed-simd') |
| 28 | // wasm-validate must not disable SIMD while enabling relaxed SIMD |
| 29 | wabt := wabt_validate_args(feats) |
| 30 | assert '--disable-simd' !in wabt |
| 31 | assert '--enable-relaxed-simd' in wabt |
| 32 | } |
| 33 | |