mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 12:29:32 +08:00
Add RISC-V port for libm
Contributor list: - Michael Neilly <mneilly@yahoo.com> - Kito Cheng <kito.cheng@gmail.com>
This commit is contained in:
parent
979d467ff6
commit
7040b2de08
@ -1146,3 +1146,36 @@ including the implied warranties of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. A copy of this license is available at
|
||||
http://www.opensource.org/licenses.
|
||||
|
||||
(50) Michael R. Neilly (riscv-* targets)
|
||||
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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.
|
||||
|
||||
|
5
newlib/libm/machine/configure
vendored
5
newlib/libm/machine/configure
vendored
@ -789,7 +789,8 @@ ac_subdirs_all='aarch64
|
||||
arm
|
||||
i386
|
||||
nds32
|
||||
spu'
|
||||
spu
|
||||
riscv'
|
||||
|
||||
# Initialize some variables set by options.
|
||||
ac_init_help=
|
||||
@ -11794,6 +11795,8 @@ subdirs="$subdirs aarch64"
|
||||
nds32) subdirs="$subdirs nds32"
|
||||
;;
|
||||
spu) subdirs="$subdirs spu"
|
||||
;;
|
||||
riscv) subdirs="$subdirs riscv"
|
||||
;;
|
||||
esac;
|
||||
if test "${use_libtool}" = "yes"; then
|
||||
|
@ -30,6 +30,7 @@ if test -n "${libm_machine_dir}"; then
|
||||
i386) AC_CONFIG_SUBDIRS(i386) ;;
|
||||
nds32) AC_CONFIG_SUBDIRS(nds32) ;;
|
||||
spu) AC_CONFIG_SUBDIRS(spu) ;;
|
||||
riscv) AC_CONFIG_SUBDIRS(riscv) ;;
|
||||
esac;
|
||||
if test "${use_libtool}" = "yes"; then
|
||||
machlib=${libm_machine_dir}/lib${libm_machine_dir}.${aext}
|
||||
|
20
newlib/libm/machine/riscv/Makefile.am
Normal file
20
newlib/libm/machine/riscv/Makefile.am
Normal file
@ -0,0 +1,20 @@
|
||||
## Process this file with automake to generate Makefile.in
|
||||
|
||||
INCLUDES = -I $(newlib_basedir)/../newlib/libm/common $(NEWLIB_CFLAGS) \
|
||||
$(CROSS_CFLAGS) $(TARGET_CFLAGS)
|
||||
|
||||
LIB_SOURCES = \
|
||||
feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \
|
||||
fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \
|
||||
fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c
|
||||
|
||||
noinst_LIBRARIES = lib.a
|
||||
lib_a_SOURCES = $(LIB_SOURCES)
|
||||
lib_a_CFLAGS = $(AM_CFLAGS)
|
||||
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
|
||||
noinst_DATA =
|
||||
|
||||
include $(srcdir)/../../../Makefile.shared
|
||||
|
||||
ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
|
||||
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
|
560
newlib/libm/machine/riscv/Makefile.in
Normal file
560
newlib/libm/machine/riscv/Makefile.in
Normal file
@ -0,0 +1,560 @@
|
||||
# Makefile.in generated by automake 1.11.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
|
||||
# Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__make_dryrun = \
|
||||
{ \
|
||||
am__dry=no; \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
||||
*) \
|
||||
for am__flg in $$MAKEFLAGS; do \
|
||||
case $$am__flg in \
|
||||
*=*|--*) ;; \
|
||||
*n*) am__dry=yes; break;; \
|
||||
esac; \
|
||||
done;; \
|
||||
esac; \
|
||||
test $$am__dry = yes; \
|
||||
}
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
DIST_COMMON = $(srcdir)/../../../Makefile.shared $(srcdir)/Makefile.in \
|
||||
$(srcdir)/Makefile.am $(top_srcdir)/configure \
|
||||
$(am__configure_deps) $(srcdir)/../../../../mkinstalldirs
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/../../../acinclude.m4 \
|
||||
$(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
ARFLAGS = cru
|
||||
lib_a_AR = $(AR) $(ARFLAGS)
|
||||
lib_a_LIBADD =
|
||||
am__objects_1 = 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-feraiseexcept.$(OBJEXT) \
|
||||
lib_a-fesetenv.$(OBJEXT) lib_a-fesetexceptflag.$(OBJEXT) \
|
||||
lib_a-fesetround.$(OBJEXT) lib_a-fetestexcept.$(OBJEXT) \
|
||||
lib_a-feupdateenv.$(OBJEXT)
|
||||
am_lib_a_OBJECTS = $(am__objects_1)
|
||||
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
depcomp =
|
||||
am__depfiles_maybe =
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(lib_a_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
DATA = $(noinst_DATA)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCAS = @CCAS@
|
||||
CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
|
||||
NO_INCLUDE_LIST = @NO_INCLUDE_LIST@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
READELF = @READELF@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
aext = @aext@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
libm_machine_dir = @libm_machine_dir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lpfx = @lpfx@
|
||||
machine_dir = @machine_dir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
newlib_basedir = @newlib_basedir@
|
||||
oext = @oext@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sys_dir = @sys_dir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
INCLUDES = -I $(newlib_basedir)/../newlib/libm/common $(NEWLIB_CFLAGS) \
|
||||
$(CROSS_CFLAGS) $(TARGET_CFLAGS)
|
||||
|
||||
LIB_SOURCES = \
|
||||
feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \
|
||||
fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \
|
||||
fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c
|
||||
|
||||
noinst_LIBRARIES = lib.a
|
||||
lib_a_SOURCES = $(LIB_SOURCES)
|
||||
lib_a_CFLAGS = $(AM_CFLAGS)
|
||||
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
|
||||
noinst_DATA =
|
||||
|
||||
#
|
||||
# documentation rules
|
||||
#
|
||||
SUFFIXES = .def .xml
|
||||
CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
|
||||
DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py
|
||||
DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml)
|
||||
DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml)
|
||||
CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES)
|
||||
ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
|
||||
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .def .xml .c .o .obj
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../Makefile.shared $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --cygnus'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --cygnus \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --cygnus Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
$(srcdir)/../../../Makefile.shared:
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-noinstLIBRARIES:
|
||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||
lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) $(EXTRA_lib_a_DEPENDENCIES)
|
||||
-rm -f lib.a
|
||||
$(lib_a_AR) lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
|
||||
$(RANLIB) lib.a
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
$(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
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-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`
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
check-am:
|
||||
check: check-am
|
||||
all-am: Makefile $(LIBRARIES) $(DATA)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
|
||||
clean-generic clean-noinstLIBRARIES ctags distclean \
|
||||
distclean-compile distclean-generic distclean-tags dvi dvi-am \
|
||||
html html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am
|
||||
|
||||
objectlist.awk.in: $(noinst_LTLIBRARIES)
|
||||
-rm -f objectlist.awk.in
|
||||
for i in `ls *.lo` ; \
|
||||
do \
|
||||
echo $$i `pwd`/$$i >> objectlist.awk.in ; \
|
||||
done
|
||||
|
||||
.c.def:
|
||||
$(CHEW) < $< > $*.def 2> $*.ref
|
||||
touch stmp-def
|
||||
|
||||
TARGETDOC ?= ../tmp.texi
|
||||
|
||||
doc: $(CHEWOUT_FILES)
|
||||
for chapter in $(CHAPTERS) ; \
|
||||
do \
|
||||
cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \
|
||||
done
|
||||
|
||||
.c.xml:
|
||||
$(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false )
|
||||
@touch stmp-xml
|
||||
|
||||
docbook: $(DOCBOOK_OUT_FILES)
|
||||
for chapter in $(DOCBOOK_CHAPTERS) ; \
|
||||
do \
|
||||
${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \
|
||||
done
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
1012
newlib/libm/machine/riscv/aclocal.m4
vendored
Normal file
1012
newlib/libm/machine/riscv/aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4766
newlib/libm/machine/riscv/configure
vendored
Executable file
4766
newlib/libm/machine/riscv/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
11
newlib/libm/machine/riscv/configure.in
Normal file
11
newlib/libm/machine/riscv/configure.in
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT([newlib],[NEWLIB_VERSION])
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
|
||||
AC_CONFIG_AUX_DIR(../../../..)
|
||||
|
||||
NEWLIB_CONFIGURE(../../..)
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
52
newlib/libm/machine/riscv/fe_dfl_env.c
Normal file
52
newlib/libm/machine/riscv/fe_dfl_env.c
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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 <fenv.h>
|
||||
|
||||
/* This implementation is intended to comply with the following
|
||||
* specification:
|
||||
*
|
||||
* http://pubs.opengroup.org/onlinepubs/009695399
|
||||
*
|
||||
* "The <fenv.h> header shall define the following macro, which
|
||||
* represents the default floating-point environment (that is, the one
|
||||
* installed at program startup) and has type pointer to
|
||||
* const-qualified fenv_t. It can be used as an argument to the
|
||||
* functions within the <fenv.h> header that manage the floating-point
|
||||
* environment.
|
||||
*
|
||||
* FE_DFL_ENV"
|
||||
*/
|
||||
|
||||
const fenv_t fe_dfl_env = { 0 };
|
||||
const fenv_t *fe_dfl_env_p = &fe_dfl_env;
|
81
newlib/libm/machine/riscv/feclearexcept.c
Normal file
81
newlib/libm/machine/riscv/feclearexcept.c
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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 <fenv.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* This implementation is intended to comply with the following
|
||||
* specification:
|
||||
*
|
||||
* http://pubs.opengroup.org/onlinepubs/009695399/functions/feclearexcept.html
|
||||
* Referred to as 'feclearexcept.html below.
|
||||
*
|
||||
* "The feclearexcept() function shall attempt to clear the supported
|
||||
* floating-point exceptions represented by excepts."
|
||||
*/
|
||||
|
||||
int feclearexcept(int excepts)
|
||||
{
|
||||
|
||||
#if __riscv_flen
|
||||
|
||||
/* Mask excepts to be sure only supported flag bits are set */
|
||||
|
||||
excepts &= FE_ALL_EXCEPT;
|
||||
|
||||
/* Per "The RISC-V Instruction Set Manual: Volume I: User-Level ISA:
|
||||
* Version 2.1":
|
||||
*
|
||||
* "The CSRRC (Atomic Read and Clear Bits in CSR) instruction reads
|
||||
* the value of the CSR, zeroextends the value to XLEN bits, and
|
||||
* writes it to integer register rd. The initial value in integer
|
||||
* register rs1 is treated as a bit mask that specifies bit
|
||||
* positions to be cleared in the CSR. Any bit that is high in rs1
|
||||
* will cause the corresponding bit to be cleared in the CSR, if
|
||||
* that CSR bit is writable. Other bits in the CSR are unaffected."
|
||||
*/
|
||||
|
||||
/* Clear the requested flags */
|
||||
|
||||
asm volatile("csrrc zero, fflags, %0" : : "r"(excepts));
|
||||
|
||||
/* Per 'feclearexcept.html
|
||||
* "If the argument is zero or if all the specified exceptions were
|
||||
* successfully cleared, feclearexcept() shall return zero. Otherwise,
|
||||
* it shall return a non-zero value."
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
70
newlib/libm/machine/riscv/fegetenv.c
Normal file
70
newlib/libm/machine/riscv/fegetenv.c
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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 <fenv.h>
|
||||
|
||||
/* This implementation is intended to comply with the following
|
||||
* specification:
|
||||
*
|
||||
* http://pubs.opengroup.org/onlinepubs/009695399/functions/fegetenv.html
|
||||
* Referred to as 'fegetenv.html below.
|
||||
*
|
||||
* "The fegetenv() function shall attempt to store the current
|
||||
* floating-point environment in the object pointed to by envp."
|
||||
*
|
||||
*/
|
||||
|
||||
int fegetenv(fenv_t *envp)
|
||||
{
|
||||
|
||||
#if __riscv_flen
|
||||
|
||||
/* Get the current environment (FCSR) */
|
||||
|
||||
fenv_t fcsr;
|
||||
asm volatile("frcsr %0" : "=r"(fcsr));
|
||||
|
||||
/* Store FCSR in envp */
|
||||
|
||||
*envp = fcsr;
|
||||
|
||||
/* Per 'fegetenv.html:
|
||||
*
|
||||
* "If the representation was successfully stored, fegetenv() shall
|
||||
* return zero. Otherwise, it shall return a non-zero value.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
76
newlib/libm/machine/riscv/fegetexceptflag.c
Normal file
76
newlib/libm/machine/riscv/fegetexceptflag.c
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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 <fenv.h>
|
||||
|
||||
/* This implementation is intended to comply with the following
|
||||
* specification:
|
||||
*
|
||||
* http://pubs.opengroup.org/onlinepubs/009695399/functions/fegetexceptflag.html
|
||||
* Referred to as 'fegetexceptflag.html below.
|
||||
*
|
||||
* "The fegetexceptflag() function shall attempt to store an
|
||||
* implementation-defined representation of the states of the
|
||||
* floating-point status flags indicated by the argument excepts in
|
||||
* the object pointed to by the argument flagp."
|
||||
*/
|
||||
|
||||
int fegetexceptflag(fexcept_t *flagp, int excepts)
|
||||
{
|
||||
|
||||
#if __riscv_flen
|
||||
|
||||
/* Mask excepts to be sure only supported flag bits are set */
|
||||
|
||||
excepts &= FE_ALL_EXCEPT;
|
||||
|
||||
/* Get current exception flags */
|
||||
|
||||
fexcept_t flags;
|
||||
asm volatile("frflags %0" : "=r"(flags));
|
||||
|
||||
/* Return the requested flags in flagp */
|
||||
|
||||
*flagp = flags & excepts;
|
||||
|
||||
/* Per 'fegetexceptflag.html:
|
||||
*
|
||||
* "If the representation was successfully stored, fegetexceptflag()
|
||||
* shall return zero. Otherwise, it shall return a non-zero
|
||||
* value."
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
79
newlib/libm/machine/riscv/fegetround.c
Normal file
79
newlib/libm/machine/riscv/fegetround.c
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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 <fenv.h>
|
||||
|
||||
/* This implementation is intended to comply with the following
|
||||
* specification:
|
||||
*
|
||||
* http://pubs.opengroup.org/onlinepubs/009695399/functions/fegetround.html
|
||||
* Referred to as 'fegetround.html below.
|
||||
*
|
||||
* "The fegetround() function shall get the current rounding direction."
|
||||
*/
|
||||
|
||||
int fegetround()
|
||||
{
|
||||
|
||||
#if __riscv_flen
|
||||
|
||||
/* Get current rounding mode */
|
||||
|
||||
fenv_t frm;
|
||||
asm volatile("frrm %0" : "=r"(frm));
|
||||
|
||||
/* Per 'fegetround.html:
|
||||
*
|
||||
* "The fegetround() function shall return the value of the rounding
|
||||
* direction macro representing the current rounding direction or a
|
||||
* negative value if there is no such rounding direction macro or
|
||||
* the current rounding direction is not determinable."
|
||||
*/
|
||||
|
||||
/* Return the rounding mode */
|
||||
|
||||
return frm;
|
||||
|
||||
#else
|
||||
|
||||
/* For soft float */
|
||||
|
||||
#ifdef FE_TONEAREST
|
||||
return FE_TONEAREST;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
}
|
76
newlib/libm/machine/riscv/feholdexcept.c
Normal file
76
newlib/libm/machine/riscv/feholdexcept.c
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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 <fenv.h>
|
||||
|
||||
/* This implementation is intended to comply with the following
|
||||
* specification:
|
||||
*
|
||||
* http://pubs.opengroup.org/onlinepubs/009695399/functions/feholdexcept.html
|
||||
* Referred to as 'feholdexcept.html below.
|
||||
*
|
||||
* "The feholdexcept() function shall save the current floating-point
|
||||
* environment in the object pointed to by envp, clear the
|
||||
* floating-point status flags, and then install a non-stop (continue
|
||||
* on floating-point exceptions) mode, if available, for all
|
||||
* floating-point exceptions."
|
||||
*/
|
||||
|
||||
int feholdexcept(fenv_t *envp)
|
||||
{
|
||||
|
||||
#if __riscv_flen
|
||||
|
||||
/* Store the current FP environment in envp*/
|
||||
|
||||
fenv_t fcsr;
|
||||
asm volatile("frcsr %0" : "=r"(fcsr));
|
||||
*envp = fcsr;
|
||||
|
||||
/* Clear all flags */
|
||||
|
||||
asm volatile("csrrc zero, fflags, %0" : : "r"(FE_ALL_EXCEPT));
|
||||
|
||||
/* RISC-V does not raise FP traps so it is always in a "non-stop" mode */
|
||||
|
||||
/* Per 'feholdexcept.html:
|
||||
*
|
||||
* "The feholdexcept() function shall return zero if and only if
|
||||
* non-stop floating-point exception handling was successfully
|
||||
* installed."
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
85
newlib/libm/machine/riscv/feraiseexcept.c
Normal file
85
newlib/libm/machine/riscv/feraiseexcept.c
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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 <fenv.h>
|
||||
|
||||
/* This implementation is intended to comply with the following
|
||||
* specification:
|
||||
*
|
||||
* http://pubs.opengroup.org/onlinepubs/009695399/functions/feraiseexcept.html
|
||||
* Referred to as 'feraiseexcept.html below.
|
||||
*
|
||||
* "The feraiseexcept() function shall attempt to raise the supported
|
||||
* floating-point exceptions represented by the excepts argument. The
|
||||
* order in which these floating-point exceptions are raised is
|
||||
* unspecified, except that if the excepts argument represents IEC
|
||||
* 60559 valid coincident floating-point exceptions for atomic
|
||||
* operations (namely overflow and inexact, or underflow and inexact),
|
||||
* then overflow or underflow shall be raised before inexact. Whether
|
||||
* the feraiseexcept() function additionally raises the inexact
|
||||
* floating-point exception whenever it raises the overflow or
|
||||
* underflow floating-point exception is implementation-defined."
|
||||
*/
|
||||
|
||||
int feraiseexcept(int excepts)
|
||||
{
|
||||
|
||||
/* Mask excepts to be sure only supported flag bits are set */
|
||||
|
||||
excepts &= FE_ALL_EXCEPT;
|
||||
|
||||
#if __riscv_flen
|
||||
|
||||
/* Set the requested exception flags */
|
||||
|
||||
asm volatile("csrs fflags, %0" : : "r"(excepts));
|
||||
|
||||
/* Per 'feraiseexcept.html:
|
||||
* "If the argument is zero or if all the specified exceptions were
|
||||
* successfully raised, feraiseexcept() shall return
|
||||
* zero. Otherwise, it shall return a non-zero value."
|
||||
*/
|
||||
|
||||
/* Per "The RISC-V Instruction Set Manual: Volume I: User-Level ISA:
|
||||
* Version 2.1":
|
||||
*
|
||||
* "As allowed by the standard, we do not support traps on
|
||||
* floating-point exceptions in the base ISA, but instead require
|
||||
* explicit checks of the flags in software."
|
||||
*
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
return (excepts != 0);
|
||||
}
|
73
newlib/libm/machine/riscv/fesetenv.c
Normal file
73
newlib/libm/machine/riscv/fesetenv.c
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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 <fenv.h>
|
||||
|
||||
/* This implementation is intended to comply with the following
|
||||
* specification:
|
||||
*
|
||||
* http://pubs.opengroup.org/onlinepubs/009695399/functions/fegetenv.html
|
||||
* Referred to as 'fegetenv.html below.
|
||||
*
|
||||
* "The fegetenv() function shall attempt to store the current
|
||||
* floating-point environment in the object pointed to by envp.
|
||||
*
|
||||
* The fesetenv() function shall attempt to establish the
|
||||
* floating-point environment represented by the object pointed to by
|
||||
* envp. The argument envp shall point to an object set by a call to
|
||||
* fegetenv() or feholdexcept(), or equal a floating-point environment
|
||||
* macro. The fesetenv() function does not raise floating-point
|
||||
* exceptions, but only installs the state of the floating-point
|
||||
* status flags represented through its argument."
|
||||
*/
|
||||
|
||||
int fesetenv(const fenv_t *envp)
|
||||
{
|
||||
|
||||
#if __riscv_flen
|
||||
|
||||
/* Set environment (FCSR) */
|
||||
|
||||
fenv_t fcsr = *envp;
|
||||
asm volatile("fscsr %0" : : "r"(fcsr));
|
||||
|
||||
/* Per 'fegetenv.html:
|
||||
*
|
||||
* "If the environment was successfully established, fesetenv()
|
||||
* shall return zero. Otherwise, it shall return a non-zero value.
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
80
newlib/libm/machine/riscv/fesetexceptflag.c
Normal file
80
newlib/libm/machine/riscv/fesetexceptflag.c
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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 <fenv.h>
|
||||
|
||||
/* This implementation is intended to comply with the following
|
||||
* specification:
|
||||
*
|
||||
* http://pubs.opengroup.org/onlinepubs/009695399/functions/fesetexceptflag.html
|
||||
* Referred to as 'fesetexceptflag.html below.
|
||||
*
|
||||
* "The fesetexceptflag() function shall attempt to set the
|
||||
* floating-point status flags indicated by the argument excepts to
|
||||
* the states stored in the object pointed to by flagp. The value
|
||||
* pointed to by flagp shall have been set by a previous call to
|
||||
* fegetexceptflag() whose second argument represented at least those
|
||||
* floating-point exceptions represented by the argument excepts. This
|
||||
* function does not raise floating-point exceptions, but only sets
|
||||
* the state of the flags."
|
||||
*
|
||||
*/
|
||||
|
||||
int fesetexceptflag(const fexcept_t *flagp, int excepts)
|
||||
{
|
||||
|
||||
#if __riscv_flen
|
||||
|
||||
/* Mask excepts to be sure only supported flag bits are set */
|
||||
|
||||
excepts &= FE_ALL_EXCEPT;
|
||||
|
||||
/* Set the requested flags */
|
||||
|
||||
fexcept_t fflags = (excepts & *flagp);
|
||||
|
||||
/* Set new the flags */
|
||||
|
||||
asm volatile("csrs fflags, %0" : : "r"(fflags));
|
||||
|
||||
/* Per 'fesetexceptflag.html:
|
||||
*
|
||||
* "If the excepts argument is zero or if all the specified
|
||||
* exceptions were successfully set, fesetexceptflag() shall return
|
||||
* zero. Otherwise, it shall return a non-zero value."
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
70
newlib/libm/machine/riscv/fesetround.c
Normal file
70
newlib/libm/machine/riscv/fesetround.c
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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 <fenv.h>
|
||||
|
||||
/* This implementation is intended to comply with the following
|
||||
* specification:
|
||||
*
|
||||
* http://pubs.opengroup.org/onlinepubs/009695399/functions/fesetround.html
|
||||
* Referred to as 'fegetenv.html below.
|
||||
*
|
||||
* "The fesetround() function shall establish the rounding direction
|
||||
* represented by its argument round. If the argument is not equal to
|
||||
* the value of a rounding direction macro, the rounding direction is
|
||||
* not changed."
|
||||
*/
|
||||
|
||||
int fesetround(int round)
|
||||
{
|
||||
|
||||
#if __riscv_flen
|
||||
|
||||
/* Mask round to be sure only valid rounding bits are set */
|
||||
|
||||
round &= FE_RMODE_MASK;
|
||||
|
||||
/* Set the rounding mode */
|
||||
|
||||
asm volatile("fsrm %0" : : "r"(round));
|
||||
|
||||
/* Per 'fesetround.html:
|
||||
*
|
||||
* "The fesetround() function shall return a zero value if and only
|
||||
* if the requested rounding direction was established."
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
77
newlib/libm/machine/riscv/fetestexcept.c
Normal file
77
newlib/libm/machine/riscv/fetestexcept.c
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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 <fenv.h>
|
||||
|
||||
/* This implementation is intended to comply with the following
|
||||
* specification:
|
||||
*
|
||||
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/fetestexcept.html
|
||||
*
|
||||
* "The fetestexcept() function shall determine which of a specified
|
||||
* subset of the floating-point exception flags are currently set. The
|
||||
* excepts argument specifies the floating-point status flags to be
|
||||
* queried."
|
||||
*/
|
||||
|
||||
int fetestexcept(int excepts)
|
||||
{
|
||||
|
||||
#if __riscv_flen
|
||||
|
||||
/* Mask excepts to be sure only supported flag bits are set */
|
||||
|
||||
excepts &= FE_ALL_EXCEPT;
|
||||
|
||||
/* Read the current flags */
|
||||
|
||||
fexcept_t flags;
|
||||
asm volatile("frflags %0" : "=r"(flags));
|
||||
|
||||
/* "The fetestexcept() function shall return the value of the
|
||||
* bitwise-inclusive OR of the floating-point exception macros
|
||||
* corresponding to the currently set floating-point exceptions
|
||||
* included in excepts."
|
||||
*/
|
||||
|
||||
return (flags & excepts);
|
||||
|
||||
#else
|
||||
|
||||
/* For soft float */
|
||||
|
||||
return 0;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
89
newlib/libm/machine/riscv/feupdateenv.c
Normal file
89
newlib/libm/machine/riscv/feupdateenv.c
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
(c) Copyright 2017 Michael R. Neilly
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* 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.
|
||||
|
||||
* Neither the names of the copyright holders nor the names of their
|
||||
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 OWNER 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 <fenv.h>
|
||||
|
||||
/* This implementation is intended to comply with the following
|
||||
* specification:
|
||||
*
|
||||
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/feupdateenv.html
|
||||
*
|
||||
* "The feupdateenv() function shall attempt to save the currently
|
||||
* raised floating-point exceptions in its automatic storage, attempt
|
||||
* to install the floating-point environment represented by the object
|
||||
* pointed to by envp, and then attempt to raise the saved
|
||||
* floating-point exceptions. The argument envp shall point to an
|
||||
* object set by a call to feholdexcept() or fegetenv(), or equal a
|
||||
* floating-point environment macro."
|
||||
*/
|
||||
|
||||
int feupdateenv(const fenv_t *envp)
|
||||
{
|
||||
|
||||
#if __riscv_flen
|
||||
|
||||
/* Get current exception flags */
|
||||
|
||||
fexcept_t flags;
|
||||
asm volatile("frflags %0" : "=r"(flags));
|
||||
|
||||
/* Set the environment as requested */
|
||||
|
||||
fenv_t fcsr = *envp; /* Environment to install */
|
||||
asm volatile("fscsr %0" : : "r"(fcsr)); /* Install environment */
|
||||
|
||||
/* OR in the saved exception flags */
|
||||
|
||||
asm volatile("csrs fflags, %0" : : "r"(flags));
|
||||
|
||||
/* "The feupdateenv() function shall return a zero value if and only
|
||||
* if all the required actions were successfully carried out."
|
||||
*/
|
||||
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
/* For soft float */
|
||||
|
||||
#if defined FE_NOMASK_ENV && FE_ALL_EXCEPT != 0
|
||||
|
||||
if (envp == FE_NOMASK_ENV)
|
||||
return 1;
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
#endif
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user