diff --git a/newlib/libm/machine/riscv/Makefile.am b/newlib/libm/machine/riscv/Makefile.am index 9443fb8e6..9e7b9e868 100644 --- a/newlib/libm/machine/riscv/Makefile.am +++ b/newlib/libm/machine/riscv/Makefile.am @@ -9,7 +9,8 @@ LIB_SOURCES = \ fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c \ s_fma.c e_sqrt.c sf_fma.c ef_sqrt.c \ s_fmax.c s_fmin.c sf_fmax.c sf_fmin.c \ - s_fabs.c sf_fabs.c + s_fabs.c sf_fabs.c \ + s_fpclassify.c sf_fpclassify.c noinst_LIBRARIES = lib.a lib_a_SOURCES = $(LIB_SOURCES) diff --git a/newlib/libm/machine/riscv/Makefile.in b/newlib/libm/machine/riscv/Makefile.in index 063c643bb..5c915e90f 100644 --- a/newlib/libm/machine/riscv/Makefile.in +++ b/newlib/libm/machine/riscv/Makefile.in @@ -81,7 +81,8 @@ am__objects_1 = lib_a-feclearexcept.$(OBJEXT) \ lib_a-ef_sqrt.$(OBJEXT) lib_a-s_fmax.$(OBJEXT) \ lib_a-s_fmin.$(OBJEXT) lib_a-sf_fmax.$(OBJEXT) \ lib_a-sf_fmin.$(OBJEXT) lib_a-s_fabs.$(OBJEXT) \ - lib_a-sf_fabs.$(OBJEXT) + lib_a-sf_fabs.$(OBJEXT) lib_a-s_fpclassify.$(OBJEXT) \ + lib_a-sf_fpclassify.$(OBJEXT) am_lib_a_OBJECTS = $(am__objects_1) lib_a_OBJECTS = $(am_lib_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ @@ -212,7 +213,8 @@ LIB_SOURCES = \ fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c \ s_fma.c e_sqrt.c sf_fma.c ef_sqrt.c \ s_fmax.c s_fmin.c sf_fmax.c sf_fmin.c \ - s_fabs.c sf_fabs.c + s_fabs.c sf_fabs.c \ + s_fpclassify.c sf_fpclassify.c noinst_LIBRARIES = lib.a lib_a_SOURCES = $(LIB_SOURCES) @@ -422,6 +424,18 @@ lib_a-sf_fabs.o: sf_fabs.c lib_a-sf_fabs.obj: sf_fabs.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fabs.obj `if test -f 'sf_fabs.c'; then $(CYGPATH_W) 'sf_fabs.c'; else $(CYGPATH_W) '$(srcdir)/sf_fabs.c'; fi` +lib_a-s_fpclassify.o: s_fpclassify.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fpclassify.o `test -f 's_fpclassify.c' || echo '$(srcdir)/'`s_fpclassify.c + +lib_a-s_fpclassify.obj: s_fpclassify.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fpclassify.obj `if test -f 's_fpclassify.c'; then $(CYGPATH_W) 's_fpclassify.c'; else $(CYGPATH_W) '$(srcdir)/s_fpclassify.c'; fi` + +lib_a-sf_fpclassify.o: sf_fpclassify.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fpclassify.o `test -f 'sf_fpclassify.c' || echo '$(srcdir)/'`sf_fpclassify.c + +lib_a-sf_fpclassify.obj: sf_fpclassify.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fpclassify.obj `if test -f 'sf_fpclassify.c'; then $(CYGPATH_W) 'sf_fpclassify.c'; else $(CYGPATH_W) '$(srcdir)/sf_fpclassify.c'; fi` + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ diff --git a/newlib/libm/machine/riscv/riscv_math.h b/newlib/libm/machine/riscv/riscv_math.h new file mode 100644 index 000000000..38948ca12 --- /dev/null +++ b/newlib/libm/machine/riscv/riscv_math.h @@ -0,0 +1,80 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2020 Kito Cheng + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __RISCV_MATH_H +#define __RISCV_MATH_H + + + +#ifdef __riscv_flen + +#define FCLASS_NEG_INF (1 << 0) +#define FCLASS_NEG_NORMAL (1 << 1) +#define FCLASS_NEG_SUBNORMAL (1 << 2) +#define FCLASS_NEG_ZERO (1 << 3) +#define FCLASS_POS_ZERO (1 << 4) +#define FCLASS_POS_SUBNORMAL (1 << 5) +#define FCLASS_POS_NORMAL (1 << 6) +#define FCLASS_POS_INF (1 << 7) +#define FCLASS_SNAN (1 << 8) +#define FCLASS_QNAN (1 << 9) + + +#define FCLASS_INF (FCLASS_NEG_INF | FCLASS_POS_INF) +#define FCLASS_ZERO (FCLASS_NEG_ZERO | FCLASS_POS_ZERO) +#define FCLASS_NORMAL (FCLASS_NEG_NORMAL | FCLASS_POS_NORMAL) +#define FCLASS_SUBNORMAL (FCLASS_NEG_SUBNORMAL | FCLASS_POS_SUBNORMAL) +#define FCLASS_NAN (FCLASS_SNAN | FCLASS_QNAN) + +#if __riscv_flen >= 64 +static inline long _fclass_d(double x){ + long fclass; + __asm __volatile ("fclass.d\t%0, %1" : "=r" (fclass) : "f" (x)); + return fclass; +} +#endif + +#if __riscv_flen >= 32 +static inline long _fclass_f(float x){ + long fclass; + __asm __volatile ("fclass.s\t%0, %1" : "=r" (fclass) : "f" (x)); + return fclass; +} +#endif + +#endif /* __riscv_flen */ + + +#endif /* __RISCV_MATH_H */ diff --git a/newlib/libm/machine/riscv/s_finite.c b/newlib/libm/machine/riscv/s_finite.c new file mode 100644 index 000000000..f5336e5dc --- /dev/null +++ b/newlib/libm/machine/riscv/s_finite.c @@ -0,0 +1,51 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2020 Kito Cheng + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * finite(x) returns 1 is x is finite, else 0; + */ + +#include + +#if defined(__riscv_flen) && __riscv_flen >= 64 +#include "riscv_math.h" +int finite(double x) +{ + long fclass = _fclass_d (x); + return (fclass & FCLASS_INF) == 0; +} +#else +#include "../../common/s_finite.c" +#endif diff --git a/newlib/libm/machine/riscv/s_fpclassify.c b/newlib/libm/machine/riscv/s_fpclassify.c new file mode 100644 index 000000000..8112d4f78 --- /dev/null +++ b/newlib/libm/machine/riscv/s_fpclassify.c @@ -0,0 +1,60 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2020 Kito Cheng + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include + +#if defined(__riscv_flen) && __riscv_flen >= 64 + +#include "riscv_math.h" + +int +__fpclassifyd (double x) +{ + long fclass = _fclass_d (x); + + if (fclass & FCLASS_ZERO) + return FP_ZERO; + else if (fclass & FCLASS_NORMAL) + return FP_NORMAL; + else if (fclass & FCLASS_SUBNORMAL) + return FP_SUBNORMAL; + else if (fclass & FCLASS_INF) + return FP_INFINITE; + else + return FP_NAN; +} + +#else +#include "../../common/s_fpclassify.c" +#endif diff --git a/newlib/libm/machine/riscv/s_isinf.c b/newlib/libm/machine/riscv/s_isinf.c new file mode 100644 index 000000000..3c82ee268 --- /dev/null +++ b/newlib/libm/machine/riscv/s_isinf.c @@ -0,0 +1,52 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2020 Kito Cheng + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#if defined(__riscv_flen) && __riscv_flen >= 64 + +#include "riscv_math.h" +#undef isinf + +int +isinf (double x) +{ + long fclass = _fclass_d (x); + return (fclass & FCLASS_INF); +} +#else +#include "../../common/sf_isinf.c" +#endif diff --git a/newlib/libm/machine/riscv/sf_finite.c b/newlib/libm/machine/riscv/sf_finite.c new file mode 100644 index 000000000..f1cf5c6ce --- /dev/null +++ b/newlib/libm/machine/riscv/sf_finite.c @@ -0,0 +1,48 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2020 Kito Cheng + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#if defined(__riscv_flen) && __riscv_flen >= 32 + +#include "riscv_math.h" +int finitef(float x) +{ + long fclass = _fclass_f (x); + return (fclass & FCLASS_INF) == 0; +} +#else +#include "../../common/sf_finite.c" +#endif diff --git a/newlib/libm/machine/riscv/sf_fpclassify.c b/newlib/libm/machine/riscv/sf_fpclassify.c new file mode 100644 index 000000000..dee9a7a25 --- /dev/null +++ b/newlib/libm/machine/riscv/sf_fpclassify.c @@ -0,0 +1,60 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2020 Kito Cheng + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include + +#if defined(__riscv_flen) && __riscv_flen >= 32 + +#include "riscv_math.h" + +int +__fpclassifyf (float x) +{ + long fclass = _fclass_f (x); + + if (fclass & FCLASS_ZERO) + return FP_ZERO; + else if (fclass & FCLASS_NORMAL) + return FP_NORMAL; + else if (fclass & FCLASS_SUBNORMAL) + return FP_SUBNORMAL; + else if (fclass & FCLASS_INF) + return FP_INFINITE; + else + return FP_NAN; +} + +#else +#include "../../common/sf_fpclassify.c" +#endif diff --git a/newlib/libm/machine/riscv/sf_isinf.c b/newlib/libm/machine/riscv/sf_isinf.c new file mode 100644 index 000000000..0c60f33af --- /dev/null +++ b/newlib/libm/machine/riscv/sf_isinf.c @@ -0,0 +1,52 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2020 Kito Cheng + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#if defined(__riscv_flen) && __riscv_flen >= 32 + +#include "riscv_math.h" +#undef isinff + +int +isinff (float x) +{ + long fclass = _fclass_f (x); + return (fclass & FCLASS_INF); +} +#else +#include "../../common/sf_isinf.c" +#endif