diff options
Diffstat (limited to 'sysdeps/riscv/rvf/s_fmaxf.c')
-rw-r--r-- | sysdeps/riscv/rvf/s_fmaxf.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sysdeps/riscv/rvf/s_fmaxf.c b/sysdeps/riscv/rvf/s_fmaxf.c index 3293f2f41c..63f7e3d664 100644 --- a/sysdeps/riscv/rvf/s_fmaxf.c +++ b/sysdeps/riscv/rvf/s_fmaxf.c @@ -17,12 +17,19 @@ <http://www.gnu.org/licenses/>. */ #include <math.h> +#include <math_private.h> #include <libm-alias-float.h> float __fmaxf (float x, float y) { - asm ("fmax.s %0, %1, %2" : "=f" (x) : "f" (x), "f" (y)); - return x; + float res; + + if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN)) + return x + y; + else + asm ("fmax.s %0, %1, %2" : "=f" (res) : "f" (x), "f" (y)); + + return res; } libm_alias_float (__fmax, fmax) |