1#!/bin/bash 2# Copyright 2020 Google LLC 3# 4# Use of this source code is governed by a BSD-style license that can be 5# found in the LICENSE file. 6 7# This script takes a path to a .wasm file as input and outputs textual representations of all wasm 8# SIMD operations present in the .wasm file. 9# 10# Example usage: ./simd_test.sh simd_float_capabilities.wasm 11 12# Requires that emscripten and wasm2wat are added to your PATH. 13# Requires, and is verified to work with 14# - The output of `wasm2wat --version` should be `1.0.13 (1.0.17)` 15# - install from here: https://github.com/WebAssembly/wabt 16 17 18wasm2wat --enable-simd $1 > output/simd_test.wat 19 20# The following lines output all SIMD operations produced in the output WASM. 21# Useful for checking that SIMD instructions are actually being used. 22# e.g. for the following C++ code: 23# auto vec1 = skvx::Vec<2, double>({11.f, -22.f}) + skvx::Vec<2, double>({13.f, -1.f}); 24# it is expected that the f64x2.add operation is present in the output WASM. 25echo "The following WASM SIMD operations were used in the compiled code:" 26grep -f wasm_simd_types.txt output/simd_test.wat 27