blob: 13fb9912ccd708a584a161be4bc94da467d32266 [file] [edit]
//@ requireOptions("--useWasmSIMD=1")
//@ skip if !$isSIMDPlatform
import { instantiate } from "../wabt-wrapper.js";
import * as assert from "../assert.js";
/*
(module
(type $0 (func))
(type $1 (func (param i32) (result i32)))
(tag $e (param v128))
(export "simple_throw_catch_v128" (func 0))
(func $0
(type 1)
(block $b (result v128)
(try_table
(result v128)
(catch $e $b)
(local.get 0)
(i32.eqz)
(if (then (throw $e (v128.const i8x16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16))) (else))
(v128.const i8x16 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42 42)
)
(i8x16.extract_lane_u 12)
(return)
)
(i8x16.extract_lane_u 12)
)
)
*/
let wasmBytes = new Uint8Array([
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x8d, 0x80, 0x80, 0x80, 0x00, 0x03, 0x60,
0x00, 0x00, 0x60, 0x01, 0x7f, 0x01, 0x7f, 0x60, 0x01, 0x7b, 0x00, 0x03, 0x82, 0x80, 0x80, 0x80,
0x00, 0x01, 0x01, 0x0d, 0x83, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x02, 0x07, 0x9b, 0x80, 0x80,
0x80, 0x00, 0x01, 0x17, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x74, 0x68, 0x72, 0x6f, 0x77,
0x5f, 0x63, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x76, 0x31, 0x32, 0x38, 0x00, 0x00, 0x0a, 0xc5, 0x80,
0x80, 0x80, 0x00, 0x01, 0xbf, 0x80, 0x80, 0x80, 0x00, 0x00, 0x02, 0x7b, 0x1f, 0x7b, 0x01, 0x00,
0x00, 0x00, 0x20, 0x00, 0x45, 0x04, 0x40, 0xfd, 0x0c, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x08, 0x00, 0x0b, 0xfd, 0x0c, 0x2a, 0x2a,
0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x0b, 0xfd,
0x16, 0x0c, 0x0f, 0x0b, 0xfd, 0x16, 0x0c, 0x0b
]);
let result = await WebAssembly.instantiate(wasmBytes);
for (let i = 0; i < wasmTestLoopCount; ++i) {
assert.eq(result.instance.exports.simple_throw_catch_v128(0), 13);
assert.eq(result.instance.exports.simple_throw_catch_v128(1), 42);
}