diff options
author | Brendan Dahl <brendan.dahl@gmail.com> | 2024-09-03 12:08:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-03 12:08:50 -0700 |
commit | db9ee9434bd74ac8f1637ec109dc52e4b09794a7 (patch) | |
tree | 3a6067d3467a74730ee92914444169f6ae48e29c /src/wasm/wasm-binary.cpp | |
parent | b7cdb8c2110dff5a9b096d766dac04cd8ec04cc9 (diff) | |
download | binaryen-db9ee9434bd74ac8f1637ec109dc52e4b09794a7.tar.gz binaryen-db9ee9434bd74ac8f1637ec109dc52e4b09794a7.tar.bz2 binaryen-db9ee9434bd74ac8f1637ec109dc52e4b09794a7.zip |
[FP16] Implement madd and nmadd. (#6878)
Specified at
https://github.com/WebAssembly/half-precision/blob/main/proposals/half-precision/Overview.md
A few notes:
- The F32x4 and F64x2 versions of madd and nmadd are missing spect
tests.
- For madd, the implementation was incorrectly doing `(b*c)+a` where it
should be `(a*b)+c`.
- For nmadd, the implementation was incorrectly doing `(-b*c)+a` where
it should be `-(a*b)+c`.
- There doesn't appear to be a great way to actually implement a fused
nmadd, but the spec allows the double rounded version I added.
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r-- | src/wasm/wasm-binary.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 8c684dc2f..542eab4b4 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -6823,6 +6823,14 @@ bool WasmBinaryReader::maybeVisitSIMDTernary(Expression*& out, uint32_t code) { curr = allocator.alloc<SIMDTernary>(); curr->op = LaneselectI64x2; break; + case BinaryConsts::F16x8RelaxedMadd: + curr = allocator.alloc<SIMDTernary>(); + curr->op = RelaxedMaddVecF16x8; + break; + case BinaryConsts::F16x8RelaxedNmadd: + curr = allocator.alloc<SIMDTernary>(); + curr->op = RelaxedNmaddVecF16x8; + break; case BinaryConsts::F32x4RelaxedMadd: curr = allocator.alloc<SIMDTernary>(); curr->op = RelaxedMaddVecF32x4; |