diff options
author | Eshan dhawan via Newlib <newlib@sourceware.org> | 2020-06-03 20:45:09 +0300 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2020-06-10 04:13:17 +0300 |
commit | a97bdf100f54c736c1ab46d39984c4deaacd7386 (patch) | |
tree | f4e16336d7f2593e3b1ccb5676c5c06fce2c3dd7 /newlib/libm | |
parent | bc5087298d61cfcd113a04dc223517b0a1073582 (diff) |
fenv support arm
Signed-off-by: Eshan dhawan <eshandhawan51@gmail.com>
Diffstat (limited to 'newlib/libm')
-rw-r--r-- | newlib/libm/machine/arm/Makefile.am | 18 | ||||
-rw-r--r-- | newlib/libm/machine/arm/Makefile.in | 117 | ||||
-rw-r--r-- | newlib/libm/machine/arm/fe_dfl_env.c | 7 | ||||
-rw-r--r-- | newlib/libm/machine/arm/feclearexcept.c | 7 | ||||
-rw-r--r-- | newlib/libm/machine/arm/fegetenv.c | 7 | ||||
-rw-r--r-- | newlib/libm/machine/arm/fegetexceptflag.c | 7 | ||||
-rw-r--r-- | newlib/libm/machine/arm/fegetround.c | 7 | ||||
-rw-r--r-- | newlib/libm/machine/arm/feholdexcept.c | 7 | ||||
-rw-r--r-- | newlib/libm/machine/arm/fenv-softfp.c | 32 | ||||
-rw-r--r-- | newlib/libm/machine/arm/fenv-vfp.c | 32 | ||||
-rw-r--r-- | newlib/libm/machine/arm/fenv.c | 328 | ||||
-rw-r--r-- | newlib/libm/machine/arm/feraiseexcept.c | 7 | ||||
-rw-r--r-- | newlib/libm/machine/arm/fesetenv.c | 7 | ||||
-rw-r--r-- | newlib/libm/machine/arm/fesetexceptflag.c | 7 | ||||
-rw-r--r-- | newlib/libm/machine/arm/fesetround.c | 7 | ||||
-rw-r--r-- | newlib/libm/machine/arm/fetestexcept.c | 7 | ||||
-rw-r--r-- | newlib/libm/machine/arm/feupdateenv.c | 7 |
17 files changed, 608 insertions, 3 deletions
diff --git a/newlib/libm/machine/arm/Makefile.am b/newlib/libm/machine/arm/Makefile.am index 1f10a7a40..a64ee59d5 100644 --- a/newlib/libm/machine/arm/Makefile.am +++ b/newlib/libm/machine/arm/Makefile.am @@ -19,7 +19,23 @@ LIB_SOURCES = \ sf_nearbyint.c \ sf_rint.c \ sf_round.c \ - sf_trunc.c + sf_trunc.c \ + feclearexcept.c \ + fe_dfl_env.c\ + fegetenv.c \ + fegetexceptflag.c \ + fegetround.c \ + feholdexcept.c \ + fenv.c \ + feraiseexcept.c \ + fesetenv.c \ + fesetexceptflag.c \ + fesetround.c \ + fetestexcept.c \ + feupdateenv.c \ + fenv-vfp.c \ + fenv-softfp.c + noinst_LIBRARIES = lib.a lib_a_SOURCES = $(LIB_SOURCES) diff --git a/newlib/libm/machine/arm/Makefile.in b/newlib/libm/machine/arm/Makefile.in index 0a5a27327..ecfa684e7 100644 --- a/newlib/libm/machine/arm/Makefile.in +++ b/newlib/libm/machine/arm/Makefile.in @@ -76,7 +76,15 @@ am__objects_1 = lib_a-e_sqrt.$(OBJEXT) lib_a-ef_sqrt.$(OBJEXT) \ lib_a-s_round.$(OBJEXT) lib_a-s_trunc.$(OBJEXT) \ lib_a-sf_ceil.$(OBJEXT) lib_a-sf_floor.$(OBJEXT) \ lib_a-sf_nearbyint.$(OBJEXT) lib_a-sf_rint.$(OBJEXT) \ - lib_a-sf_round.$(OBJEXT) lib_a-sf_trunc.$(OBJEXT) + lib_a-sf_round.$(OBJEXT) lib_a-sf_trunc.$(OBJEXT) \ + lib_a-feclearexcept.$(OBJEXT) lib_a-fe_dfl_env.$(OBJEXT) \ + lib_a-fegetenv.$(OBJEXT) lib_a-fegetexceptflag.$(OBJEXT) \ + lib_a-fegetround.$(OBJEXT) lib_a-feholdexcept.$(OBJEXT) \ + lib_a-fenv.$(OBJEXT) lib_a-feraiseexcept.$(OBJEXT) \ + lib_a-fesetenv.$(OBJEXT) lib_a-fesetexceptflag.$(OBJEXT) \ + lib_a-fesetround.$(OBJEXT) lib_a-fetestexcept.$(OBJEXT) \ + lib_a-feupdateenv.$(OBJEXT) lib_a-fenv-vfp.$(OBJEXT) \ + lib_a-fenv-softfp.$(OBJEXT) am_lib_a_OBJECTS = $(am__objects_1) lib_a_OBJECTS = $(am_lib_a_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ @@ -216,7 +224,22 @@ LIB_SOURCES = \ sf_nearbyint.c \ sf_rint.c \ sf_round.c \ - sf_trunc.c + sf_trunc.c \ + feclearexcept.c \ + fe_dfl_env.c\ + fegetenv.c \ + fegetexceptflag.c \ + fegetround.c \ + feholdexcept.c \ + fenv.c \ + feraiseexcept.c \ + fesetenv.c \ + fesetexceptflag.c \ + fesetround.c \ + fetestexcept.c \ + feupdateenv.c \ + fenv-vfp.c \ + fenv-softfp.c noinst_LIBRARIES = lib.a lib_a_SOURCES = $(LIB_SOURCES) @@ -378,6 +401,96 @@ lib_a-sf_trunc.o: sf_trunc.c lib_a-sf_trunc.obj: sf_trunc.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_trunc.obj `if test -f 'sf_trunc.c'; then $(CYGPATH_W) 'sf_trunc.c'; else $(CYGPATH_W) '$(srcdir)/sf_trunc.c'; fi` +lib_a-feclearexcept.o: feclearexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feclearexcept.o `test -f 'feclearexcept.c' || echo '$(srcdir)/'`feclearexcept.c + +lib_a-feclearexcept.obj: feclearexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feclearexcept.obj `if test -f 'feclearexcept.c'; then $(CYGPATH_W) 'feclearexcept.c'; else $(CYGPATH_W) '$(srcdir)/feclearexcept.c'; fi` + +lib_a-fe_dfl_env.o: fe_dfl_env.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fe_dfl_env.o `test -f 'fe_dfl_env.c' || echo '$(srcdir)/'`fe_dfl_env.c + +lib_a-fe_dfl_env.obj: fe_dfl_env.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fe_dfl_env.obj `if test -f 'fe_dfl_env.c'; then $(CYGPATH_W) 'fe_dfl_env.c'; else $(CYGPATH_W) '$(srcdir)/fe_dfl_env.c'; fi` + +lib_a-fegetenv.o: fegetenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fegetenv.o `test -f 'fegetenv.c' || echo '$(srcdir)/'`fegetenv.c + +lib_a-fegetenv.obj: fegetenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fegetenv.obj `if test -f 'fegetenv.c'; then $(CYGPATH_W) 'fegetenv.c'; else $(CYGPATH_W) '$(srcdir)/fegetenv.c'; fi` + +lib_a-fegetexceptflag.o: fegetexceptflag.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fegetexceptflag.o `test -f 'fegetexceptflag.c' || echo '$(srcdir)/'`fegetexceptflag.c + +lib_a-fegetexceptflag.obj: fegetexceptflag.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fegetexceptflag.obj `if test -f 'fegetexceptflag.c'; then $(CYGPATH_W) 'fegetexceptflag.c'; else $(CYGPATH_W) '$(srcdir)/fegetexceptflag.c'; fi` + +lib_a-fegetround.o: fegetround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fegetround.o `test -f 'fegetround.c' || echo '$(srcdir)/'`fegetround.c + +lib_a-fegetround.obj: fegetround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fegetround.obj `if test -f 'fegetround.c'; then $(CYGPATH_W) 'fegetround.c'; else $(CYGPATH_W) '$(srcdir)/fegetround.c'; fi` + +lib_a-feholdexcept.o: feholdexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feholdexcept.o `test -f 'feholdexcept.c' || echo '$(srcdir)/'`feholdexcept.c + +lib_a-feholdexcept.obj: feholdexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feholdexcept.obj `if test -f 'feholdexcept.c'; then $(CYGPATH_W) 'feholdexcept.c'; else $(CYGPATH_W) '$(srcdir)/feholdexcept.c'; fi` + +lib_a-fenv.o: fenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fenv.o `test -f 'fenv.c' || echo '$(srcdir)/'`fenv.c + +lib_a-fenv.obj: fenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fenv.obj `if test -f 'fenv.c'; then $(CYGPATH_W) 'fenv.c'; else $(CYGPATH_W) '$(srcdir)/fenv.c'; fi` + +lib_a-feraiseexcept.o: feraiseexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feraiseexcept.o `test -f 'feraiseexcept.c' || echo '$(srcdir)/'`feraiseexcept.c + +lib_a-feraiseexcept.obj: feraiseexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feraiseexcept.obj `if test -f 'feraiseexcept.c'; then $(CYGPATH_W) 'feraiseexcept.c'; else $(CYGPATH_W) '$(srcdir)/feraiseexcept.c'; fi` + +lib_a-fesetenv.o: fesetenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fesetenv.o `test -f 'fesetenv.c' || echo '$(srcdir)/'`fesetenv.c + +lib_a-fesetenv.obj: fesetenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fesetenv.obj `if test -f 'fesetenv.c'; then $(CYGPATH_W) 'fesetenv.c'; else $(CYGPATH_W) '$(srcdir)/fesetenv.c'; fi` + +lib_a-fesetexceptflag.o: fesetexceptflag.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fesetexceptflag.o `test -f 'fesetexceptflag.c' || echo '$(srcdir)/'`fesetexceptflag.c + +lib_a-fesetexceptflag.obj: fesetexceptflag.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fesetexceptflag.obj `if test -f 'fesetexceptflag.c'; then $(CYGPATH_W) 'fesetexceptflag.c'; else $(CYGPATH_W) '$(srcdir)/fesetexceptflag.c'; fi` + +lib_a-fesetround.o: fesetround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fesetround.o `test -f 'fesetround.c' || echo '$(srcdir)/'`fesetround.c + +lib_a-fesetround.obj: fesetround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fesetround.obj `if test -f 'fesetround.c'; then $(CYGPATH_W) 'fesetround.c'; else $(CYGPATH_W) '$(srcdir)/fesetround.c'; fi` + +lib_a-fetestexcept.o: fetestexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fetestexcept.o `test -f 'fetestexcept.c' || echo '$(srcdir)/'`fetestexcept.c + +lib_a-fetestexcept.obj: fetestexcept.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fetestexcept.obj `if test -f 'fetestexcept.c'; then $(CYGPATH_W) 'fetestexcept.c'; else $(CYGPATH_W) '$(srcdir)/fetestexcept.c'; fi` + +lib_a-feupdateenv.o: feupdateenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feupdateenv.o `test -f 'feupdateenv.c' || echo '$(srcdir)/'`feupdateenv.c + +lib_a-feupdateenv.obj: feupdateenv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feupdateenv.obj `if test -f 'feupdateenv.c'; then $(CYGPATH_W) 'feupdateenv.c'; else $(CYGPATH_W) '$(srcdir)/feupdateenv.c'; fi` + +lib_a-fenv-vfp.o: fenv-vfp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fenv-vfp.o `test -f 'fenv-vfp.c' || echo '$(srcdir)/'`fenv-vfp.c + +lib_a-fenv-vfp.obj: fenv-vfp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fenv-vfp.obj `if test -f 'fenv-vfp.c'; then $(CYGPATH_W) 'fenv-vfp.c'; else $(CYGPATH_W) '$(srcdir)/fenv-vfp.c'; fi` + +lib_a-fenv-softfp.o: fenv-softfp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fenv-softfp.o `test -f 'fenv-softfp.c' || echo '$(srcdir)/'`fenv-softfp.c + +lib_a-fenv-softfp.obj: fenv-softfp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fenv-softfp.obj `if test -f 'fenv-softfp.c'; then $(CYGPATH_W) 'fenv-softfp.c'; else $(CYGPATH_W) '$(srcdir)/fenv-softfp.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/arm/fe_dfl_env.c b/newlib/libm/machine/arm/fe_dfl_env.c new file mode 100644 index 000000000..8cbee7771 --- /dev/null +++ b/newlib/libm/machine/arm/fe_dfl_env.c @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * (c) Copyright 2019 Joel Sherrill <joel@rtems.org> + */ + +#include "../../fenv/fenv_stub.c" diff --git a/newlib/libm/machine/arm/feclearexcept.c b/newlib/libm/machine/arm/feclearexcept.c new file mode 100644 index 000000000..8cbee7771 --- /dev/null +++ b/newlib/libm/machine/arm/feclearexcept.c @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * (c) Copyright 2019 Joel Sherrill <joel@rtems.org> + */ + +#include "../../fenv/fenv_stub.c" diff --git a/newlib/libm/machine/arm/fegetenv.c b/newlib/libm/machine/arm/fegetenv.c new file mode 100644 index 000000000..8cbee7771 --- /dev/null +++ b/newlib/libm/machine/arm/fegetenv.c @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * (c) Copyright 2019 Joel Sherrill <joel@rtems.org> + */ + +#include "../../fenv/fenv_stub.c" diff --git a/newlib/libm/machine/arm/fegetexceptflag.c b/newlib/libm/machine/arm/fegetexceptflag.c new file mode 100644 index 000000000..8cbee7771 --- /dev/null +++ b/newlib/libm/machine/arm/fegetexceptflag.c @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * (c) Copyright 2019 Joel Sherrill <joel@rtems.org> + */ + +#include "../../fenv/fenv_stub.c" diff --git a/newlib/libm/machine/arm/fegetround.c b/newlib/libm/machine/arm/fegetround.c new file mode 100644 index 000000000..8cbee7771 --- /dev/null +++ b/newlib/libm/machine/arm/fegetround.c @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * (c) Copyright 2019 Joel Sherrill <joel@rtems.org> + */ + +#include "../../fenv/fenv_stub.c" diff --git a/newlib/libm/machine/arm/feholdexcept.c b/newlib/libm/machine/arm/feholdexcept.c new file mode 100644 index 000000000..8cbee7771 --- /dev/null +++ b/newlib/libm/machine/arm/feholdexcept.c @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * (c) Copyright 2019 Joel Sherrill <joel@rtems.org> + */ + +#include "../../fenv/fenv_stub.c" diff --git a/newlib/libm/machine/arm/fenv-softfp.c b/newlib/libm/machine/arm/fenv-softfp.c new file mode 100644 index 000000000..a576cc1b2 --- /dev/null +++ b/newlib/libm/machine/arm/fenv-softfp.c @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2013 Andrew Turner <andrew@FreeBSD.ORG> + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD$ + */ + +#define FENV_MANGLE(x) __softfp_ ##x +#include <machine/fenv-mangle.h> +#include "fenv.c" + diff --git a/newlib/libm/machine/arm/fenv-vfp.c b/newlib/libm/machine/arm/fenv-vfp.c new file mode 100644 index 000000000..297e81296 --- /dev/null +++ b/newlib/libm/machine/arm/fenv-vfp.c @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2013 Andrew Turner <andrew@FreeBSD.ORG> + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD$ + */ + +#define FENV_MANGLE(x) __vfp_ ##x +#include <machine/fenv-mangle.h> +#include "fenv.c" + diff --git a/newlib/libm/machine/arm/fenv.c b/newlib/libm/machine/arm/fenv.c new file mode 100644 index 000000000..5b61ab81f --- /dev/null +++ b/newlib/libm/machine/arm/fenv.c @@ -0,0 +1,328 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2004 David Schultz <das@FreeBSD.ORG> + * Copyright (c) 2013 Andrew Turner <andrew@FreeBSD.ORG> + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD$ + */ + +#define __fenv_static +#include <fenv.h> + +#include <machine/acle-compat.h> + +#if __ARM_ARCH >= 6 +#define FENV_ARMv6 +#endif + +/* When SOFTFP_ABI is defined we are using the softfp ABI. */ +#if defined(__VFP_FP__) && !defined(__ARM_PCS_VFP) +#define SOFTFP_ABI +#endif + + +#ifndef FENV_MANGLE +/* + * Hopefully the system ID byte is immutable, so it's valid to use + * this as a default environment. + */ +fenv_t __fe_dfl_env = { 0 }; + +const fenv_t *_fe_dfl_env = &__fe_dfl_env; +#endif + + +/* If this is a non-mangled softfp version special processing is required */ +#if defined(FENV_MANGLE) || !defined(SOFTFP_ABI) || !defined(FENV_ARMv6) + +/* + * The following macros map between the softfloat emulator's flags and + * the hardware's FPSR. The hardware this file was written for doesn't + * have rounding control bits, so we stick those in the system ID byte. + */ +#ifndef __ARM_PCS_VFP +#define __set_env(env, flags, mask, rnd) env = ((flags) \ + | (mask)<<_FPUSW_SHIFT \ + | (rnd) << 24) +#define __env_flags(env) ((env) & FE_ALL_EXCEPT) +#define __env_mask(env) (((env) >> _FPUSW_SHIFT) \ + & FE_ALL_EXCEPT) +#define __env_round(env) (((env) >> 24) & _ROUND_MASK) + +#include <machine/fenv-softfloat.h> + +#else /* __ARM_PCS_VFP PRESENT */ + +#include <machine/fenv-vfp.h> + +#endif /* __ARM_PCS_VFP */ + +#ifdef __GNUC_GNU_INLINE__ +#error "This file must be compiled with C99 'inline' semantics" +#endif + +extern inline int feclearexcept(int excepts); +extern inline int fegetexceptflag(fexcept_t *flagp, int excepts); +extern inline int fesetexceptflag(const fexcept_t *flagp, int excepts); +extern inline int feraiseexcept(int excepts); +extern inline int fetestexcept(int excepts); +extern inline int fegetround(void); +extern inline int fesetround(int round); +extern inline int fegetenv(fenv_t *envp); +extern inline int feholdexcept(fenv_t *envp); +extern inline int fesetenv(const fenv_t *envp); +extern inline int feupdateenv(const fenv_t *envp); +extern inline int feenableexcept(int __mask); +extern inline int fedisableexcept(int __mask); +extern inline int fegetexcept(void); + +#else /* !FENV_MANGLE && SOFTFP_ABI */ +/* Set by libc when the VFP unit is enabled */ + +int _libc_arm_fpu_present; + +int __softfp_feclearexcept(int excepts); +int __softfp_fegetexceptflag(fexcept_t *flagp, int excepts); +int __softfp_fesetexceptflag(const fexcept_t *flagp, int excepts); +int __softfp_feraiseexcept(int excepts); +int __softfp_fetestexcept(int excepts); +int __softfp_fegetround(void); +int __softfp_fesetround(int round); +int __softfp_fegetenv(fenv_t *envp); +int __softfp_feholdexcept(fenv_t *envp); +int __softfp_fesetenv(const fenv_t *envp); +int __softfp_feupdateenv(const fenv_t *envp); +int __softfp_feenableexcept(int __mask); +int __softfp_fedisableexcept(int __mask); +int __softfp_fegetexcept(void); + +int __vfp_feclearexcept(int excepts); +int __vfp_fegetexceptflag(fexcept_t *flagp, int excepts); +int __vfp_fesetexceptflag(const fexcept_t *flagp, int excepts); +int __vfp_feraiseexcept(int excepts); +int __vfp_fetestexcept(int excepts); +int __vfp_fegetround(void); +int __vfp_fesetround(int round); +int __vfp_fegetenv(fenv_t *envp); +int __vfp_feholdexcept(fenv_t *envp); +int __vfp_fesetenv(const fenv_t *envp); +int __vfp_feupdateenv(const fenv_t *envp); +int __vfp_feenableexcept(int __mask); +int __vfp_fedisableexcept(int __mask); +int __vfp_fegetexcept(void); + +static int +__softfp_round_to_vfp(int round) +{ + + switch (round) { + case FE_TONEAREST: + default: + return VFP_FE_TONEAREST; + case FE_TOWARDZERO: + return VFP_FE_TOWARDZERO; + case FE_UPWARD: + return VFP_FE_UPWARD; + case FE_DOWNWARD: + return VFP_FE_DOWNWARD; + } +} + +static int +__softfp_round_from_vfp(int round) +{ + + switch (round) { + case VFP_FE_TONEAREST: + default: + return FE_TONEAREST; + case VFP_FE_TOWARDZERO: + return FE_TOWARDZERO; + case VFP_FE_UPWARD: + return FE_UPWARD; + case VFP_FE_DOWNWARD: + return FE_DOWNWARD; + } +} + +int feclearexcept(int excepts) +{ + + if (_libc_arm_fpu_present) + __vfp_feclearexcept(excepts); + __softfp_feclearexcept(excepts); + + return (0); +} + +int fegetexceptflag(fexcept_t *flagp, int excepts) +{ + fexcept_t __vfp_flagp; + + __vfp_flagp = 0; + if (_libc_arm_fpu_present) + __vfp_fegetexceptflag(&__vfp_flagp, excepts); + __softfp_fegetexceptflag(flagp, excepts); + + *flagp |= __vfp_flagp; + + return (0); +} + +int fesetexceptflag(const fexcept_t *flagp, int excepts) +{ + + if (_libc_arm_fpu_present) + __vfp_fesetexceptflag(flagp, excepts); + __softfp_fesetexceptflag(flagp, excepts); + + return (0); +} + +int feraiseexcept(int excepts) +{ + + if (_libc_arm_fpu_present) + __vfp_feraiseexcept(excepts); + __softfp_feraiseexcept(excepts); + + return (0); +} + +int fetestexcept(int excepts) +{ + int __got_excepts; + + __got_excepts = 0; + if (_libc_arm_fpu_present) + __got_excepts = __vfp_fetestexcept(excepts); + __got_excepts |= __softfp_fetestexcept(excepts); + + return (__got_excepts); +} + +int fegetround(void) +{ + + if (_libc_arm_fpu_present) + return __softfp_round_from_vfp(__vfp_fegetround()); + return __softfp_fegetround(); +} + +int fesetround(int round) +{ + + if (_libc_arm_fpu_present) + __vfp_fesetround(__softfp_round_to_vfp(round)); + __softfp_fesetround(round); + + return (0); +} + +int fegetenv(fenv_t *envp) +{ + fenv_t __vfp_envp; + + __vfp_envp = 0; + if (_libc_arm_fpu_present) + __vfp_fegetenv(&__vfp_envp); + __softfp_fegetenv(envp); + *envp |= __vfp_envp; + + return (0); +} + +int feholdexcept(fenv_t *envp) +{ + fenv_t __vfp_envp; + + __vfp_envp = 0; + if (_libc_arm_fpu_present) + __vfp_feholdexcept(&__vfp_envp); + __softfp_feholdexcept(envp); + *envp |= __vfp_envp; + + return (0); +} + +int fesetenv(const fenv_t *envp) +{ + + if (_libc_arm_fpu_present) + __vfp_fesetenv(envp); + __softfp_fesetenv(envp); + + return (0); +} + +int feupdateenv(const fenv_t *envp) +{ + + if (_libc_arm_fpu_present) + __vfp_feupdateenv(envp); + __softfp_feupdateenv(envp); + + return (0); +} + +int feenableexcept(int __mask) +{ + int __unmasked; + + __unmasked = 0; + if (_libc_arm_fpu_present) + __unmasked = __vfp_feenableexcept(__mask); + __unmasked |= __softfp_feenableexcept(__mask); + + return (__unmasked); +} + +int fedisableexcept(int __mask) +{ + int __unmasked; + + __unmasked = 0; + if (_libc_arm_fpu_present) + __unmasked = __vfp_fedisableexcept(__mask); + __unmasked |= __softfp_fedisableexcept(__mask); + + return (__unmasked); +} + +int fegetexcept(void) +{ + int __unmasked; + + __unmasked = 0; + if (_libc_arm_fpu_present) + __unmasked = __vfp_fegetexcept(); + __unmasked |= __softfp_fegetexcept(); + + return (__unmasked); +} + +#endif + diff --git a/newlib/libm/machine/arm/feraiseexcept.c b/newlib/libm/machine/arm/feraiseexcept.c new file mode 100644 index 000000000..8cbee7771 --- /dev/null +++ b/newlib/libm/machine/arm/feraiseexcept.c @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * (c) Copyright 2019 Joel Sherrill <joel@rtems.org> + */ + +#include "../../fenv/fenv_stub.c" diff --git a/newlib/libm/machine/arm/fesetenv.c b/newlib/libm/machine/arm/fesetenv.c new file mode 100644 index 000000000..8cbee7771 --- /dev/null +++ b/newlib/libm/machine/arm/fesetenv.c @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * (c) Copyright 2019 Joel Sherrill <joel@rtems.org> + */ + +#include "../../fenv/fenv_stub.c" diff --git a/newlib/libm/machine/arm/fesetexceptflag.c b/newlib/libm/machine/arm/fesetexceptflag.c new file mode 100644 index 000000000..8cbee7771 --- /dev/null +++ b/newlib/libm/machine/arm/fesetexceptflag.c @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * (c) Copyright 2019 Joel Sherrill <joel@rtems.org> + */ + +#include "../../fenv/fenv_stub.c" diff --git a/newlib/libm/machine/arm/fesetround.c b/newlib/libm/machine/arm/fesetround.c new file mode 100644 index 000000000..8cbee7771 --- /dev/null +++ b/newlib/libm/machine/arm/fesetround.c @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * (c) Copyright 2019 Joel Sherrill <joel@rtems.org> + */ + +#include "../../fenv/fenv_stub.c" diff --git a/newlib/libm/machine/arm/fetestexcept.c b/newlib/libm/machine/arm/fetestexcept.c new file mode 100644 index 000000000..8cbee7771 --- /dev/null +++ b/newlib/libm/machine/arm/fetestexcept.c @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * (c) Copyright 2019 Joel Sherrill <joel@rtems.org> + */ + +#include "../../fenv/fenv_stub.c" diff --git a/newlib/libm/machine/arm/feupdateenv.c b/newlib/libm/machine/arm/feupdateenv.c new file mode 100644 index 000000000..8cbee7771 --- /dev/null +++ b/newlib/libm/machine/arm/feupdateenv.c @@ -0,0 +1,7 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * (c) Copyright 2019 Joel Sherrill <joel@rtems.org> + */ + +#include "../../fenv/fenv_stub.c" |