summaryrefslogtreecommitdiff
path: root/src/wasm-interpreter.h
diff options
context:
space:
mode:
authorNg Zhi An <zhin@chromium.org>2021-11-15 13:43:43 -0800
committerGitHub <noreply@github.com>2021-11-15 13:43:43 -0800
commit3549e3040340c706349b1ee9ab3e994279805afc (patch)
tree4764d49a6c0ec600102dd07ec677c6755b6da338 /src/wasm-interpreter.h
parented1f0d8427f330a18b2ca98adeadcb1be56d59bc (diff)
downloadbinaryen-3549e3040340c706349b1ee9ab3e994279805afc.tar.gz
binaryen-3549e3040340c706349b1ee9ab3e994279805afc.tar.bz2
binaryen-3549e3040340c706349b1ee9ab3e994279805afc.zip
Add support for relaxed-simd instructions (#4320)
This adds relaxed-simd instructions based on the current status of the proposal https://github.com/WebAssembly/relaxed-simd/blob/main/proposals/relaxed-simd/Overview.md. Binary opcodes are based on what is listed in https://github.com/WebAssembly/relaxed-simd/blob/main/proposals/relaxed-simd/Overview.md#binary-format. Text names are not fixed yet, and some sort sort of names that maps to the non-relaxed versions are chosen for this prototype. Support for these instructions have been added to LLVM via builtins, adding support here will allow Emscripten to successfully compile files that use those builtins. Interpreter support has also been added, and they delegate to the non-relaxed versions of the instructions. Most instructions are implemented in the interpreter the same way as the non-relaxed simd128 instructions, except for fma/fms, which is always fused.
Diffstat (limited to 'src/wasm-interpreter.h')
-rw-r--r--src/wasm-interpreter.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index 8bb250993..7eb13c002 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -538,8 +538,10 @@ public:
case ExtAddPairwiseUVecI16x8ToI32x4:
return value.extAddPairwiseToUI32x4();
case TruncSatSVecF32x4ToVecI32x4:
+ case RelaxedTruncSVecF32x4ToVecI32x4:
return value.truncSatToSI32x4();
case TruncSatUVecF32x4ToVecI32x4:
+ case RelaxedTruncUVecF32x4ToVecI32x4:
return value.truncSatToUI32x4();
case ConvertSVecI32x4ToVecF32x4:
return value.convertSToF32x4();
@@ -574,8 +576,10 @@ public:
case ConvertLowUVecI32x4ToVecF64x2:
return value.convertLowUToF64x2();
case TruncSatZeroSVecF64x2ToVecI32x4:
+ case RelaxedTruncZeroSVecF64x2ToVecI32x4:
return value.truncSatZeroSToI32x4();
case TruncSatZeroUVecF64x2ToVecI32x4:
+ case RelaxedTruncZeroUVecF64x2ToVecI32x4:
return value.truncSatZeroUToI32x4();
case DemoteZeroVecF64x2ToVecF32x4:
return value.demoteZeroToF32x4();
@@ -976,8 +980,10 @@ public:
case DivVecF32x4:
return left.divF32x4(right);
case MinVecF32x4:
+ case RelaxedMinVecF32x4:
return left.minF32x4(right);
case MaxVecF32x4:
+ case RelaxedMaxVecF32x4:
return left.maxF32x4(right);
case PMinVecF32x4:
return left.pminF32x4(right);
@@ -992,8 +998,10 @@ public:
case DivVecF64x2:
return left.divF64x2(right);
case MinVecF64x2:
+ case RelaxedMinVecF64x2:
return left.minF64x2(right);
case MaxVecF64x2:
+ case RelaxedMaxVecF64x2:
return left.maxF64x2(right);
case PMinVecF64x2:
return left.pminF64x2(right);
@@ -1010,6 +1018,7 @@ public:
return left.narrowUToI16x8(right);
case SwizzleVec8x16:
+ case RelaxedSwizzleVec8x16:
return left.swizzleI8x16(right);
case InvalidBinary:
@@ -1105,9 +1114,22 @@ public:
Literal c = flow.getSingleValue();
switch (curr->op) {
case Bitselect:
+ case LaneselectI8x16:
+ case LaneselectI16x8:
+ case LaneselectI32x4:
+ case LaneselectI64x2:
return c.bitselectV128(a, b);
+
+ case RelaxedFmaVecF32x4:
+ return a.relaxedFmaF32x4(b, c);
+ case RelaxedFmsVecF32x4:
+ return a.relaxedFmsF32x4(b, c);
+ case RelaxedFmaVecF64x2:
+ return a.relaxedFmaF64x2(b, c);
+ case RelaxedFmsVecF64x2:
+ return a.relaxedFmsF64x2(b, c);
default:
- // TODO: implement qfma/qfms and signselect
+ // TODO: implement signselect
WASM_UNREACHABLE("not implemented");
}
}