pickNaNMulAdd logic on Xtensa is the same as pickNaN when applied to the expression (a * b) + c. So with two pickNaN variants there must be two pickNaNMulAdd variants.
Cc: Peter Maydell <peter.mayd...@linaro.org> Cc: "Alex Bennée" <alex.ben...@linaro.org> Signed-off-by: Max Filippov <jcmvb...@gmail.com> --- fpu/softfloat-specialize.inc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/fpu/softfloat-specialize.inc.c b/fpu/softfloat-specialize.inc.c index e17327b405c5..6b07d50efad3 100644 --- a/fpu/softfloat-specialize.inc.c +++ b/fpu/softfloat-specialize.inc.c @@ -574,6 +574,24 @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls, } else { return 1; } +#elif defined(TARGET_XTENSA) + if (status->use_first_nan) { + if (is_nan(a_cls)) { + return 0; + } else if (is_nan(b_cls)) { + return 1; + } else { + return 2; + } + } else { + if (is_nan(c_cls)) { + return 2; + } else if (is_nan(b_cls)) { + return 1; + } else { + return 0; + } + } #else /* A default implementation: prefer a to b to c. * This is unlikely to actually match any real implementation. -- 2.20.1