I recently got a request to add basic BF16 arithmetic to SoftFloat. Although I don't object, I want to keep the implementations as simple as possible, so I've implemented them in terms of FP32 ops.
This is straightforward enough for add/sub/mul/div/sqrt, where double rounding is correct. It's tricker for FMA, where we need to perform the addition using round-to-odd to account for double rounding. (We then need to correct for -0.0 outputs when rounding down.)
I recently got a request to add basic BF16 arithmetic to SoftFloat. Although I don't object, I want to keep the implementations as simple as possible, so I've implemented them in terms of FP32 ops.
This is straightforward enough for add/sub/mul/div/sqrt, where double rounding is correct. It's tricker for FMA, where we need to perform the addition using round-to-odd to account for double rounding. (We then need to correct for -0.0 outputs when rounding down.)
I've added these to Spike first because it was easier for me to test them this way. If the PR is accepted, I'll backport them to https://github.com/ucb-bar/berkeley-softfloat-3.