Closed
Description
wasm_v8x16_shuffle
is widely used in OpenCV.js universal intrinsic implementation, e.g. v_interleave_quads
. However, if the code uses wasm_v8x16_shuffle
and compiles to wasm, the wasm2wat
tool will report unexpected opcode: 0xfd 0x3
for that wasm file. According to https://github.com/WebAssembly/simd/blob/master/proposals/simd/BinarySIMD.md, there is no opcode 0xfd 0x3
.
This issue blocks the wat based analysis of OpenCV.js SIMD optimization.
v_interleave_quads.cc
:
#include <wasm_simd128.h>
#include <stdio.h>
__attribute__((noinline))
inline __i8x16 v_interleave_quads(const __i8x16& vec)
{
return wasm_v8x16_shuffle(vec, vec, 0,4,1,5,2,6,3,7,8,12,9,13,10,14,11,15);
}
int main() {
__i8x16 a= wasm_i8x16_make(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
__i8x16 b = v_interleave_quads(a);
printf("%d \n", wasm_i8x16_extract_lane(b, 0));
return 0;
}
compile it by
emcc -O2 -g2 -msimd128 -o v_interleave_quads.html v_interleave_quads.cc
wasm2wat
log:
$ wasm2wat --enable-all -o v_interleave_quads.wat v_interleave_quads.wasm
000027e: error: unexpected opcode: 0xfd 0x3