binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

[FP16] Implement madd and nmadd.

Open brendandahl opened this issue 1 year ago • 1 comments

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.

brendandahl avatar Aug 27 '24 23:08 brendandahl

Hmm, troubling that our interpreter was just wrong for these instructions. I guess we don't fuzz them against V8?

Yeah, that would be https://github.com/WebAssembly/binaryen/blob/e2ceaa58c10e9ee3e9eece42466243f5a8aff125/src/tools/fuzzing/fuzzing.cpp#L3700

brendandahl avatar Aug 28 '24 00:08 brendandahl