Compare commits

...

No commits in common. "master" and "master" have entirely different histories.

476 changed files with 602 additions and 49598 deletions

1
.github/FUNDING.yml vendored
View File

@ -1 +0,0 @@
github: [JuliaLang]

13
.gitignore vendored
View File

@ -1,11 +1,2 @@
*.o
*~
*.a
*.dll*
*.so*
*.dylib*
*.pc
# GiteaPC config files
giteapc-config-*.make
giteapc-config.make
_openlibm
commit.txt

View File

@ -1,61 +0,0 @@
JuliaLang <julia-dev@googlegroups.com> <julia-dev@googlegroups.com>
JuliaLang <julia-dev@googlegroups.com> <julia-math@googlegroups.com>
Jeff Bezanson <jeff.bezanson@gmail.com> <jeff.bezanson@gmail.com>
Jeff Bezanson <jeff.bezanson@gmail.com> <bezanson@beagle.darwinproject.mit.edu>
Jeff Bezanson <jeff.bezanson@gmail.com> <bezanson@caspian.caspian.mit.edu>
Jeff Bezanson <jeff.bezanson@gmail.com> <bezanson@evolution.local>
Jeff Bezanson <jeff.bezanson@gmail.com> <bezanson@mathstation045.mit.edu>
Jeff Bezanson <jeff.bezanson@gmail.com> <bezanson@mathstation049.mit.edu>
Jeff Bezanson <jeff.bezanson@gmail.com> <bezanson@mathstation186.mit.edu>
Jeff Bezanson <jeff.bezanson@gmail.com> <bezanson@post.harvard.edu>
Jeff Bezanson <jeff.bezanson@gmail.com> <bezanson@scooby-doo.csail.mit.edu>
Jeff Bezanson <jeff.bezanson@gmail.com> <bezanson@shaggy.csail.mit.edu>
Jeff Bezanson <jeff.bezanson@gmail.com> <jeff@lagann.(none)>
Jeff Bezanson <jeff.bezanson@gmail.com> <julia@beowulf1.csail.mit.edu>
Jeff Bezanson <jeff.bezanson@gmail.com> <vcloud@julia02.domain.local>
Stefan Karpinski <stefan@karpinski.org> <stefan@karpinski.org>
Stefan Karpinski <stefan@karpinski.org> <stefan.karpinski@gmail.com>
Stefan Karpinski <stefan@karpinski.org> <stefan.karpinski@post.harvard.edu>
Viral B. Shah <viral@mayin.org> <viral@mayin.org>
Viral B. Shah <viral@mayin.org> <viral@beowulf1.csail.mit.edu>
Viral B. Shah <viral@mayin.org> <viral@neumann.cs.ucsb.edu>
Viral B. Shah <viral@mayin.org> <viral@ubuntu-VirtualBox.(none)>
George Xing <gxing@mit.edu> <gxing@mit.edu>
George Xing <gxing@mit.edu> <noobiecubie@gmail.com>
Stephan Boyer <boyers@mit.edu> <boyers@mit.edu>
Stephan Boyer <boyers@mit.edu> <stephan@julialang.xvm.mit.edu>
Stephan Boyer <boyers@mit.edu> <stephan@ubuntu.(none)>
Stephan Boyer <boyers@mit.edu> <stephan@ubuntu.ubuntu-domain>
Giuseppe Zingales <giuseppe.pet.zingales@gmail.com> <giuseppe.pet.zingales@gmail.com>
Giuseppe Zingales <giuseppe.pet.zingales@gmail.com> <g3@ubuntu.ubuntu-domain>
Jameson Nash <jameson@mit.edu> <jameson@mit.edu>
Jameson Nash <jameson@mit.edu> <vtjnash@comcast.net>
Jameson Nash <jameson@mit.edu> <vtjnash@gmail.com>
Alan Edelman <mit.edelman@gmail.com> <mit.edelman@gmail.com>
PlayMyCode <joe@playmycode.com> <joe@playmycode.com>
PlayMyCode <joe@playmycode.com> <hello@playmycode.com>
Corey M. Hoffstein <corey@hoffstein.com> <corey@hoffstein.com>
Corey M. Hoffstein <corey@hoffstein.com> <corey@newfoundresearch.com>
Stefan Kroboth <stefan.kroboth@gmail.com> <stefan.kroboth@gmail.com>
Tim Holy <tim.holy@gmail.com> <tim.holy@gmail.com>
Tim Holy <tim.holy@gmail.com> <holy@wustl.edu>
Patrick O'Leary <patrick.oleary@gmail.com> <patrick.oleary@gmail.com>
Ivan Mantova <horphus@gmail.com> <horphus@gmail.com>
Keno Fischer <kfischer@college.harvard.edu> <kfischer@college.harvard.edu>
Keno Fischer <kfischer@college.harvard.edu> <kfischer+github@college.harvard.edu>
Keno Fischer <kfischer@college.harvard.edu> <kenof@stanford.edu>

View File

@ -1,106 +0,0 @@
# We require a full (virtual) machine to load the kernel module for
# binfmt support, which is needed to test other architectures besides
# x86 using qemu user emulation. (This will not work in a container.)
sudo: required
dist: trusty
language: c
script:
- make $FLAGS
- make check $FLAGS $TEST_FLAGS
- make clean && git status --ignored --porcelain && test -z "$(git status --ignored --porcelain)"
matrix:
include:
- compiler: clang
os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- clang-3.7
env: FLAGS="CC=clang-3.7 CXX=clang++-3.7"
- os: osx
env: FLAGS="CC=clang"
- os: linux
env: FLAGS="CC=gcc"
- os: linux
env: FLAGS="CC=gcc ARCH=i686" # implies -m32 -march=i686
addons:
apt:
packages:
- gcc-multilib
- os: linux
env: FLAGS="CC=aarch64-linux-gnu-gcc" TEST_FLAGS="LDFLAGS=-static"
addons:
apt:
packages:
- gcc-aarch64-linux-gnu
- libc6-dev-arm64-cross
- qemu-user-static
- binfmt-support
- os: linux
env: FLAGS="CC=arm-linux-gnueabihf-gcc" TEST_FLAGS="LDFLAGS=-static"
addons:
apt:
packages:
- gcc-arm-linux-gnueabihf
- libc6-dev-armhf-cross
- qemu-user-static
- binfmt-support
# This works, but only if qemu-user-static is >= v2.4. This is not the
# case on the default trusty images, so we add a PPA that has qemu 2.5
- os: linux
env: FLAGS="CC=powerpc64le-linux-gnu-gcc" TEST_FLAGS="LDFLAGS=-static"
addons:
apt:
sources:
- sourceline: "ppa:gns3/qemu"
packages:
- gcc-powerpc64le-linux-gnu
- libc6-dev-ppc64el-cross
- qemu-user-static
- binfmt-support
- os: linux
env: FLAGS="CC=mips-linux-gnu-gcc" TEST_FLAGS="LDFLAGS=-static"
addons:
apt:
sources:
- sourceline: "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
packages:
- gcc-mips-linux-gnu
- libc6-dev-mips-cross
- qemu-user-binfmt
- os: linux
env: FLAGS="CC=mipsel-linux-gnu-gcc" TEST_FLAGS="LDFLAGS=-static"
addons:
apt:
sources:
- sourceline: "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
packages:
- gcc-mipsel-linux-gnu
- libc6-dev-mipsel-cross
- qemu-user-binfmt
- os: linux
env: FLAGS="CC=mips64el-linux-gnuabi64-gcc" TEST_FLAGS="LDFLAGS=-static"
addons:
apt:
sources:
- sourceline: "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
packages:
- gcc-mips64el-linux-gnuabi64
- libc6-dev-mips64el-cross
- qemu-user-binfmt
notifications:
email: false

View File

@ -1,115 +0,0 @@
## OpenLibm
OpenLibm contains code that is covered by various licenses.
The OpenLibm code derives from the FreeBSD msun and OpenBSD libm
implementations, which in turn derives from FDLIBM 5.3. As a result, it
has a number of fixes and updates that have accumulated over the years
in msun, and also optimized assembly versions of many functions. These
improvements are provided under the BSD and ISC licenses. The msun
library also includes work placed under the public domain, which is
noted in the individual files. Further work on making a standalone
OpenLibm library from msun, as part of the Julia project is covered
under the MIT license. The test files, test-double.c and test-float.c
are under the LGPL.
## Parts copyrighted by the Julia project (MIT License)
> Copyright (c) 2011-14 The Julia Project.
> https://github.com/JuliaMath/openlibm/graphs/contributors
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
> "Software"), to deal in the Software without restriction, including
> without limitation the rights to use, copy, modify, merge, publish,
> distribute, sublicense, and/or sell copies of the Software, and to
> permit persons to whom the Software is furnished to do so, subject to
> the following conditions:
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Parts copyrighted by Stephen L. Moshier (ISC License)
> Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
>
> Permission to use, copy, modify, and distribute this software for any
> purpose with or without fee is hereby granted, provided that the above
> copyright notice and this permission notice appear in all copies.
>
> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
## FREEBSD MSUN (FreeBSD/2-clause BSD/Simplified BSD License)
> Copyright 1992-2011 The FreeBSD Project. 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 FREEBSD PROJECT ``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 FREEBSD PROJECT 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.
>
> The views and conclusions contained in the software and documentation
> are those of the authors and should not be interpreted as representing
> official policies, either expressed or implied, of the FreeBSD
> Project.
## FDLIBM
> Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
>
> Developed at SunPro, a Sun Microsystems, Inc. business.
> Permission to use, copy, modify, and distribute this
> software is freely granted, provided that this notice
> is preserved.
## Tests
> Copyright (C) 1997, 1999 Free Software Foundation, Inc.
> This file is part of the GNU C Library.
> Contributed by Andreas Jaeger <aj@suse.de>, 1997.
>
> The GNU C Library is free software; you can redistribute it and/or
> modify it under the terms of the GNU Lesser General Public
> License as published by the Free Software Foundation; either
> version 2.1 of the License, or (at your option) any later version.
>
> The GNU C Library is distributed in the hope that it will be useful,
> but WITHOUT ANY WARRANTY; without even the implied warranty of
> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> Lesser General Public License for more details.
>
> You should have received a copy of the GNU Lesser General Public
> License along with the GNU C Library; if not, write to the Free
> Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
> 02111-1307 USA.

176
Make.inc
View File

@ -1,176 +0,0 @@
# -*- mode: makefile-gmake -*-
# Default build rule for any Makefile in this project: all
default: all
OS := $(shell uname)
# Do not forget to bump SOMINOR when changing VERSION,
# and SOMAJOR when breaking ABI in a backward-incompatible way
VERSION = 0.7.0
SOMAJOR = 3
SOMINOR = 0
DESTDIR =
prefix ?= /usr/local
bindir ?= $(prefix)/bin
libdir ?= $(prefix)/lib
includedir ?= $(prefix)/include
ifeq ($(OS), FreeBSD)
pkgconfigdir ?= $(prefix)/libdata/pkgconfig
else
pkgconfigdir ?= $(libdir)/pkgconfig
endif
USEGCC ?= 1
USECLANG ?= 0
ifneq (,$(findstring $(OS),Darwin FreeBSD OpenBSD))
USEGCC ?= 0
USECLANG ?= 1
endif
ifeq ($(ARCH),wasm32)
USECLANG = 1
TOOLPREFIX = llvm-
endif
AR ?= $(TOOLPREFIX)ar
ifeq ($(USECLANG),1)
USEGCC ?= 0
CC = clang
CFLAGS_add += -fno-builtin -fno-strict-aliasing
endif
ifeq ($(USEGCC),1)
CC ?= $(TOOLPREFIX)gcc
CFLAGS_add += -fno-gnu89-inline -fno-builtin
endif
ARCH ?= $(shell $(CC) -dumpmachine | sed "s/\([^-]*\).*$$/\1/")
ifeq ($(ARCH),mingw32)
$(error "the mingw32 compiler you are using fails the openblas testsuite. please see the Julia README.windows.md document for a replacement")
endif
# OS-specific stuff
ifeq ($(ARCH),arm64)
override ARCH := aarch64
endif
ifeq ($(findstring arm,$(ARCH)),arm)
override ARCH := arm
MARCH ?= armv7-a
CFLAGS_add += -mhard-float
endif
ifeq ($(findstring powerpc,$(ARCH)),powerpc)
override ARCH := powerpc
endif
ifeq ($(findstring ppc,$(ARCH)),ppc)
override ARCH := powerpc
endif
ifeq ($(findstring s390,$(ARCH)),s390)
override ARCH := s390
endif
ifneq ($(filter $(ARCH),i386 i486 i586 i686 i387 i487 i587 i687),)
override ARCH := i387
MARCH ?= i686
endif
ifeq ($(ARCH),x86_64)
override ARCH := amd64
endif
ifeq ($(findstring mips,$(ARCH)),mips)
override ARCH := mips
endif
# If CFLAGS does not contain a -O optimization flag, default to -O3
ifeq ($(findstring -O,$(CFLAGS)),)
CFLAGS_add += -O3
endif
ifneq (,$(findstring MINGW,$(OS)))
override OS=WINNT
endif
#keep these if statements separate
ifeq ($(OS), WINNT)
SHLIB_EXT = dll
SONAME_FLAG = -soname
CFLAGS_add += -nodefaultlibs
shlibdir = $(bindir)
else
ifeq ($(OS), Darwin)
SHLIB_EXT = dylib
SONAME_FLAG = -install_name
else
SHLIB_EXT = so
SONAME_FLAG = -soname
endif
ifneq ($(ARCH),sh3eb)
CFLAGS_add += -fPIC
endif
shlibdir = $(libdir)
endif
# Add `-march` to our CFLAGS if it's defined
ifneq ($(MARCH),)
CFLAGS_arch += -march=$(MARCH)
endif
ifeq ($(ARCH),i387)
CFLAGS_arch += -m32
SFLAGS_arch += -m32
LDFLAGS_arch += -m32
endif
ifeq ($(ARCH),amd64)
CFLAGS_arch += -m64
SFLAGS_arch += -m64
LDFLAGS_arch += -m64
endif
ifeq ($(ARCH),wasm32)
CFLAGS_arch += -ffreestanding -nostdlib -nostdinc --target=wasm32-unknown-unknown
endif
ifeq ($(ARCH),sh3eb)
CFLAGS_arch += -ffreestanding -nostdlib -m3 -mb
endif
# Add our "arch"-related FLAGS in. We separate arch-related flags out so that
# we can conveniently get at them for targets that don't want the rest of
# *FLAGS_add, such as the testing Makefile targets
CFLAGS_add += $(CFLAGS_arch)
SFLAGS_add += $(SFLAGS_arch)
LDFLAGS_add += $(LDFLAGS_arch)
CFLAGS_add += -std=c99 -Wall -I$(OPENLIBM_HOME) -I$(OPENLIBM_HOME)/include -I$(OPENLIBM_HOME)/$(ARCH) -I$(OPENLIBM_HOME)/src -DASSEMBLER -D__BSD_VISIBLE -Wno-implicit-function-declaration
ifneq ($(filter $(ARCH),i387 amd64 powerpc),)
CFLAGS_add += -I$(OPENLIBM_HOME)/ld80
else
ifneq ($(filter $(ARCH),aarch64),)
CFLAGS_add += -I$(OPENLIBM_HOME)/ld128
endif
endif
ifneq ($(filter $(ARCH),i387 amd64),)
# Determines whether `long double` is the same as `double` on this arch.
# linux x86_64, for instance, `long double` is 80 bits wide, whereas on macOS aarch64,
# `long double` is the same as `double`.
LONG_DOUBLE_NOT_DOUBLE := 1
else ifeq ($(ARCH), aarch64)
ifneq ($(OS),Darwin)
LONG_DOUBLE_NOT_DOUBLE := 1
endif
endif
%.c.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add) -c $< -o $@
%.S.o: %.S
$(CC) $(CPPFLAGS) $(SFLAGS) $(SFLAGS_add) $(filter -m% -B% -I% -D%,$(CFLAGS_add)) -c $< -o $@
# Makefile debugging trick:
# call print-VARIABLE to see the runtime value of any variable
print-%:
@echo '$*=$($*)'

123
Makefile
View File

@ -1,123 +0,0 @@
OPENLIBM_HOME=$(abspath .)
include ./Make.inc
SUBDIRS = src $(ARCH) bsdsrc
ifeq ($(LONG_DOUBLE_NOT_DOUBLE),1)
# Add ld80 directory on x86 and x64
ifneq ($(filter $(ARCH),i387 amd64),)
SUBDIRS += ld80
else
ifneq ($(filter $(ARCH),aarch64),)
SUBDIRS += ld128
else
endif
endif
endif
define INC_template
TEST=test
override CUR_SRCS = $(1)_SRCS
include $(1)/Make.files
SRCS += $$(addprefix $(1)/,$$($(1)_SRCS))
endef
DIR=test
$(foreach dir,$(SUBDIRS),$(eval $(call INC_template,$(dir))))
DUPLICATE_NAMES = $(filter $(patsubst %.S,%,$($(ARCH)_SRCS)),$(patsubst %.c,%,$(src_SRCS)))
DUPLICATE_SRCS = $(addsuffix .c,$(DUPLICATE_NAMES))
OBJS = $(patsubst %.f,%.f.o,\
$(patsubst %.S,%.S.o,\
$(patsubst %.c,%.c.o,$(filter-out $(addprefix src/,$(DUPLICATE_SRCS)),$(SRCS)))))
# If we're on windows, don't do versioned shared libraries. Also, generate an import library
# for the DLL. If we're on OSX, put the version number before the .dylib. Otherwise,
# put it after.
ifeq ($(OS), WINNT)
OLM_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT)
LDFLAGS_add += -Wl,--out-implib,libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT).a
else
ifeq ($(OS), Darwin)
OLM_MAJOR_MINOR_SHLIB_EXT := $(SOMAJOR).$(SOMINOR).$(SHLIB_EXT)
OLM_MAJOR_SHLIB_EXT := $(SOMAJOR).$(SHLIB_EXT)
else
OLM_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR).$(SOMINOR)
OLM_MAJOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR)
endif
endif
.PHONY: all check test clean distclean \
install install-static install-shared install-pkgconfig install-headers
OLM_LIBS := libopenlibm.a
ifeq ($(filter wasm32 sh3eb,$(ARCH)),)
OLM_LIBS += libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
endif
all : $(OLM_LIBS)
check test: test/test-double test/test-float
test/test-double
test/test-float
libopenlibm.a: $(OBJS)
$(AR) -rcs libopenlibm.a $(OBJS)
libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT): $(OBJS)
$(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -Wl,$(SONAME_FLAG),libopenlibm.$(OLM_MAJOR_SHLIB_EXT) -o $@
ifneq ($(OS),WINNT)
ln -sf $@ libopenlibm.$(OLM_MAJOR_SHLIB_EXT)
ln -sf $@ libopenlibm.$(SHLIB_EXT)
endif
test/test-double: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
$(MAKE) -C test test-double
test/test-float: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
$(MAKE) -C test test-float
clean:
rm -f aarch64/*.o amd64/*.o arm/*.o bsdsrc/*.o i387/*.o ld80/*.o ld128/*.o src/*.o powerpc/*.o mips/*.o s390/*.o sh3eb/*.o
rm -f libopenlibm.a libopenlibm.*$(SHLIB_EXT)*
$(MAKE) -C test clean
openlibm.pc: openlibm.pc.in Make.inc Makefile
echo "prefix=${prefix}" > openlibm.pc
echo "version=${VERSION}" >> openlibm.pc
cat openlibm.pc.in >> openlibm.pc
install-static: libopenlibm.a
mkdir -p $(DESTDIR)$(libdir)
cp -RpP -f libopenlibm.a $(DESTDIR)$(libdir)/
install-static-superh: install-static
ln -sf libopenlibm.a $(DESTDIR)$(libdir)/libm.a
install-shared: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
mkdir -p $(DESTDIR)$(shlibdir)
cp -RpP -f libopenlibm.*$(SHLIB_EXT)* $(DESTDIR)$(shlibdir)/
install-pkgconfig: openlibm.pc
mkdir -p $(DESTDIR)$(pkgconfigdir)
cp -RpP -f openlibm.pc $(DESTDIR)$(pkgconfigdir)/
install-headers:
mkdir -p $(DESTDIR)$(includedir)/openlibm
cp -RpP -f include/*.h $(DESTDIR)$(includedir)/openlibm
cp -RpP -f src/*.h $(DESTDIR)$(includedir)/openlibm
install-headers-superh:
mkdir -p $(DESTDIR)$(includedir)
cp -RpP -f \
include/openlibm.h \
include/openlibm_complex.h \
include/openlibm_defs.h \
include/openlibm_fenv.h \
include/openlibm_fenv_sh3eb.h \
include/openlibm_math.h \
$(DESTDIR)$(includedir)
install: install-static install-shared install-pkgconfig

View File

@ -1,38 +0,0 @@
# OpenLibm
[![Travis](https://travis-ci.org/JuliaMath/openlibm.svg?branch=master)](https://travis-ci.org/JuliaMath/openlibm)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/sia04r4089rr19uc/branch/master?svg=true)](https://ci.appveyor.com/project/ararslan/openlibm-19152/branch/master)
[OpenLibm](https://openlibm.org/) is an effort to have a high quality, portable, standalone
C mathematical library ([`libm`](http://en.wikipedia.org/wiki/libm)).
It can be used standalone in applications and programming language
implementations.
The project was born out of a need to have a good `libm` for the
[Julia programming language](http://www.julialang.org) that worked
consistently across compilers and operating systems, and in 32-bit and
64-bit environments.
## Platform support
OpenLibm builds on Linux, macOS, Windows, FreeBSD, OpenBSD, NetBSD, and
DragonFly BSD. It builds with both GCC and clang. Although largely
tested and widely used on the x86 and x86-64 architectures, OpenLibm
also supports arm, aarch64, ppc64le, mips, wasm32, and s390(x).
## Build instructions
1. Use GNU Make to build OpenLibm. This is `make` on most systems, but `gmake` on BSDs.
2. Use `make USEGCC=1` to build with GCC. This is the default on
Linux and Windows.
3. Use `make USECLANG=1` to build with clang. This is the default on OS X, FreeBSD,
and OpenBSD.
4. Use `make ARCH=wasm32` to build the wasm32 library with clang. Requires clang-8.
5. Architectures are auto-detected. Use `make ARCH=i386` to force a
build for i386. Other supported architectures are i486, i586, and
i686. GCC 4.8 is the minimum requirement for correct codegen on
older 32-bit architectures.
## Acknowledgements
PowerPC support for openlibm was graciously sponsored by IBM.

View File

@ -1,60 +1,30 @@
# Soft-FP sh3eb port of OpenLibm
# vxOpenLibM - v1.0.0
This is a fork of [OpenLibm](https://github.com/JuliaMath/openlibm) with support for the sh3eb architecture, intended for add-in programming on SuperH CASIO calculators.
This is a wrapper around the `OpenLibm` with the support of the `sh3eb`
architecture (written by [Lephenixnoir](https://silent-tower.net/projects/)),
intended for the Vhex kernel project.
## Installing with GiteaPC
This project will directly patch the current `openlibm` source files and use a
custom build system based on CMake instead of the "Makefile mess" used in the
original project to handle properly the install/uninstall process.
This library can be installed automatically as part of the fxSDK with [GiteaPC](https://gitea.planet-casio.com/Lephenixnoir/GiteaPC):
## Installing
```bash
% giteapc install Lephenixnoir/OpenLibm
```
## Building manually
You will need a GCC toolchain built with `--target=sh3eb-elf`, such as the [`sh-elf-gcc`](https://gitea.planet-casio.com/Lephenixnoir/sh-elf-gcc) commonly used on Planète Casio.
You can install directly in the internal folder of your compiler, or somewhere else if you have a more detailed setup.
```bash
# Example 1: Use the compiler's internal folder
% COMPILER_DIR="$(sh-elf-gcc --print-file-name=.)"
% LIBDIR="$COMPILER_DIR"
% INCDIR="$COMPILER_DIR/include"
# Example 2: Using the fxSDK's custom setup
% LIBDIR="$(fxsdk path lib)"
% INCDIR="$(fxsdk path include)"
```
You can then build and install the static library and the headers.
```bash
% make USEGCC=1 TOOLPREFIX=sh-elf- AR=sh-elf-ar CC=sh-elf-gcc \
libdir="$LIBDIR" includedir="$INCDIR" \
install-static-superh install-headers-superh
```
The `-superh` targets differ from the the normal targets in the following ways:
* `install-static-superh` also creates a symlink `libm.a -> libopenlibm.a`.
* `install-headers-superh` installs directly in `$LIBDIR` instead of `$LIBDIR/openlibm` since OpenLibm headers reference each other without that prefix and enforcing the correct `-I` in every project is quite painful. In addition, it skips internal and non-SuperH headers.
## Using the library
Include the headers `<openlibm_complex.h>`, `<openlibm_fenv.h>` and `<openlibm_math.h>`. Or, if you are using a suitable libc like [fxlibc](https://gitea.planet-casio.com/Vhex-Kernel-Core/fxlibc/), include directly the standard headers `<complex.h>`, `<fenv.h>` and `<math.h>`.
Link with `-lm`. In a Makefile, update your `LDFLAGS`:
```
LDFLAGS += -lm
```
In CMake, use [`target_link_libraries()`](https://cmake.org/cmake/help/latest/command/target_link_libraries.html):
```cmake
target_link_libraries(<TARGET> PUBLIC -lm)
```
You can use the `scripts/install.sh --help` to see manual installation of the
project. But, since the compiler needed to build the `vxOpenLibm` is
`sh-elf-vhex` which automatically installs this project, you theoretically do
not need to do so.
## README and Licensing
See the original README file in [README-OpenLibm.md](README-OpenLibm.md). OpenLibm contains code covered by various licenses, see [LICENSE.md](LICENSE.md).
See the original
[REAME file](https://github.com/JuliaMath/openlibm/blob/master/README.md) of
the openlibm project for further information.
Note that Openlibm contains code covered by various licenses, see
[LICENSE.md](https://github.com/JuliaMath/openlibm/blob/master/LICENSE.md)
## Special thanks
A big thanks to
[Lephenixnoir](https://silent-tower.net/projects/) who ported the `sh3eb`
support to `openlibm`!

View File

@ -1,51 +0,0 @@
/*-
* Copyright (c) 2004 David Schultz <das@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: src/lib/msun/arm/fenv.c,v 1.3 2011/10/16 05:37:56 das Exp $
*/
#include <openlibm_fenv.h>
#ifdef __GNUC_GNU_INLINE__
#error "This file must be compiled with C99 'inline' semantics"
#endif
/*
* Hopefully the system ID byte is immutable, so it's valid to use
* this as a default environment.
*/
const fenv_t __fe_dfl_env = 0;
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);

View File

@ -1,6 +0,0 @@
$(CUR_SRCS) = fenv.c e_remainder.S e_remainderf.S e_remainderl.S \
e_sqrt.S e_sqrtf.S e_sqrtl.S \
s_llrint.S s_llrintf.S s_llrintl.S \
s_logbl.S s_lrint.S s_lrintf.S s_lrintl.S \
s_remquo.S s_remquof.S s_remquol.S \
s_rintl.S s_scalbn.S s_scalbnf.S s_scalbnl.S

View File

@ -1,110 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* 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.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90
* $FreeBSD: src/sys/amd64/include/asm.h,v 1.18 2007/08/22 04:26:07 jkoshy Exp $
*/
#ifndef _BSD_ASM_H_
#define _BSD_ASM_H_
#ifdef __APPLE__
#include "../i387/osx_asm.h"
#define CNAME(x) EXT(x)
#else
#include "bsd_cdefs.h"
#ifdef PIC
#define PIC_PLT(x) x@PLT
#define PIC_GOT(x) x@GOTPCREL(%rip)
#else
#define PIC_PLT(x) x
#define PIC_GOT(x) x
#endif
/*
* CNAME and HIDENAME manage the relationship between symbol names in C
* and the equivalent assembly language names. CNAME is given a name as
* it would be used in a C program. It expands to the equivalent assembly
* language name. HIDENAME is given an assembly-language name, and expands
* to a possibly-modified form that will be invisible to C programs.
*/
#define CNAME(csym) csym
#define HIDENAME(asmsym) .asmsym
#define _START_ENTRY .p2align 4,0x90
#if defined(__ELF__)
#define _ENTRY(x) .text; _START_ENTRY; \
.globl CNAME(x); .type CNAME(x),@function; CNAME(x):
#define END(x) .size x, . - x
#elif defined(_WIN32)
#ifndef _MSC_VER
#define END(x) .end
#define _START_ENTRY_WIN .text; _START_ENTRY
#else
#define END(x) end
#define _START_ENTRY_WIN .code; _START_ENTRY
#endif
#define _ENTRY(x) _START_ENTRY_WIN; \
.globl CNAME(x); .section .drectve; .ascii " -export:", #x; \
.section .text; .def CNAME(x); .scl 2; .type 32; .endef; CNAME(x):
#endif
#ifdef PROF
#define ALTENTRY(x) _ENTRY(x); \
pushq %rbp; movq %rsp,%rbp; \
call PIC_PLT(HIDENAME(mcount)); \
popq %rbp; \
jmp 9f
#define ENTRY(x) _ENTRY(x); \
pushq %rbp; movq %rsp,%rbp; \
call PIC_PLT(HIDENAME(mcount)); \
popq %rbp; \
9:
#else
#define ALTENTRY(x) _ENTRY(x)
#define ENTRY(x) _ENTRY(x)
#endif
#define RCSID(x) .text; .asciz x
#undef __FBSDID
#if !defined(lint) && !defined(STRIP_FBSDID)
#define __FBSDID(s) .ident s
#else
#define __FBSDID(s) /* nothing */
#endif /* not lint and not STRIP_FBSDID */
#endif
#endif /* !_BSD_ASM_H_ */

View File

@ -1,218 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* 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.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* from: @(#)npx.h 5.3 (Berkeley) 1/18/91
* $FreeBSD: src/sys/x86/include/fpu.h,v 1.1 2012/03/16 20:24:30 tijl Exp $
*/
/*
* Floating Point Data Structures and Constants
* W. Jolitz 1/90
*/
#ifndef _BSD_FPU_H_
#define _BSD_FPU_H_
#include "types-compat.h"
/* Environment information of floating point unit. */
struct env87 {
int32_t en_cw; /* control word (16bits) */
int32_t en_sw; /* status word (16bits) */
int32_t en_tw; /* tag word (16bits) */
int32_t en_fip; /* fp instruction pointer */
uint16_t en_fcs; /* fp code segment selector */
uint16_t en_opcode; /* opcode last executed (11 bits) */
int32_t en_foo; /* fp operand offset */
int32_t en_fos; /* fp operand segment selector */
};
/* Contents of each x87 floating point accumulator. */
struct fpacc87 {
uint8_t fp_bytes[10];
};
/* Floating point context. (i386 fnsave/frstor) */
struct save87 {
struct env87 sv_env; /* floating point control/status */
struct fpacc87 sv_ac[8]; /* accumulator contents, 0-7 */
uint8_t sv_pad0[4]; /* saved status word (now unused) */
/*
* Bogus padding for emulators. Emulators should use their own
* struct and arrange to store into this struct (ending here)
* before it is inspected for ptracing or for core dumps. Some
* emulators overwrite the whole struct. We have no good way of
* knowing how much padding to leave. Leave just enough for the
* GPL emulator's i387_union (176 bytes total).
*/
uint8_t sv_pad[64]; /* padding; used by emulators */
};
/* Contents of each SSE extended accumulator. */
struct xmmacc {
uint8_t xmm_bytes[16];
};
/* Contents of the upper 16 bytes of each AVX extended accumulator. */
struct ymmacc {
uint8_t ymm_bytes[16];
};
/* Rename structs below depending on machine architecture. */
#ifdef __i386__
#define __envxmm32 envxmm
#else
#define __envxmm32 envxmm32
#define __envxmm64 envxmm
#endif
struct __envxmm32 {
uint16_t en_cw; /* control word (16bits) */
uint16_t en_sw; /* status word (16bits) */
uint16_t en_tw; /* tag word (16bits) */
uint16_t en_opcode; /* opcode last executed (11 bits) */
uint32_t en_fip; /* fp instruction pointer */
uint16_t en_fcs; /* fp code segment selector */
uint16_t en_pad0; /* padding */
uint32_t en_foo; /* fp operand offset */
uint16_t en_fos; /* fp operand segment selector */
uint16_t en_pad1; /* padding */
uint32_t en_mxcsr; /* SSE control/status register */
uint32_t en_mxcsr_mask; /* valid bits in mxcsr */
};
struct __envxmm64 {
uint16_t en_cw; /* control word (16bits) */
uint16_t en_sw; /* status word (16bits) */
uint8_t en_tw; /* tag word (8bits) */
uint8_t en_zero;
uint16_t en_opcode; /* opcode last executed (11 bits ) */
uint64_t en_rip; /* fp instruction pointer */
uint64_t en_rdp; /* fp operand pointer */
uint32_t en_mxcsr; /* SSE control/status register */
uint32_t en_mxcsr_mask; /* valid bits in mxcsr */
};
/* Floating point context. (i386 fxsave/fxrstor) */
struct savexmm {
struct __envxmm32 sv_env;
struct {
struct fpacc87 fp_acc;
uint8_t fp_pad[6]; /* padding */
} sv_fp[8];
struct xmmacc sv_xmm[8];
uint8_t sv_pad[224];
} __attribute__ ((aligned(16)));
#ifdef __i386__
union savefpu {
struct save87 sv_87;
struct savexmm sv_xmm;
};
#else
/* Floating point context. (amd64 fxsave/fxrstor) */
struct savefpu {
struct __envxmm64 sv_env;
struct {
struct fpacc87 fp_acc;
uint8_t fp_pad[6]; /* padding */
} sv_fp[8];
struct xmmacc sv_xmm[16];
uint8_t sv_pad[96];
} __attribute__ ((aligned(16)));
#endif
struct xstate_hdr {
uint64_t xstate_bv;
uint8_t xstate_rsrv0[16];
uint8_t xstate_rsrv[40];
};
struct savexmm_xstate {
struct xstate_hdr sx_hd;
struct ymmacc sx_ymm[16];
};
struct savexmm_ymm {
struct __envxmm32 sv_env;
struct {
struct fpacc87 fp_acc;
int8_t fp_pad[6]; /* padding */
} sv_fp[8];
struct xmmacc sv_xmm[16];
uint8_t sv_pad[96];
struct savexmm_xstate sv_xstate;
} __attribute__ ((aligned(16)));
struct savefpu_xstate {
struct xstate_hdr sx_hd;
struct ymmacc sx_ymm[16];
};
struct savefpu_ymm {
struct __envxmm64 sv_env;
struct {
struct fpacc87 fp_acc;
int8_t fp_pad[6]; /* padding */
} sv_fp[8];
struct xmmacc sv_xmm[16];
uint8_t sv_pad[96];
struct savefpu_xstate sv_xstate;
} __attribute__ ((aligned(64)));
#undef __envxmm32
#undef __envxmm64
/*
* The hardware default control word for i387's and later coprocessors is
* 0x37F, giving:
*
* round to nearest
* 64-bit precision
* all exceptions masked.
*
* FreeBSD/i386 uses 53 bit precision for things like fadd/fsub/fsqrt etc
* because of the difference between memory and fpu register stack arguments.
* If its using an intermediate fpu register, it has 80/64 bits to work
* with. If it uses memory, it has 64/53 bits to work with. However,
* gcc is aware of this and goes to a fair bit of trouble to make the
* best use of it.
*
* This is mostly academic for AMD64, because the ABI prefers the use
* SSE2 based math. For FreeBSD/amd64, we go with the default settings.
*/
#define __INITIAL_FPUCW__ 0x037F
#define __INITIAL_FPUCW_I386__ 0x127F
#define __INITIAL_NPXCW__ __INITIAL_FPUCW_I386__
#define __INITIAL_MXCSR__ 0x1F80
#define __INITIAL_MXCSR_MASK__ 0xFFBF
#endif /* !_BSD_FPU_H_ */

View File

@ -1,272 +0,0 @@
/*-
* Copyright (c) 2003 Peter Wemm.
* Copyright (c) 1990 Andrew Moore, Talke Studio
* 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* from: @(#) ieeefp.h 1.0 (Berkeley) 9/23/93
* $FreeBSD: src/sys/amd64/include/ieeefp.h,v 1.14 2005/04/12 23:12:00 jhb Exp $
*/
/*
* IEEE floating point type and constant definitions.
*/
#ifndef _BSD_IEEEFP_H_
#define _BSD_IEEEFP_H_
/*
* FP rounding modes
*/
typedef enum {
FP_RN=0, /* round to nearest */
FP_RM, /* round down to minus infinity */
FP_RP, /* round up to plus infinity */
FP_RZ /* truncate */
} fp_rnd_t;
/*
* FP precision modes
*/
typedef enum {
FP_PS=0, /* 24 bit (single-precision) */
FP_PRS, /* reserved */
FP_PD, /* 53 bit (double-precision) */
FP_PE /* 64 bit (extended-precision) */
} fp_prec_t;
#define fp_except_t int
/*
* FP exception masks
*/
#define FP_X_INV 0x01 /* invalid operation */
#define FP_X_DNML 0x02 /* denormal */
#define FP_X_DZ 0x04 /* zero divide */
#define FP_X_OFL 0x08 /* overflow */
#define FP_X_UFL 0x10 /* underflow */
#define FP_X_IMP 0x20 /* (im)precision */
#define FP_X_STK 0x40 /* stack fault */
/*
* FP registers
*/
#define FP_MSKS_REG 0 /* exception masks */
#define FP_PRC_REG 0 /* precision */
#define FP_RND_REG 0 /* direction */
#define FP_STKY_REG 1 /* sticky flags */
/*
* FP register bit field masks
*/
#define FP_MSKS_FLD 0x3f /* exception masks field */
#define FP_PRC_FLD 0x300 /* precision control field */
#define FP_RND_FLD 0xc00 /* round control field */
#define FP_STKY_FLD 0x3f /* sticky flags field */
/*
* SSE mxcsr register bit field masks
*/
#define SSE_STKY_FLD 0x3f /* exception flags */
#define SSE_DAZ_FLD 0x40 /* Denormals are zero */
#define SSE_MSKS_FLD 0x1f80 /* exception masks field */
#define SSE_RND_FLD 0x6000 /* rounding control */
#define SSE_FZ_FLD 0x8000 /* flush to zero on underflow */
/*
* FP register bit field offsets
*/
#define FP_MSKS_OFF 0 /* exception masks offset */
#define FP_PRC_OFF 8 /* precision control offset */
#define FP_RND_OFF 10 /* round control offset */
#define FP_STKY_OFF 0 /* sticky flags offset */
/*
* SSE mxcsr register bit field offsets
*/
#define SSE_STKY_OFF 0 /* exception flags offset */
#define SSE_DAZ_OFF 6 /* DAZ exception mask offset */
#define SSE_MSKS_OFF 7 /* other exception masks offset */
#define SSE_RND_OFF 13 /* rounding control offset */
#define SSE_FZ_OFF 15 /* flush to zero offset */
#if (defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE__)) || defined(_WIN32) \
&& !defined(__cplusplus)
#define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr)))
#define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr)))
#define __fldcw(addr) __asm __volatile("fldcw %0" : : "m" (*(addr)))
#define __fnstcw(addr) __asm __volatile("fnstcw %0" : "=m" (*(addr)))
#define __fnstsw(addr) __asm __volatile("fnstsw %0" : "=m" (*(addr)))
#define __ldmxcsr(addr) __asm __volatile("ldmxcsr %0" : : "m" (*(addr)))
#define __stmxcsr(addr) __asm __volatile("stmxcsr %0" : "=m" (*(addr)))
/*
* General notes about conflicting SSE vs FP status bits.
* This code assumes that software will not fiddle with the control
* bits of the SSE and x87 in such a way to get them out of sync and
* still expect this to work. Break this at your peril.
* Because I based this on the i386 port, the x87 state is used for
* the fpget*() functions, and is shadowed into the SSE state for
* the fpset*() functions. For dual source fpget*() functions, I
* merge the two together. I think.
*/
/* Set rounding control */
static __inline__ fp_rnd_t
__fpgetround(void)
{
unsigned short _cw;
__fnstcw(&_cw);
return ((_cw & FP_RND_FLD) >> FP_RND_OFF);
}
static __inline__ fp_rnd_t
__fpsetround(fp_rnd_t _m)
{
unsigned short _cw;
unsigned int _mxcsr;
fp_rnd_t _p;
__fnstcw(&_cw);
_p = (_cw & FP_RND_FLD) >> FP_RND_OFF;
_cw &= ~FP_RND_FLD;
_cw |= (_m << FP_RND_OFF) & FP_RND_FLD;
__fldcw(&_cw);
__stmxcsr(&_mxcsr);
_mxcsr &= ~SSE_RND_FLD;
_mxcsr |= (_m << SSE_RND_OFF) & SSE_RND_FLD;
__ldmxcsr(&_mxcsr);
return (_p);
}
/*
* Set precision for fadd/fsub/fsqrt etc x87 instructions
* There is no equivalent SSE mode or control.
*/
static __inline__ fp_prec_t
__fpgetprec(void)
{
unsigned short _cw;
__fnstcw(&_cw);
return ((_cw & FP_PRC_FLD) >> FP_PRC_OFF);
}
static __inline__ fp_prec_t
__fpsetprec(fp_rnd_t _m)
{
unsigned short _cw;
fp_prec_t _p;
__fnstcw(&_cw);
_p = (_cw & FP_PRC_FLD) >> FP_PRC_OFF;
_cw &= ~FP_PRC_FLD;
_cw |= (_m << FP_PRC_OFF) & FP_PRC_FLD;
__fldcw(&_cw);
return (_p);
}
/*
* Look at the exception masks
* Note that x87 masks are inverse of the fp*() functions
* API. ie: mask = 1 means disable for x87 and SSE, but
* for the fp*() api, mask = 1 means enabled.
*/
static __inline__ fp_except_t
__fpgetmask(void)
{
unsigned short _cw;
__fnstcw(&_cw);
return ((~_cw) & FP_MSKS_FLD);
}
static __inline__ fp_except_t
__fpsetmask(fp_except_t _m)
{
unsigned short _cw;
unsigned int _mxcsr;
fp_except_t _p;
__fnstcw(&_cw);
_p = (~_cw) & FP_MSKS_FLD;
_cw &= ~FP_MSKS_FLD;
_cw |= (~_m) & FP_MSKS_FLD;
__fldcw(&_cw);
__stmxcsr(&_mxcsr);
/* XXX should we clear non-ieee SSE_DAZ_FLD and SSE_FZ_FLD ? */
_mxcsr &= ~SSE_MSKS_FLD;
_mxcsr |= ((~_m) << SSE_MSKS_OFF) & SSE_MSKS_FLD;
__ldmxcsr(&_mxcsr);
return (_p);
}
/* See which sticky exceptions are pending, and reset them */
static __inline__ fp_except_t
__fpgetsticky(void)
{
unsigned short _sw;
unsigned int _mxcsr;
fp_except_t _ex;
__fnstsw(&_sw);
_ex = _sw & FP_STKY_FLD;
__stmxcsr(&_mxcsr);
_ex |= _mxcsr & SSE_STKY_FLD;
return (_ex);
}
#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE__ && !__cplusplus */
#if !defined(__IEEEFP_NOINLINES__) && !defined(__cplusplus) \
&& defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE__)
#define fpgetround() __fpgetround()
#define fpsetround(_m) __fpsetround(_m)
#define fpgetprec() __fpgetprec()
#define fpsetprec(_m) __fpsetprec(_m)
#define fpgetmask() __fpgetmask()
#define fpsetmask(_m) __fpsetmask(_m)
#define fpgetsticky() __fpgetsticky()
/* Suppress prototypes in the MI header. */
#define _IEEEFP_INLINED_ 1
#else /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUCLIKE_ASM
&& __CC_SUPPORTS___INLINE__ */
/* Augment the userland declarations */
__BEGIN_DECLS
extern fp_prec_t fpgetprec(void);
extern fp_prec_t fpsetprec(fp_prec_t);
__END_DECLS
#endif /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUCLIKE_ASM
&& __CC_SUPPORTS___INLINE__ */
#endif /* !_BSD_IEEEFP_H_ */

View File

@ -1,30 +0,0 @@
/*
* Based on the i387 version written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <amd64/bsd_asm.h>
//RCSID("from: FreeBSD: src/lib/msun/i387/e_remainder.S,v 1.8 2005/02/04 14:08:32 das Exp")
//__FBSDID("$FreeBSD: src/lib/msun/amd64/e_remainder.S,v 1.2 2011/01/07 16:13:12 kib Exp $")
ENTRY(remainder)
movsd %xmm0,-8(%rsp)
movsd %xmm1,-16(%rsp)
fldl -16(%rsp)
fldl -8(%rsp)
1: fprem1
fstsw %ax
testw $0x400,%ax
jne 1b
fstpl -8(%rsp)
movsd -8(%rsp),%xmm0
fstp %st
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,29 +0,0 @@
/*
* Based on the i387 version written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <amd64/bsd_asm.h>
//RCSID("from: $NetBSD: e_remainderf.S,v 1.2 1995/05/08 23:49:47 jtc Exp $")
//__FBSDID("$FreeBSD: src/lib/msun/amd64/e_remainderf.S,v 1.2 2011/01/07 16:13:12 kib Exp $")
ENTRY(remainderf)
movss %xmm0,-4(%rsp)
movss %xmm1,-8(%rsp)
flds -8(%rsp)
flds -4(%rsp)
1: fprem1
fstsw %ax
testw $0x400,%ax
jne 1b
fstps -4(%rsp)
movss -4(%rsp),%xmm0
fstp %st
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,35 +0,0 @@
/*
* Based on the i387 version written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/e_remainderl.S,v 1.2 2011/01/07 16:13:12 kib Exp $")
ENTRY(remainderl)
#ifndef _WIN64
fldt 24(%rsp)
fldt 8(%rsp)
#else
fldt (%r8)
fldt (%rdx)
#endif
1: fprem1
fstsw %ax
testw $0x400,%ax
jne 1b
fstp %st(1)
#ifdef _WIN64
mov %rcx,%rax
movq $0x0,0x8(%rcx)
fstpt (%rcx)
#endif
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,40 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/e_sqrt.S,v 1.4 2011/01/07 16:13:12 kib Exp $")
ENTRY(sqrt)
sqrtsd %xmm0, %xmm0
ret
END(sqrt)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,39 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/e_sqrtf.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
ENTRY(sqrtf)
sqrtss %xmm0, %xmm0
ret
END(sqrtf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,46 +0,0 @@
/*-
* Copyright (c) 2008 David Schultz <das@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.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/e_sqrtl.S,v 1.2 2011/01/07 16:13:12 kib Exp $")
ENTRY(sqrtl)
#ifndef _WIN64
fldt 8(%rsp)
fsqrt
#else
fldt (%rdx)
fsqrt
mov %rcx,%rax
movq $0x0,0x8(%rcx)
fstpt (%rcx)
#endif
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,162 +0,0 @@
/*-
* Copyright (c) 2004-2005 David Schultz <das@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: src/lib/msun/amd64/fenv.c,v 1.8 2011/10/21 06:25:31 das Exp $
*/
#include "bsd_fpu.h"
#include "math_private.h"
#ifdef _WIN32
#define __fenv_static OLM_DLLEXPORT
#endif
#include <openlibm_fenv.h>
#ifdef __GNUC_GNU_INLINE__
#error "This file must be compiled with C99 'inline' semantics"
#endif
const fenv_t __fe_dfl_env = {
{ 0xffff0000 | __INITIAL_FPUCW__,
0xffff0000,
0xffffffff,
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }
},
__INITIAL_MXCSR__
};
extern inline OLM_DLLEXPORT int feclearexcept(int __excepts);
extern inline OLM_DLLEXPORT int fegetexceptflag(fexcept_t *__flagp, int __excepts);
OLM_DLLEXPORT int
fesetexceptflag(const fexcept_t *flagp, int excepts)
{
fenv_t env;
__fnstenv(&env.__x87);
env.__x87.__status &= ~excepts;
env.__x87.__status |= *flagp & excepts;
__fldenv(env.__x87);
__stmxcsr(&env.__mxcsr);
env.__mxcsr &= ~excepts;
env.__mxcsr |= *flagp & excepts;
__ldmxcsr(env.__mxcsr);
return (0);
}
OLM_DLLEXPORT int
feraiseexcept(int excepts)
{
fexcept_t ex = excepts;
fesetexceptflag(&ex, excepts);
__fwait();
return (0);
}
extern inline OLM_DLLEXPORT int fetestexcept(int __excepts);
extern inline OLM_DLLEXPORT int fegetround(void);
extern inline OLM_DLLEXPORT int fesetround(int __round);
OLM_DLLEXPORT int
fegetenv(fenv_t *envp)
{
__fnstenv(&envp->__x87);
__stmxcsr(&envp->__mxcsr);
/*
* fnstenv masks all exceptions, so we need to restore the
* control word to avoid this side effect.
*/
__fldcw(envp->__x87.__control);
return (0);
}
OLM_DLLEXPORT int
feholdexcept(fenv_t *envp)
{
uint32_t mxcsr;
__stmxcsr(&mxcsr);
__fnstenv(&envp->__x87);
__fnclex();
envp->__mxcsr = mxcsr;
mxcsr &= ~FE_ALL_EXCEPT;
mxcsr |= FE_ALL_EXCEPT << _SSE_EMASK_SHIFT;
__ldmxcsr(mxcsr);
return (0);
}
extern inline OLM_DLLEXPORT int fesetenv(const fenv_t *__envp);
OLM_DLLEXPORT int
feupdateenv(const fenv_t *envp)
{
uint32_t mxcsr;
uint16_t status;
__fnstsw(&status);
__stmxcsr(&mxcsr);
fesetenv(envp);
feraiseexcept((mxcsr | status) & FE_ALL_EXCEPT);
return (0);
}
int
feenableexcept(int mask)
{
uint32_t mxcsr, omask;
uint16_t control;
mask &= FE_ALL_EXCEPT;
__fnstcw(&control);
__stmxcsr(&mxcsr);
omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
control &= ~mask;
__fldcw(control);
mxcsr &= ~(mask << _SSE_EMASK_SHIFT);
__ldmxcsr(mxcsr);
return (omask);
}
int
fedisableexcept(int mask)
{
uint32_t mxcsr, omask;
uint16_t control;
mask &= FE_ALL_EXCEPT;
__fnstcw(&control);
__stmxcsr(&mxcsr);
omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
control |= mask;
__fldcw(control);
mxcsr |= mask << _SSE_EMASK_SHIFT;
__ldmxcsr(mxcsr);
return (omask);
}

View File

@ -1,12 +0,0 @@
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_llrint.S,v 1.3 2011/02/04 21:54:06 kib Exp $")
ENTRY(llrint)
cvtsd2si %xmm0, %rax
ret
END(llrint)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,12 +0,0 @@
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_llrintf.S,v 1.3 2011/02/04 21:54:06 kib Exp $")
ENTRY(llrintf)
cvtss2si %xmm0, %rax
ret
END(llrintf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,45 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_llrintl.S,v 1.2 2011/01/07 16:13:12 kib Exp $");
ENTRY(llrintl)
#ifndef _WIN64
fldt 8(%rsp)
#else
fldt (%rcx)
#endif
subq $8,%rsp
fistpll (%rsp)
popq %rax
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,29 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_logbl.S,v 1.4 2011/01/07 16:13:12 kib Exp $")
ENTRY(logbl)
#ifndef _WIN64
fldt 8(%rsp)
#else
fldt (%rdx)
#endif
fxtract
fstp %st
#ifdef _WIN64
mov %rcx,%rax
movq $0x0,0x8(%rcx)
fstpt (%rcx)
#endif
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,44 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_lrint.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
ENTRY(lrint)
#ifndef _WIN64
cvtsd2si %xmm0, %rax
#else
cvtsd2si %xmm0, %eax
#endif
ret
END(lrint)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,44 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_lrintf.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
ENTRY(lrintf)
#ifndef _WIN64
cvtss2si %xmm0, %rax
#else
cvtss2si %xmm0, %eax
#endif
ret
END(lrintf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,45 +0,0 @@
/*-
* Copyright (c) 2008 David Schultz <das@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.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_lrintl.S,v 1.2 2011/01/07 16:13:12 kib Exp $");
ENTRY(lrintl)
#ifndef _WIN64
fldt 8(%rsp)
#else
fldt (%rcx)
#endif
subq $8,%rsp
fistpll (%rsp)
popq %rax
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,76 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
/*
* Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_remquo.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
ENTRY(remquo)
movsd %xmm0,-8(%rsp)
movsd %xmm1,-16(%rsp)
fldl -16(%rsp)
fldl -8(%rsp)
1: fprem1
fstsw %ax
btw $10,%ax
jc 1b
fstp %st(1)
/* Extract the three low-order bits of the quotient from C0,C3,C1. */
shrl $6,%eax
movl %eax,%ecx
andl $0x108,%eax
rorl $7,%eax
orl %eax,%ecx
roll $4,%eax
orl %ecx,%eax
andl $7,%eax
/* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */
movl -12(%rsp),%ecx
xorl -4(%rsp),%ecx
sarl $16,%ecx
sarl $16,%ecx
xorl %ecx,%eax
andl $1,%ecx
addl %ecx,%eax
/* Store the quotient and return. */
#ifndef _WIN64
movl %eax,(%rdi)
#else
movl %eax,(%r8)
#endif
fstpl -8(%rsp)
movsd -8(%rsp),%xmm0
ret
END(remquo)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,76 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
/*
* Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_remquof.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
ENTRY(remquof)
movss %xmm0,-4(%rsp)
movss %xmm1,-8(%rsp)
flds -8(%rsp)
flds -4(%rsp)
1: fprem1
fstsw %ax
btw $10,%ax
jc 1b
fstp %st(1)
/* Extract the three low-order bits of the quotient from C0,C3,C1. */
shrl $6,%eax
movl %eax,%ecx
andl $0x108,%eax
rorl $7,%eax
orl %eax,%ecx
roll $4,%eax
orl %ecx,%eax
andl $7,%eax
/* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */
movl -8(%rsp),%ecx
xorl -4(%rsp),%ecx
sarl $16,%ecx
sarl $16,%ecx
xorl %ecx,%eax
andl $1,%ecx
addl %ecx,%eax
/* Store the quotient and return. */
#ifndef _WIN64
movl %eax,(%rdi)
#else
movl %eax,(%r8)
#endif
fstps -4(%rsp)
movss -4(%rsp),%xmm0
ret
END(remquof)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,81 +0,0 @@
/*-
* Copyright (c) 2005-2008 David Schultz <das@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.
*/
/*
* Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_remquol.S,v 1.2 2011/01/07 16:13:12 kib Exp $");
ENTRY(remquol)
#ifndef _WIN64
fldt 24(%rsp)
fldt 8(%rsp)
#else
fldt (%r8)
fldt (%rdx)
mov %rcx,%r8
#endif
1: fprem1
fstsw %ax
btw $10,%ax
jc 1b
fstp %st(1)
/* Extract the three low-order bits of the quotient from C0,C3,C1. */
shrl $6,%eax
movl %eax,%ecx
andl $0x108,%eax
rorl $7,%eax
orl %eax,%ecx
roll $4,%eax
orl %ecx,%eax
andl $7,%eax
/* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */
movl 32(%rsp),%ecx
xorl 16(%rsp),%ecx
movsx %cx,%ecx
sarl $16,%ecx
sarl $16,%ecx
xorl %ecx,%eax
andl $1,%ecx
addl %ecx,%eax
/* Store the quotient and return. */
#ifndef _WIN64
movl %eax,(%rdi)
#else
movl %eax,(%r9)
mov %r8,%rax
movq $0x0,0x8(%r8)
fstpt (%r8)
#endif
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,26 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <amd64/bsd_asm.h>
ENTRY(rintl)
#ifndef _WIN64
fldt 8(%rsp)
frndint
#else
fldt (%rdx)
frndint
mov %rcx,%rax
movq $0x0,0x8(%rcx)
fstpt (%rcx)
#endif
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,55 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_scalbn.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
ENTRY(scalbn)
movsd %xmm0,-8(%rsp)
#ifndef _WIN64
movl %edi,-12(%rsp)
#else
movl %edx,-12(%rsp)
#endif
fildl -12(%rsp)
fldl -8(%rsp)
fscale
fstp %st(1)
fstpl -8(%rsp)
movsd -8(%rsp),%xmm0
ret
#ifndef _WIN64
END(scalbn)
.globl CNAME(ldexp)
#else
.globl CNAME(ldexp); .section .drectve; .ascii " -export:ldexp"
#endif
.set CNAME(ldexp),CNAME(scalbn)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,55 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_scalbnf.S,v 1.4 2011/01/07 16:13:12 kib Exp $")
ENTRY(scalbnf)
movss %xmm0,-8(%rsp)
#ifndef _WIN64
movl %edi,-4(%rsp)
#else
movl %edx,-4(%rsp)
#endif
fildl -4(%rsp)
flds -8(%rsp)
fscale
fstp %st(1)
fstps -8(%rsp)
movss -8(%rsp),%xmm0
ret
#ifndef _WIN64
END(scalbnf)
.globl CNAME(ldexpf)
#else
.globl CNAME(ldexpf); .section .drectve; .ascii " -export:ldexpf"
#endif
.set CNAME(ldexpf),CNAME(scalbnf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,40 +0,0 @@
/*
* Based on code written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <amd64/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/amd64/s_scalbnl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
/* //RCSID("$NetBSD: s_scalbnf.S,v 1.4 1999/01/02 05:15:40 kristerw Exp $") */
ENTRY(scalbnl)
#ifndef _WIN64
movl %edi,-4(%rsp)
fildl -4(%rsp)
fldt 8(%rsp)
#else
mov %r8,%rax
movl %eax,-4(%rsp)
fildl -4(%rsp)
fldt (%rdx)
#endif
fscale
fstp %st(1)
#ifdef _WIN64
mov %rcx,%rax
movq $0x0,0x8(%rcx)
fstpt (%rcx)
#endif
ret
#ifndef _WIN64
END(scalbnl)
.globl CNAME(ldexpl)
#else
.globl CNAME(ldexpl); .section .drectve; .ascii " -export:ldexpl"
#endif
.set CNAME(ldexpl),CNAME(scalbnl)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,37 +0,0 @@
environment:
matrix:
- ARCH: "x86_64"
branches:
only:
- master
- /release-.*/
skip_commits:
message: /\[av skip\]/
notifications:
- provider: Email
on_build_success: false
on_build_failure: false
on_build_status_changed: false
init:
- git config --global core.autocrlf input
build_script:
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
- if %ARCH%==i686 ( set EXCEPT=dwarf ) else set EXCEPT=seh
- if %ARCH%==i686 ( set MINGW=mingw32 ) else set MINGW=mingw64
- set PATH=C:\MinGW-w64\%ARCH%-6.3.0-posix-%EXCEPT%-rt_v5-rev1\%MINGW%\bin;%PATH%
- mingw32-make.exe ARCH=%ARCH% CC=%ARCH%-w64-mingw32-gcc
- mingw32-make.exe test ARCH=%ARCH% CC=%ARCH%-w64-mingw32-gcc
on_finish:
# Uncomment the following line for interactive debugging, which
# will print login data for a temporary remote session after the
# build. This requires an RDP version 6 client, e.g., FreeRDP.
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

View File

@ -1 +0,0 @@
$(CUR_SRCS) = fenv.c

View File

@ -1,52 +0,0 @@
/*-
* Copyright (c) 2004 David Schultz <das@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: src/lib/msun/arm/fenv.c,v 1.3 2011/10/16 05:37:56 das Exp $
*/
#define __fenv_static
#include <openlibm_fenv.h>
#ifdef __GNUC_GNU_INLINE__
#error "This file must be compiled with C99 'inline' semantics"
#endif
/*
* Hopefully the system ID byte is immutable, so it's valid to use
* this as a default environment.
*/
const fenv_t __fe_dfl_env = 0;
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);

View File

@ -1 +0,0 @@
$(CUR_SRCS) += b_exp.c b_log.c b_tgamma.c

View File

@ -1,172 +0,0 @@
/*
* Copyright (c) 1985, 1993
* The Regents of the University of California. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*/
/* @(#)exp.c 8.1 (Berkeley) 6/4/93 */
#include "cdefs-compat.h"
//__FBSDID("$FreeBSD: src/lib/msun/bsdsrc/b_exp.c,v 1.9 2011/10/16 05:37:20 das Exp $");
#include <openlibm_math.h>
/* EXP(X)
* RETURN THE EXPONENTIAL OF X
* DOUBLE PRECISION (IEEE 53 bits, VAX D FORMAT 56 BITS)
* CODED IN C BY K.C. NG, 1/19/85;
* REVISED BY K.C. NG on 2/6/85, 2/15/85, 3/7/85, 3/24/85, 4/16/85, 6/14/86.
*
* Required system supported functions:
* scalb(x,n)
* copysign(x,y)
* finite(x)
*
* Method:
* 1. Argument Reduction: given the input x, find r and integer k such
* that
* x = k*ln2 + r, |r| <= 0.5*ln2 .
* r will be represented as r := z+c for better accuracy.
*
* 2. Compute exp(r) by
*
* exp(r) = 1 + r + r*R1/(2-R1),
* where
* R1 = x - x^2*(p1+x^2*(p2+x^2*(p3+x^2*(p4+p5*x^2)))).
*
* 3. exp(x) = 2^k * exp(r) .
*
* Special cases:
* exp(INF) is INF, exp(NaN) is NaN;
* exp(-INF)= 0;
* for finite argument, only exp(0)=1 is exact.
*
* Accuracy:
* exp(x) returns the exponential of x nearly rounded. In a test run
* with 1,156,000 random arguments on a VAX, the maximum observed
* error was 0.869 ulps (units in the last place).
*/
#include "mathimpl.h"
static const double p1 = 0x1.555555555553ep-3;
static const double p2 = -0x1.6c16c16bebd93p-9;
static const double p3 = 0x1.1566aaf25de2cp-14;
static const double p4 = -0x1.bbd41c5d26bf1p-20;
static const double p5 = 0x1.6376972bea4d0p-25;
static const double ln2hi = 0x1.62e42fee00000p-1;
static const double ln2lo = 0x1.a39ef35793c76p-33;
static const double lnhuge = 0x1.6602b15b7ecf2p9;
static const double lntiny = -0x1.77af8ebeae354p9;
static const double invln2 = 0x1.71547652b82fep0;
#if 0
OLM_DLLEXPORT double exp(x)
double x;
{
double z,hi,lo,c;
int k;
#if !defined(vax)&&!defined(tahoe)
if(x!=x) return(x); /* x is NaN */
#endif /* !defined(vax)&&!defined(tahoe) */
if( x <= lnhuge ) {
if( x >= lntiny ) {
/* argument reduction : x --> x - k*ln2 */
k=invln2*x+copysign(0.5,x); /* k=NINT(x/ln2) */
/* express x-k*ln2 as hi-lo and let x=hi-lo rounded */
hi=x-k*ln2hi;
x=hi-(lo=k*ln2lo);
/* return 2^k*[1+x+x*c/(2+c)] */
z=x*x;
c= x - z*(p1+z*(p2+z*(p3+z*(p4+z*p5))));
return scalb(1.0+(hi-(lo-(x*c)/(2.0-c))),k);
}
/* end of x > lntiny */
else
/* exp(-big#) underflows to zero */
if(finite(x)) return(scalb(1.0,-5000));
/* exp(-INF) is zero */
else return(0.0);
}
/* end of x < lnhuge */
else
/* exp(INF) is INF, exp(+big#) overflows to INF */
return( finite(x) ? scalb(1.0,5000) : x);
}
#endif
/* returns exp(r = x + c) for |c| < |x| with no overlap. */
double __exp__D(x, c)
double x, c;
{
double z,hi,lo;
int k;
if (x != x) /* x is NaN */
return(x);
if ( x <= lnhuge ) {
if ( x >= lntiny ) {
/* argument reduction : x --> x - k*ln2 */
z = invln2*x;
k = z + copysign(.5, x);
/* express (x+c)-k*ln2 as hi-lo and let x=hi-lo rounded */
hi=(x-k*ln2hi); /* Exact. */
x= hi - (lo = k*ln2lo-c);
/* return 2^k*[1+x+x*c/(2+c)] */
z=x*x;
c= x - z*(p1+z*(p2+z*(p3+z*(p4+z*p5))));
c = (x*c)/(2.0-c);
return scalbn(1.+(hi-(lo - c)), k);
}
/* end of x > lntiny */
else
/* exp(-big#) underflows to zero */
if(isfinite(x)) return(scalbn(1.0,-5000));
/* exp(-INF) is zero */
else return(0.0);
}
/* end of x < lnhuge */
else
/* exp(INF) is INF, exp(+big#) overflows to INF */
return( isfinite(x) ? scalbn(1.0,5000) : x);
}

View File

@ -1,466 +0,0 @@
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*/
/* @(#)log.c 8.2 (Berkeley) 11/30/93 */
#include "cdefs-compat.h"
//__FBSDID("$FreeBSD: src/lib/msun/bsdsrc/b_log.c,v 1.9 2008/02/22 02:26:51 das Exp $");
#include <openlibm_math.h>
#include "mathimpl.h"
/* Table-driven natural logarithm.
*
* This code was derived, with minor modifications, from:
* Peter Tang, "Table-Driven Implementation of the
* Logarithm in IEEE Floating-Point arithmetic." ACM Trans.
* Math Software, vol 16. no 4, pp 378-400, Dec 1990).
*
* Calculates log(2^m*F*(1+f/F)), |f/j| <= 1/256,
* where F = j/128 for j an integer in [0, 128].
*
* log(2^m) = log2_hi*m + log2_tail*m
* since m is an integer, the dominant term is exact.
* m has at most 10 digits (for subnormal numbers),
* and log2_hi has 11 trailing zero bits.
*
* log(F) = logF_hi[j] + logF_lo[j] is in tabular form in log_table.h
* logF_hi[] + 512 is exact.
*
* log(1+f/F) = 2*f/(2*F + f) + 1/12 * (2*f/(2*F + f))**3 + ...
* the leading term is calculated to extra precision in two
* parts, the larger of which adds exactly to the dominant
* m and F terms.
* There are two cases:
* 1. when m, j are non-zero (m | j), use absolute
* precision for the leading term.
* 2. when m = j = 0, |1-x| < 1/256, and log(x) ~= (x-1).
* In this case, use a relative precision of 24 bits.
* (This is done differently in the original paper)
*
* Special cases:
* 0 return signalling -Inf
* neg return signalling NaN
* +Inf return +Inf
*/
#define N 128
/* Table of log(Fj) = logF_head[j] + logF_tail[j], for Fj = 1+j/128.
* Used for generation of extend precision logarithms.
* The constant 35184372088832 is 2^45, so the divide is exact.
* It ensures correct reading of logF_head, even for inaccurate
* decimal-to-binary conversion routines. (Everybody gets the
* right answer for integers less than 2^53.)
* Values for log(F) were generated using error < 10^-57 absolute
* with the bc -l package.
*/
static double A1 = .08333333333333178827;
static double A2 = .01250000000377174923;
static double A3 = .002232139987919447809;
static double A4 = .0004348877777076145742;
static double logF_head[N+1] = {
0.,
.007782140442060381246,
.015504186535963526694,
.023167059281547608406,
.030771658666765233647,
.038318864302141264488,
.045809536031242714670,
.053244514518837604555,
.060624621816486978786,
.067950661908525944454,
.075223421237524235039,
.082443669210988446138,
.089612158689760690322,
.096729626458454731618,
.103796793681567578460,
.110814366340264314203,
.117783035656430001836,
.124703478501032805070,
.131576357788617315236,
.138402322859292326029,
.145182009844575077295,
.151916042025732167530,
.158605030176659056451,
.165249572895390883786,
.171850256926518341060,
.178407657472689606947,
.184922338493834104156,
.191394852999565046047,
.197825743329758552135,
.204215541428766300668,
.210564769107350002741,
.216873938300523150246,
.223143551314024080056,
.229374101064877322642,
.235566071312860003672,
.241719936886966024758,
.247836163904594286577,
.253915209980732470285,
.259957524436686071567,
.265963548496984003577,
.271933715484010463114,
.277868451003087102435,
.283768173130738432519,
.289633292582948342896,
.295464212893421063199,
.301261330578199704177,
.307025035294827830512,
.312755710004239517729,
.318453731118097493890,
.324119468654316733591,
.329753286372579168528,
.335355541920762334484,
.340926586970454081892,
.346466767346100823488,
.351976423156884266063,
.357455888922231679316,
.362905493689140712376,
.368325561158599157352,
.373716409793814818840,
.379078352934811846353,
.384411698910298582632,
.389716751140440464951,
.394993808240542421117,
.400243164127459749579,
.405465108107819105498,
.410659924985338875558,
.415827895143593195825,
.420969294644237379543,
.426084395310681429691,
.431173464818130014464,
.436236766774527495726,
.441274560805140936281,
.446287102628048160113,
.451274644139630254358,
.456237433481874177232,
.461175715122408291790,
.466089729924533457960,
.470979715219073113985,
.475845904869856894947,
.480688529345570714212,
.485507815781602403149,
.490303988045525329653,
.495077266798034543171,
.499827869556611403822,
.504556010751912253908,
.509261901790523552335,
.513945751101346104405,
.518607764208354637958,
.523248143765158602036,
.527867089620485785417,
.532464798869114019908,
.537041465897345915436,
.541597282432121573947,
.546132437597407260909,
.550647117952394182793,
.555141507540611200965,
.559615787935399566777,
.564070138285387656651,
.568504735352689749561,
.572919753562018740922,
.577315365035246941260,
.581691739635061821900,
.586049045003164792433,
.590387446602107957005,
.594707107746216934174,
.599008189645246602594,
.603290851438941899687,
.607555250224322662688,
.611801541106615331955,
.616029877215623855590,
.620240409751204424537,
.624433288012369303032,
.628608659422752680256,
.632766669570628437213,
.636907462236194987781,
.641031179420679109171,
.645137961373620782978,
.649227946625615004450,
.653301272011958644725,
.657358072709030238911,
.661398482245203922502,
.665422632544505177065,
.669430653942981734871,
.673422675212350441142,
.677398823590920073911,
.681359224807238206267,
.685304003098281100392,
.689233281238557538017,
.693147180560117703862
};
static double logF_tail[N+1] = {
0.,
-.00000000000000543229938420049,
.00000000000000172745674997061,
-.00000000000001323017818229233,
-.00000000000001154527628289872,
-.00000000000000466529469958300,
.00000000000005148849572685810,
-.00000000000002532168943117445,
-.00000000000005213620639136504,
-.00000000000001819506003016881,
.00000000000006329065958724544,
.00000000000008614512936087814,
-.00000000000007355770219435028,
.00000000000009638067658552277,
.00000000000007598636597194141,
.00000000000002579999128306990,
-.00000000000004654729747598444,
-.00000000000007556920687451336,
.00000000000010195735223708472,
-.00000000000017319034406422306,
-.00000000000007718001336828098,
.00000000000010980754099855238,
-.00000000000002047235780046195,
-.00000000000008372091099235912,
.00000000000014088127937111135,
.00000000000012869017157588257,
.00000000000017788850778198106,
.00000000000006440856150696891,
.00000000000016132822667240822,
-.00000000000007540916511956188,
-.00000000000000036507188831790,
.00000000000009120937249914984,
.00000000000018567570959796010,
-.00000000000003149265065191483,
-.00000000000009309459495196889,
.00000000000017914338601329117,
-.00000000000001302979717330866,
.00000000000023097385217586939,
.00000000000023999540484211737,
.00000000000015393776174455408,
-.00000000000036870428315837678,
.00000000000036920375082080089,
-.00000000000009383417223663699,
.00000000000009433398189512690,
.00000000000041481318704258568,
-.00000000000003792316480209314,
.00000000000008403156304792424,
-.00000000000034262934348285429,
.00000000000043712191957429145,
-.00000000000010475750058776541,
-.00000000000011118671389559323,
.00000000000037549577257259853,
.00000000000013912841212197565,
.00000000000010775743037572640,
.00000000000029391859187648000,
-.00000000000042790509060060774,
.00000000000022774076114039555,
.00000000000010849569622967912,
-.00000000000023073801945705758,
.00000000000015761203773969435,
.00000000000003345710269544082,
-.00000000000041525158063436123,
.00000000000032655698896907146,
-.00000000000044704265010452446,
.00000000000034527647952039772,
-.00000000000007048962392109746,
.00000000000011776978751369214,
-.00000000000010774341461609578,
.00000000000021863343293215910,
.00000000000024132639491333131,
.00000000000039057462209830700,
-.00000000000026570679203560751,
.00000000000037135141919592021,
-.00000000000017166921336082431,
-.00000000000028658285157914353,
-.00000000000023812542263446809,
.00000000000006576659768580062,
-.00000000000028210143846181267,
.00000000000010701931762114254,
.00000000000018119346366441110,
.00000000000009840465278232627,
-.00000000000033149150282752542,
-.00000000000018302857356041668,
-.00000000000016207400156744949,
.00000000000048303314949553201,
-.00000000000071560553172382115,
.00000000000088821239518571855,
-.00000000000030900580513238244,
-.00000000000061076551972851496,
.00000000000035659969663347830,
.00000000000035782396591276383,
-.00000000000046226087001544578,
.00000000000062279762917225156,
.00000000000072838947272065741,
.00000000000026809646615211673,
-.00000000000010960825046059278,
.00000000000002311949383800537,
-.00000000000058469058005299247,
-.00000000000002103748251144494,
-.00000000000023323182945587408,
-.00000000000042333694288141916,
-.00000000000043933937969737844,
.00000000000041341647073835565,
.00000000000006841763641591466,
.00000000000047585534004430641,
.00000000000083679678674757695,
-.00000000000085763734646658640,
.00000000000021913281229340092,
-.00000000000062242842536431148,
-.00000000000010983594325438430,
.00000000000065310431377633651,
-.00000000000047580199021710769,
-.00000000000037854251265457040,
.00000000000040939233218678664,
.00000000000087424383914858291,
.00000000000025218188456842882,
-.00000000000003608131360422557,
-.00000000000050518555924280902,
.00000000000078699403323355317,
-.00000000000067020876961949060,
.00000000000016108575753932458,
.00000000000058527188436251509,
-.00000000000035246757297904791,
-.00000000000018372084495629058,
.00000000000088606689813494916,
.00000000000066486268071468700,
.00000000000063831615170646519,
.00000000000025144230728376072,
-.00000000000017239444525614834
};
#if 0
OLM_DLLEXPORT double
#ifdef _ANSI_SOURCE
log(double x)
#else
log(x) double x;
#endif
{
int m, j;
double F, f, g, q, u, u2, v, zero = 0.0, one = 1.0;
volatile double u1;
/* Catch special cases */
if (x <= 0)
if (x == zero) /* log(0) = -Inf */
return (-one/zero);
else /* log(neg) = NaN */
return (zero/zero);
else if (!finite(x))
return (x+x); /* x = NaN, Inf */
/* Argument reduction: 1 <= g < 2; x/2^m = g; */
/* y = F*(1 + f/F) for |f| <= 2^-8 */
m = logb(x);
g = ldexp(x, -m);
if (m == -1022) {
j = logb(g), m += j;
g = ldexp(g, -j);
}
j = N*(g-1) + .5;
F = (1.0/N) * j + 1; /* F*128 is an integer in [128, 512] */
f = g - F;
/* Approximate expansion for log(1+f/F) ~= u + q */
g = 1/(2*F+f);
u = 2*f*g;
v = u*u;
q = u*v*(A1 + v*(A2 + v*(A3 + v*A4)));
/* case 1: u1 = u rounded to 2^-43 absolute. Since u < 2^-8,
* u1 has at most 35 bits, and F*u1 is exact, as F has < 8 bits.
* It also adds exactly to |m*log2_hi + log_F_head[j] | < 750
*/
if (m | j)
u1 = u + 513, u1 -= 513;
/* case 2: |1-x| < 1/256. The m- and j- dependent terms are zero;
* u1 = u to 24 bits.
*/
else
u1 = u, TRUNC(u1);
u2 = (2.0*(f - F*u1) - u1*f) * g;
/* u1 + u2 = 2f/(2F+f) to extra precision. */
/* log(x) = log(2^m*F*(1+f/F)) = */
/* (m*log2_hi+logF_head[j]+u1) + (m*log2_lo+logF_tail[j]+q); */
/* (exact) + (tiny) */
u1 += m*logF_head[N] + logF_head[j]; /* exact */
u2 = (u2 + logF_tail[j]) + q; /* tiny */
u2 += logF_tail[N]*m;
return (u1 + u2);
}
#endif
/*
* Extra precision variant, returning struct {double a, b;};
* log(x) = a+b to 63 bits, with a rounded to 26 bits.
*/
struct Double
#ifdef _ANSI_SOURCE
__log__D(double x)
#else
__log__D(x) double x;
#endif
{
int m, j;
double F, f, g, q, u, v, u2;
volatile double u1;
struct Double r;
/* Argument reduction: 1 <= g < 2; x/2^m = g; */
/* y = F*(1 + f/F) for |f| <= 2^-8 */
m = logb(x);
g = ldexp(x, -m);
if (m == -1022) {
j = logb(g), m += j;
g = ldexp(g, -j);
}
j = N*(g-1) + .5;
F = (1.0/N) * j + 1;
f = g - F;
g = 1/(2*F+f);
u = 2*f*g;
v = u*u;
q = u*v*(A1 + v*(A2 + v*(A3 + v*A4)));
if (m | j)
u1 = u + 513, u1 -= 513;
else
u1 = u, TRUNC(u1);
u2 = (2.0*(f - F*u1) - u1*f) * g;
u1 += m*logF_head[N] + logF_head[j];
u2 += logF_tail[j]; u2 += q;
u2 += logF_tail[N]*m;
r.a = u1 + u2; /* Only difference is here */
TRUNC(r.a);
r.b = (u1 - r.a) + u2;
return (r);
}

View File

@ -1,319 +0,0 @@
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*/
/* @(#)gamma.c 8.1 (Berkeley) 6/4/93 */
#include "cdefs-compat.h"
//__FBSDID("$FreeBSD: src/lib/msun/bsdsrc/b_tgamma.c,v 1.10 2008/02/22 02:26:51 das Exp $");
/*
* This code by P. McIlroy, Oct 1992;
*
* The financial support of UUNET Communications Services is greatfully
* acknowledged.
*/
#include <float.h>
#include <openlibm_math.h>
#include "mathimpl.h"
/* METHOD:
* x < 0: Use reflection formula, G(x) = pi/(sin(pi*x)*x*G(x))
* At negative integers, return NaN and raise invalid.
*
* x < 6.5:
* Use argument reduction G(x+1) = xG(x) to reach the
* range [1.066124,2.066124]. Use a rational
* approximation centered at the minimum (x0+1) to
* ensure monotonicity.
*
* x >= 6.5: Use the asymptotic approximation (Stirling's formula)
* adjusted for equal-ripples:
*
* log(G(x)) ~= (x-.5)*(log(x)-1) + .5(log(2*pi)-1) + 1/x*P(1/(x*x))
*
* Keep extra precision in multiplying (x-.5)(log(x)-1), to
* avoid premature round-off.
*
* Special values:
* -Inf: return NaN and raise invalid;
* negative integer: return NaN and raise invalid;
* other x ~< 177.79: return +-0 and raise underflow;
* +-0: return +-Inf and raise divide-by-zero;
* finite x ~> 171.63: return +Inf and raise overflow;
* +Inf: return +Inf;
* NaN: return NaN.
*
* Accuracy: tgamma(x) is accurate to within
* x > 0: error provably < 0.9ulp.
* Maximum observed in 1,000,000 trials was .87ulp.
* x < 0:
* Maximum observed error < 4ulp in 1,000,000 trials.
*/
static double neg_gam(double);
static double small_gam(double);
static double smaller_gam(double);
static struct Double large_gam(double);
static struct Double ratfun_gam(double, double);
/*
* Rational approximation, A0 + x*x*P(x)/Q(x), on the interval
* [1.066.., 2.066..] accurate to 4.25e-19.
*/
#define LEFT -.3955078125 /* left boundary for rat. approx */
#define x0 .461632144968362356785 /* xmin - 1 */
#define a0_hi 0.88560319441088874992
#define a0_lo -.00000000000000004996427036469019695
#define P0 6.21389571821820863029017800727e-01
#define P1 2.65757198651533466104979197553e-01
#define P2 5.53859446429917461063308081748e-03
#define P3 1.38456698304096573887145282811e-03
#define P4 2.40659950032711365819348969808e-03
#define Q0 1.45019531250000000000000000000e+00
#define Q1 1.06258521948016171343454061571e+00
#define Q2 -2.07474561943859936441469926649e-01
#define Q3 -1.46734131782005422506287573015e-01
#define Q4 3.07878176156175520361557573779e-02
#define Q5 5.12449347980666221336054633184e-03
#define Q6 -1.76012741431666995019222898833e-03
#define Q7 9.35021023573788935372153030556e-05
#define Q8 6.13275507472443958924745652239e-06
/*
* Constants for large x approximation (x in [6, Inf])
* (Accurate to 2.8*10^-19 absolute)
*/
#define lns2pi_hi 0.418945312500000
#define lns2pi_lo -.000006779295327258219670263595
#define Pa0 8.33333333333333148296162562474e-02
#define Pa1 -2.77777777774548123579378966497e-03
#define Pa2 7.93650778754435631476282786423e-04
#define Pa3 -5.95235082566672847950717262222e-04
#define Pa4 8.41428560346653702135821806252e-04
#define Pa5 -1.89773526463879200348872089421e-03
#define Pa6 5.69394463439411649408050664078e-03
#define Pa7 -1.44705562421428915453880392761e-02
static const double zero = 0., one = 1.0, tiny = 1e-300;
OLM_DLLEXPORT double
tgamma(x)
double x;
{
struct Double u;
if (isgreaterequal(x, 6)) {
if(x > 171.63)
return (x / zero);
u = large_gam(x);
return(__exp__D(u.a, u.b));
} else if (isgreaterequal(x, 1.0 + LEFT + x0))
return (small_gam(x));
else if (isgreater(x, 1.e-17))
return (smaller_gam(x));
else if (isgreater(x, -1.e-17)) {
if (x != 0.0)
u.a = one - tiny; /* raise inexact */
return (one/x);
} else if (!isfinite(x))
return (x - x); /* x is NaN or -Inf */
else
return (neg_gam(x));
}
/*
* Accurate to max(ulp(1/128) absolute, 2^-66 relative) error.
*/
static struct Double
large_gam(x)
double x;
{
double z, p;
struct Double t, u, v;
z = one/(x*x);
p = Pa0+z*(Pa1+z*(Pa2+z*(Pa3+z*(Pa4+z*(Pa5+z*(Pa6+z*Pa7))))));
p = p/x;
u = __log__D(x);
u.a -= one;
v.a = (x -= .5);
TRUNC(v.a);
v.b = x - v.a;
t.a = v.a*u.a; /* t = (x-.5)*(log(x)-1) */
t.b = v.b*u.a + x*u.b;
/* return t.a + t.b + lns2pi_hi + lns2pi_lo + p */
t.b += lns2pi_lo; t.b += p;
u.a = lns2pi_hi + t.b; u.a += t.a;
u.b = t.a - u.a;
u.b += lns2pi_hi; u.b += t.b;
return (u);
}
/*
* Good to < 1 ulp. (provably .90 ulp; .87 ulp on 1,000,000 runs.)
* It also has correct monotonicity.
*/
static double
small_gam(x)
double x;
{
double y, ym1, t;
struct Double yy, r;
y = x - one;
ym1 = y - one;
if (y <= 1.0 + (LEFT + x0)) {
yy = ratfun_gam(y - x0, 0);
return (yy.a + yy.b);
}
r.a = y;
TRUNC(r.a);
yy.a = r.a - one;
y = ym1;
yy.b = r.b = y - yy.a;
/* Argument reduction: G(x+1) = x*G(x) */
for (ym1 = y-one; ym1 > LEFT + x0; y = ym1--, yy.a--) {
t = r.a*yy.a;
r.b = r.a*yy.b + y*r.b;
r.a = t;
TRUNC(r.a);
r.b += (t - r.a);
}
/* Return r*tgamma(y). */
yy = ratfun_gam(y - x0, 0);
y = r.b*(yy.a + yy.b) + r.a*yy.b;
y += yy.a*r.a;
return (y);
}
/*
* Good on (0, 1+x0+LEFT]. Accurate to 1ulp.
*/
static double
smaller_gam(x)
double x;
{
double t, d;
struct Double r, xx;
if (x < x0 + LEFT) {
t = x, TRUNC(t);
d = (t+x)*(x-t);
t *= t;
xx.a = (t + x), TRUNC(xx.a);
xx.b = x - xx.a; xx.b += t; xx.b += d;
t = (one-x0); t += x;
d = (one-x0); d -= t; d += x;
x = xx.a + xx.b;
} else {
xx.a = x, TRUNC(xx.a);
xx.b = x - xx.a;
t = x - x0;
d = (-x0 -t); d += x;
}
r = ratfun_gam(t, d);
d = r.a/x, TRUNC(d);
r.a -= d*xx.a; r.a -= d*xx.b; r.a += r.b;
return (d + r.a/x);
}
/*
* returns (z+c)^2 * P(z)/Q(z) + a0
*/
static struct Double
ratfun_gam(z, c)
double z, c;
{
double p, q;
struct Double r, t;
q = Q0 +z*(Q1+z*(Q2+z*(Q3+z*(Q4+z*(Q5+z*(Q6+z*(Q7+z*Q8)))))));
p = P0 + z*(P1 + z*(P2 + z*(P3 + z*P4)));
/* return r.a + r.b = a0 + (z+c)^2*p/q, with r.a truncated to 26 bits. */
p = p/q;
t.a = z, TRUNC(t.a); /* t ~= z + c */
t.b = (z - t.a) + c;
t.b *= (t.a + z);
q = (t.a *= t.a); /* t = (z+c)^2 */
TRUNC(t.a);
t.b += (q - t.a);
r.a = p, TRUNC(r.a); /* r = P/Q */
r.b = p - r.a;
t.b = t.b*p + t.a*r.b + a0_lo;
t.a *= r.a; /* t = (z+c)^2*(P/Q) */
r.a = t.a + a0_hi, TRUNC(r.a);
r.b = ((a0_hi-r.a) + t.a) + t.b;
return (r); /* r = a0 + t */
}
static double
neg_gam(x)
double x;
{
int sgn = 1;
struct Double lg, lsine;
double y, z;
y = ceil(x);
if (y == x) /* Negative integer. */
return ((x - x) / zero);
z = y - x;
if (z > 0.5)
z = one - z;
y = 0.5 * y;
if (y == ceil(y))
sgn = -1;
if (z < .25)
z = sin(M_PI*z);
else
z = cos(M_PI*(0.5-z));
/* Special case: G(1-x) = Inf; G(x) may be nonzero. */
if (x < -170) {
if (x < -190)
return ((double)sgn*tiny*tiny);
y = one - x; /* exact: 128 < |x| < 255 */
lg = large_gam(y);
lsine = __log__D(M_PI/z); /* = TRUNC(log(u)) + small */
lg.a -= lsine.a; /* exact (opposite signs) */
lg.b -= lsine.b;
y = -(lg.a + lg.b);
z = (y + lg.a) + lg.b;
y = __exp__D(y, z);
if (sgn < 0) y = -y;
return (y);
}
y = one-x;
if (one-y == x)
y = tgamma(y);
else /* 1-x is inexact */
y = -x*tgamma(-x);
if (sgn < 0) y = -y;
return (M_PI / (y*z));
}
#if (LDBL_MANT_DIG == 53)
openlibm_weak_reference(tgamma, tgammal);
#endif

View File

@ -1,70 +0,0 @@
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. 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.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* @(#)mathimpl.h 8.1 (Berkeley) 6/4/93
* $FreeBSD: src/lib/msun/bsdsrc/mathimpl.h,v 1.7 2005/11/18 05:03:12 bde Exp $
*/
#ifndef _MATHIMPL_H_
#define _MATHIMPL_H_
#include "cdefs-compat.h"
#include "math_private.h"
/*
* TRUNC() is a macro that sets the trailing 27 bits in the mantissa of an
* IEEE double variable to zero. It must be expression-like for syntactic
* reasons, and we implement this expression using an inline function
* instead of a pure macro to avoid depending on the gcc feature of
* statement-expressions.
*/
#define TRUNC(d) (_b_trunc(&(d)))
static __inline void
_b_trunc(volatile double *_dp)
{
//VBS
//u_int32_t _lw;
u_int32_t _lw;
GET_LOW_WORD(_lw, *_dp);
SET_LOW_WORD(*_dp, _lw & 0xf8000000);
}
struct Double {
double a;
double b;
};
/*
* Functions internal to the math package, yet not static.
*/
double __exp__D(double, double);
struct Double __log__D(double);
#endif /* !_MATHIMPL_H_ */

View File

@ -1 +0,0 @@
openlibm.org

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 357 B

View File

@ -1,93 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>OpenLibm</title>
<link rel="stylesheet" href="stylesheets/styles.css">
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
<script src="javascripts/scale.fix.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
</head>
<body>
<div class="wrapper">
<header>
<h1 class="header">OpenLibm</h1>
<p class="header">A high quality system independent, portable, open source libm implementation</p>
<ul>
<li class="download"><a class="buttons" href="https://github.com/JuliaMath/openlibm/releases">Download</a></li>
<li><a class="buttons github" href="https://github.com/JuliaMath/openlibm">View On GitHub</a></li>
</ul>
<p class="header">This project is maintained by <a class="header name" href="https://julialang.org/">the Julia Project</a></p>
</header>
<section>
<h2>
<a id="openlibm" class="anchor" href="#openlibm" aria-hidden="true"><span class="octicon octicon-link"></span></a>OpenLibm</h2>
<p><a href="http://www.openlibm.org">OpenLibm</a> is an effort to have a high quality, portable, standalone
C mathematical library (<a href="http://en.wikipedia.org/wiki/libm"><code>libm</code></a>).
It can be used standalone in applications and programming language
implementations.</p>
<p>The project was born out of a need to have a good <code>libm</code> for the
<a href="http://www.julialang.org">Julia programming langage</a> that worked
consistently across compilers and operating systems, and in 32-bit and
64-bit environments.</p>
<h3>
<a id="history" class="anchor" href="#history" aria-hidden="true"><span class="octicon octicon-link"></span></a>History</h3>
<p>The OpenLibm code derives from the <a href="http://svnweb.freebsd.org/base/head/lib/msun/">FreeBSD
msun</a> and <a href="http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libm/src/">OpenBSD
libm</a>
implementations, which in turn derive from <a href="http://www.netlib.org/fdlibm/">FDLIBM
5.3</a>. Over and above that, OpenLibm itself has received a number of patches to make it platform independent and portable.</p>
<h3>
<a id="platform-support" class="anchor" href="#platform-support" aria-hidden="true"><span class="octicon octicon-link"></span></a>Platform support</h3>
<p>OpenLibm builds on Linux, macOS, Windows, FreeBSD, OpenBSD, NetBSD, and
DragonFly BSD. It builds with both GCC and clang. Although largely
tested and widely used on the x86 and x86-64 architectures, OpenLibm
also supports arm, aarch64, ppc64le, mips, wasm32, and s390(x).
<h3>
<a id="other-relevant-projects" class="anchor" href="#other-relevant-projects" aria-hidden="true"><span class="octicon octicon-link"></span></a>Other relevant projects</h3>
<ol>
<li> <a href="https://git.musl-libc.org/cgit/musl/tree/src/math">MUSL</a> The libm library in the musl-libc project</li>
<li> <a href="http://www.netlib.org/fdlibm/">FDLIBM</a>: Freely Distributable Math Library</li>
<li> <a href="https://github.com/freebsd/freebsd/tree/master/lib/msun">FreeBSD msun</a>: FreeBSD's math library</li>
<li> <a href="https://github.com/JuliaIntervals/CRlibm.jl">CRlibm</a>: Correctly Rounded mathematical library</li>
</ol>
<h3>
<a id="Acknowledgements" class="anchor" href="#Acknowledgements" aria-hidden="true"><span class="octicon octicon-link"></span></a>Acknowledgements</h3>
<p>PowerPC support for OpenLibm was graciously sponsored by IBM.
</section>
<footer>
<p><small>Hosted on <a href="http://pages.github.com">GitHub Pages</a> using the Dinky theme</small></p>
</footer>
</div>
<!--[if !IE]><script>fixScale(document);</script><![endif]-->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-28835595-4");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body>
</html>

View File

@ -1,20 +0,0 @@
fixScale = function(doc) {
var addEvent = 'addEventListener',
type = 'gesturestart',
qsa = 'querySelectorAll',
scales = [1, 1],
meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
function fix() {
meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
doc.removeEventListener(type, fix, true);
}
if ((meta = meta[meta.length - 1]) && addEvent in doc) {
fix();
scales = [.25, 1.6];
doc[addEvent](type, fix, true);
}
};

View File

@ -1 +0,0 @@
{"name":"OpenLibm","tagline":"A high quality system independent, portable, open source libm implementation","body":"## OpenLibm\r\n\r\n[OpenLibm](http://www.openlibm.org) is an effort to have a high quality, portable, standalone\r\nC mathematical library ([`libm`](http://en.wikipedia.org/wiki/libm)).\r\nIt can be used standalone in applications and programming language\r\nimplementations.\r\n\r\nThe project was born out of a need to have a good `libm` for the\r\n[Julia programming langage](http://www.julialang.org) that worked\r\nconsistently across compilers and operating systems, and in 32-bit and\r\n64-bit environments.\r\n\r\n### History\r\n\r\nThe OpenLibm code derives from the [FreeBSD\r\nmsun](http://svnweb.freebsd.org/base/head/lib/msun/) and [OpenBSD\r\nlibm](http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libm/src/)\r\nimplementations, which in turn derives from [FDLIBM\r\n5.3](http://www.netlib.org/fdlibm/). As a result, it includes a number\r\nof fixes and updates to FDLIBM that have accumulated over the years in\r\n`msun`, and optimized versions of many functions.\r\n\r\n### Platform support\r\n\r\nOpenLibm builds on Linux, Mac OS X, and Windows, and with little\r\neffort, should build on FreeBSD as well. It builds with both GCC and\r\nclang. Although largely tested on x86, it also includes experimental\r\nsupport for ARM. The original `msun` also includes support for mips,\r\nsparc64, powerpc, ia64, and alpha. These are present in the OpenLibm\r\nsource tree, but no attempt has been made to build any of these.\r\n\r\n### Build instructions\r\n\r\n1. `make` or `make USEGCC=1` to build with GCC. This is the default on\r\n Linux and Windows.\r\n2. `make USECLANG=1` to build with clang. This is the default on OS X.\r\n","google":"UA-28835595-4","note":"Don't delete this file! It's used internally to help with page regeneration."}

View File

@ -1,69 +0,0 @@
.highlight { background: #ffffff; }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { font-weight: bold } /* Keyword.Constant */
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
.highlight .kn { font-weight: bold } /* Keyword.Namespace */
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d14 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
.highlight .sc { color: #d14 } /* Literal.String.Char */
.highlight .sd { color: #d14 } /* Literal.String.Doc */
.highlight .s2 { color: #d14 } /* Literal.String.Double */
.highlight .se { color: #d14 } /* Literal.String.Escape */
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
.highlight .si { color: #d14 } /* Literal.String.Interpol */
.highlight .sx { color: #d14 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d14 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
.type-csharp .highlight .k { color: #0000FF }
.type-csharp .highlight .kt { color: #0000FF }
.type-csharp .highlight .nf { color: #000000; font-weight: normal }
.type-csharp .highlight .nc { color: #2B91AF }
.type-csharp .highlight .nn { color: #000000 }
.type-csharp .highlight .s { color: #A31515 }
.type-csharp .highlight .sc { color: #A31515 }

View File

@ -1,423 +0,0 @@
@import url(https://fonts.googleapis.com/css?family=Arvo:400,700,400italic);
/* MeyerWeb Reset */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font: inherit;
vertical-align: baseline;
}
/* Base text styles */
body {
padding:10px 50px 0 0;
font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
color: #232323;
background-color: #FBFAF7;
margin: 0;
line-height: 1.8em;
-webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 {
color:#232323;
margin:36px 0 10px;
}
p, ul, ol, table, dl {
margin:0 0 22px;
}
h1, h2, h3 {
font-family: Arvo, Monaco, serif;
line-height:1.3;
font-weight: normal;
}
h1,h2, h3 {
display: block;
border-bottom: 1px solid #ccc;
padding-bottom: 5px;
}
h1 {
font-size: 30px;
}
h2 {
font-size: 24px;
}
h3 {
font-size: 18px;
}
h4, h5, h6 {
font-family: Arvo, Monaco, serif;
font-weight: 700;
}
a {
color:#C30000;
font-weight:200;
text-decoration:none;
}
a:hover {
text-decoration: underline;
}
a small {
font-size: 12px;
}
em {
font-style: italic;
}
strong {
font-weight:700;
}
ul {
list-style-position: inside;
list-style: disc;
padding-left: 25px;
}
ol {
list-style-position: inside;
list-style: decimal;
padding-left: 25px;
}
blockquote {
margin: 0;
padding: 0 0 0 20px;
font-style: italic;
}
dl, dt, dd, dl p {
font-color: #444;
}
dl dt {
font-weight: bold;
}
dl dd {
padding-left: 20px;
font-style: italic;
}
dl p {
padding-left: 20px;
font-style: italic;
}
hr {
border:0;
background:#ccc;
height:1px;
margin:0 0 24px;
}
/* Images */
img {
position: relative;
margin: 0 auto;
max-width: 650px;
padding: 5px;
margin: 10px 0 32px 0;
border: 1px solid #ccc;
}
p img {
display: inline;
margin: 0;
padding: 0;
vertical-align: middle;
text-align: center;
border: none;
}
/* Code blocks */
code, pre {
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
color:#000;
font-size:14px;
}
pre {
padding: 4px 12px;
background: #FDFEFB;
border-radius:4px;
border:1px solid #D7D8C8;
overflow: auto;
overflow-y: hidden;
margin-bottom: 32px;
}
/* Tables */
table {
width:100%;
}
table {
border: 1px solid #ccc;
margin-bottom: 32px;
text-align: left;
}
th {
font-family: 'Arvo', Helvetica, Arial, sans-serif;
font-size: 18px;
font-weight: normal;
padding: 10px;
background: #232323;
color: #FDFEFB;
}
td {
padding: 10px;
background: #ccc;
}
/* Wrapper */
.wrapper {
width:960px;
}
/* Header */
header {
background-color: #171717;
color: #FDFDFB;
width:170px;
float:left;
position:fixed;
border: 1px solid #000;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
-moz-border-radius-topright: 4px;
-moz-border-radius-bottomright: 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
padding: 34px 25px 22px 50px;
margin: 30px 25px 0 0;
-webkit-font-smoothing: antialiased;
}
p.header {
font-size: 16px;
}
h1.header {
font-family: Arvo, sans-serif;
font-size: 30px;
font-weight: 300;
line-height: 1.3em;
border-bottom: none;
margin-top: 0;
}
h1.header, a.header, a.name, header a{
color: #fff;
}
a.header {
text-decoration: underline;
}
a.name {
white-space: nowrap;
}
header ul {
list-style:none;
padding:0;
}
header li {
list-style-type: none;
width:132px;
height:15px;
margin-bottom: 12px;
line-height: 1em;
padding: 6px 6px 6px 7px;
background: #AF0011;
background: -moz-linear-gradient(top, #AF0011 0%, #820011 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd));
background: -webkit-linear-gradient(top, #AF0011 0%,#820011 100%);
background: -o-linear-gradient(top, #AF0011 0%,#820011 100%);
background: -ms-linear-gradient(top, #AF0011 0%,#820011 100%);
background: linear-gradient(top, #AF0011 0%,#820011 100%);
border-radius:4px;
border:1px solid #0D0D0D;
-webkit-box-shadow: inset 0px 1px 1px 0 rgba(233,2,38, 1);
box-shadow: inset 0px 1px 1px 0 rgba(233,2,38, 1);
}
header li:hover {
background: #C3001D;
background: -moz-linear-gradient(top, #C3001D 0%, #950119 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd));
background: -webkit-linear-gradient(top, #C3001D 0%,#950119 100%);
background: -o-linear-gradient(top, #C3001D 0%,#950119 100%);
background: -ms-linear-gradient(top, #C3001D 0%,#950119 100%);
background: linear-gradient(top, #C3001D 0%,#950119 100%);
}
a.buttons {
-webkit-font-smoothing: antialiased;
background: url(../images/arrow-down.png) no-repeat;
font-weight: normal;
text-shadow: rgba(0, 0, 0, 0.4) 0 -1px 0;
padding: 2px 2px 2px 22px;
height: 30px;
}
a.github {
background: url(../images/octocat-small.png) no-repeat 1px;
}
a.buttons:hover {
color: #fff;
text-decoration: none;
}
/* Section - for main page content */
section {
width:650px;
float:right;
padding-bottom:50px;
}
/* Footer */
footer {
width:170px;
float:left;
position:fixed;
bottom:10px;
padding-left: 50px;
}
@media print, screen and (max-width: 960px) {
div.wrapper {
width:auto;
margin:0;
}
header, section, footer {
float:none;
position:static;
width:auto;
}
footer {
border-top: 1px solid #ccc;
margin:0 84px 0 50px;
padding:0;
}
header {
padding-right:320px;
}
section {
padding:20px 84px 20px 50px;
margin:0 0 20px;
}
header a small {
display:inline;
}
header ul {
position:absolute;
right:130px;
top:84px;
}
}
@media print, screen and (max-width: 720px) {
body {
word-wrap:break-word;
}
header {
padding:10px 20px 0;
margin-right: 0;
}
section {
padding:10px 0 10px 20px;
margin:0 0 30px;
}
footer {
margin: 0 0 0 30px;
}
header ul, header p.view {
position:static;
}
}
@media print, screen and (max-width: 480px) {
header ul li.download {
display:none;
}
footer {
margin: 0 0 0 20px;
}
footer a{
display:block;
}
}
@media print {
body {
padding:0.4in;
font-size:12pt;
color:#444;
}
}

View File

@ -1,24 +0,0 @@
# giteapc: version=1 depends=Lephenixnoir/fxsdk,Lephenixnoir/sh-elf-gcc
-include giteapc-config.make
# Use the fxSDK's default paths unless specified otherwise on the command line
LIBDIR ?= $(shell fxsdk path lib)
INCDIR ?= $(shell fxsdk path include)
FLAGS := USEGCC=1 TOOLPREFIX=sh-elf- CC=sh-elf-gcc AR=sh-elf-ar \
libdir="$(LIBDIR)" includedir="$(INCDIR)"
configure:
@ true
build:
@ make $(FLAGS)
install:
@ make $(FLAGS) install-static-superh install-headers-superh
uninstall:
@ echo "uninstall not supported for OpenLibm, skipping"
.PHONY: configure build install uninstall

View File

@ -1,21 +0,0 @@
$(CUR_SRCS) = e_exp.S e_fmod.S e_log.S e_log10.S \
e_remainder.S e_sqrt.S s_ceil.S s_copysign.S \
s_floor.S s_llrint.S s_logb.S s_lrint.S \
s_remquo.S s_rint.S s_tan.S s_trunc.S
ifneq ($(OS), WINNT)
$(CUR_SRCS) += s_scalbn.S s_scalbnf.S s_scalbnl.S
endif
# float counterparts
$(CUR_SRCS)+= e_log10f.S e_logf.S e_remainderf.S \
e_sqrtf.S s_ceilf.S s_copysignf.S s_floorf.S \
s_llrintf.S s_logbf.S s_lrintf.S \
s_remquof.S s_rintf.S s_truncf.S
# long double counterparts
$(CUR_SRCS)+= e_remainderl.S e_sqrtl.S s_ceill.S s_copysignl.S \
s_floorl.S s_llrintl.S \
s_logbl.S s_lrintl.S s_remquol.S s_rintl.S s_truncl.S
$(CUR_SRCS)+= fenv.c

View File

@ -1,118 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* 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.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* from: @(#)DEFS.h 5.1 (Berkeley) 4/23/90
* $FreeBSD: src/sys/i386/include/asm.h,v 1.14 2007/08/22 04:26:07 jkoshy Exp $
*/
#ifndef _MACHINE_ASM_H_
#define _MACHINE_ASM_H_
#if defined(__APPLE__)
#include "osx_asm.h"
#define CNAME(x) EXT(x)
#else
#include "cdefs-compat.h"
#ifdef PIC
#define PIC_PROLOGUE \
pushl %ebx; \
call 1f; \
1: \
popl %ebx; \
addl $_GLOBAL_OFFSET_TABLE_+[.-1b],%ebx
#define PIC_EPILOGUE \
popl %ebx
#define PIC_PLT(x) x@PLT
#define PIC_GOT(x) x@GOT(%ebx)
#else
#define PIC_PROLOGUE
#define PIC_EPILOGUE
#define PIC_PLT(x) x
#define PIC_GOT(x) x
#endif
/*
* CNAME and HIDENAME manage the relationship between symbol names in C
* and the equivalent assembly language names. CNAME is given a name as
* it would be used in a C program. It expands to the equivalent assembly
* language name. HIDENAME is given an assembly-language name, and expands
* to a possibly-modified form that will be invisible to C programs.
*/
/* XXX should use .p2align 4,0x90 for -m486. */
#define _START_ENTRY .p2align 2,0x90
#if defined(__ELF__)
#define CNAME(csym) csym
#define HIDENAME(asmsym) .asmsym
#define _ENTRY(x) .text; _START_ENTRY; \
.globl CNAME(x); .type CNAME(x),@function; CNAME(x):
#define END(x) .size x, . - x
#elif defined(_WIN32)
#ifndef _MSC_VER
#define END(x) .end
#define _START_ENTRY_WIN .text; _START_ENTRY
#else
#define END(x) end
#define _START_ENTRY_WIN .code; _START_ENTRY
#endif
#define CNAME(csym) _##csym
#define HIDENAME(asmsym) .asmsym
#define _ENTRY(x) _START_ENTRY_WIN; \
.globl CNAME(x); .section .drectve; .ascii " -export:", #x; \
.section .text; .def CNAME(x); .scl 2; .type 32; .endef; CNAME(x):
#endif
#ifdef PROF
#define ALTENTRY(x) _ENTRY(x); \
pushl %ebp; movl %esp,%ebp; \
call PIC_PLT(HIDENAME(mcount)); \
popl %ebp; \
jmp 9f
#define ENTRY(x) _ENTRY(x); \
pushl %ebp; movl %esp,%ebp; \
call PIC_PLT(HIDENAME(mcount)); \
popl %ebp; \
9:
#else
#define ALTENTRY(x) _ENTRY(x)
#define ENTRY(x) _ENTRY(x)
#endif
#define RCSID(x) .text; .asciz x
#undef __FBSDID
#define __FBSDID(s) /* nothing */
#endif
#endif /* !_MACHINE_ASM_H_ */

View File

@ -1,265 +0,0 @@
/*-
* Copyright (c) 2003 Peter Wemm.
* Copyright (c) 1990 Andrew Moore, Talke Studio
* 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.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* from: @(#) ieeefp.h 1.0 (Berkeley) 9/23/93
* $FreeBSD$
*/
#ifndef _MACHINE_IEEEFP_H_
#define _MACHINE_IEEEFP_H_
/*
* Deprecated historical FPU control interface
*
* IEEE floating point type, constant and function definitions.
* XXX: FP*FLD and FP*OFF are undocumented pollution.
*/
/* VBS
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
*/
/*
* Rounding modes.
*/
typedef enum {
FP_RN=0, /* round to nearest */
FP_RM, /* round down towards minus infinity */
FP_RP, /* round up towards plus infinity */
FP_RZ /* truncate */
} fp_rnd_t;
/*
* Precision (i.e., rounding precision) modes.
*/
typedef enum {
FP_PS=0, /* 24 bit (single-precision) */
FP_PRS, /* reserved */
FP_PD, /* 53 bit (double-precision) */
FP_PE /* 64 bit (extended-precision) */
} fp_prec_t;
#define fp_except_t int
/*
* Exception bit masks.
*/
#define FP_X_INV 0x01 /* invalid operation */
#define FP_X_DNML 0x02 /* denormal */
#define FP_X_DZ 0x04 /* zero divide */
#define FP_X_OFL 0x08 /* overflow */
#define FP_X_UFL 0x10 /* underflow */
#define FP_X_IMP 0x20 /* (im)precision */
#define FP_X_STK 0x40 /* stack fault */
/*
* FPU control word bit-field masks.
*/
#define FP_MSKS_FLD 0x3f /* exception masks field */
#define FP_PRC_FLD 0x300 /* precision control field */
#define FP_RND_FLD 0xc00 /* rounding control field */
/*
* FPU status word bit-field masks.
*/
#define FP_STKY_FLD 0x3f /* sticky flags field */
/*
* FPU control word bit-field offsets (shift counts).
*/
#define FP_MSKS_OFF 0 /* exception masks offset */
#define FP_PRC_OFF 8 /* precision control offset */
#define FP_RND_OFF 10 /* rounding control offset */
/*
* FPU status word bit-field offsets (shift counts).
*/
#define FP_STKY_OFF 0 /* sticky flags offset */
//VBS
//#ifdef __GNUCLIKE_ASM
#define __fldcw(addr) __asm __volatile("fldcw %0" : : "m" (*(addr)))
#define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr)))
#define __fnclex() __asm __volatile("fnclex")
#define __fnstcw(addr) __asm __volatile("fnstcw %0" : "=m" (*(addr)))
#define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr)))
#define __fnstsw(addr) __asm __volatile("fnstsw %0" : "=m" (*(addr)))
/*
* Load the control word. Be careful not to trap if there is a currently
* unmasked exception (ones that will become freshly unmasked are not a
* problem). This case must be handled by a save/restore of the
* environment or even of the full x87 state. Accessing the environment
* is very inefficient, so only do it when necessary.
*/
static __inline void
__fnldcw(unsigned short _cw, unsigned short _newcw)
{
struct {
unsigned _cw;
unsigned _other[6];
} _env;
unsigned short _sw;
if ((_cw & FP_MSKS_FLD) != FP_MSKS_FLD) {
__fnstsw(&_sw);
if (((_sw & ~_cw) & FP_STKY_FLD) != 0) {
__fnstenv(&_env);
_env._cw = _newcw;
__fldenv(&_env);
return;
}
}
__fldcw(&_newcw);
}
static __inline fp_rnd_t
fpgetround(void)
{
unsigned short _cw;
__fnstcw(&_cw);
return ((fp_rnd_t)((_cw & FP_RND_FLD) >> FP_RND_OFF));
}
static __inline fp_rnd_t
fpsetround(fp_rnd_t _m)
{
fp_rnd_t _p;
unsigned short _cw, _newcw;
__fnstcw(&_cw);
_p = (fp_rnd_t)((_cw & FP_RND_FLD) >> FP_RND_OFF);
_newcw = _cw & ~FP_RND_FLD;
_newcw |= (_m << FP_RND_OFF) & FP_RND_FLD;
__fnldcw(_cw, _newcw);
return (_p);
}
//static __inline fp_prec_t
OLM_DLLEXPORT fp_prec_t
fpgetprec(void)
{
unsigned short _cw;
__fnstcw(&_cw);
return ((fp_prec_t)((_cw & FP_PRC_FLD) >> FP_PRC_OFF));
}
//static __inline fp_prec_t
OLM_DLLEXPORT fp_prec_t
fpsetprec(fp_prec_t _m)
{
fp_prec_t _p;
unsigned short _cw, _newcw;
__fnstcw(&_cw);
_p = (fp_prec_t)((_cw & FP_PRC_FLD) >> FP_PRC_OFF);
_newcw = _cw & ~FP_PRC_FLD;
_newcw |= (_m << FP_PRC_OFF) & FP_PRC_FLD;
__fnldcw(_cw, _newcw);
return (_p);
}
/*
* Get or set the exception mask.
* Note that the x87 mask bits are inverted by the API -- a mask bit of 1
* means disable for x87 and SSE, but for fp*mask() it means enable.
*/
static __inline fp_except_t
fpgetmask(void)
{
unsigned short _cw;
__fnstcw(&_cw);
return ((~_cw & FP_MSKS_FLD) >> FP_MSKS_OFF);
}
static __inline fp_except_t
fpsetmask(fp_except_t _m)
{
fp_except_t _p;
unsigned short _cw, _newcw;
__fnstcw(&_cw);
_p = (~_cw & FP_MSKS_FLD) >> FP_MSKS_OFF;
_newcw = _cw & ~FP_MSKS_FLD;
_newcw |= (~_m << FP_MSKS_OFF) & FP_MSKS_FLD;
__fnldcw(_cw, _newcw);
return (_p);
}
static __inline fp_except_t
fpgetsticky(void)
{
unsigned _ex;
unsigned short _sw;
__fnstsw(&_sw);
_ex = (_sw & FP_STKY_FLD) >> FP_STKY_OFF;
return ((fp_except_t)_ex);
}
static __inline fp_except_t
fpresetsticky(fp_except_t _m)
{
struct {
unsigned _cw;
unsigned _sw;
unsigned _other[5];
} _env;
fp_except_t _p;
_m &= FP_STKY_FLD >> FP_STKY_OFF;
_p = fpgetsticky();
if ((_p & ~_m) == _p)
return (_p);
if ((_p & ~_m) == 0) {
__fnclex();
return (_p);
}
__fnstenv(&_env);
_env._sw &= ~_m;
__fldenv(&_env);
return (_p);
}
//#endif /* __GNUCLIKE_ASM */
#endif /* !_MACHINE_IEEEFP_H_ */

View File

@ -1,160 +0,0 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* 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.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
*
* from: @(#)npx.h 5.3 (Berkeley) 1/18/91
* $FreeBSD: src/sys/i386/include/npx.h,v 1.29.2.1 2006/07/01 00:57:55 davidxu Exp $
*/
/*
* 287/387 NPX Coprocessor Data Structures and Constants
* W. Jolitz 1/90
*/
#ifndef _MACHINE_NPX_H_
#define _MACHINE_NPX_H_
/* Environment information of floating point unit */
struct env87 {
long en_cw; /* control word (16bits) */
long en_sw; /* status word (16bits) */
long en_tw; /* tag word (16bits) */
long en_fip; /* floating point instruction pointer */
unsigned short en_fcs; /* floating code segment selector */
unsigned short en_opcode; /* opcode last executed (11 bits ) */
long en_foo; /* floating operand offset */
long en_fos; /* floating operand segment selector */
};
/* Contents of each floating point accumulator */
struct fpacc87 {
#ifdef dontdef /* too unportable */
unsigned long fp_mantlo; /* mantissa low (31:0) */
unsigned long fp_manthi; /* mantissa high (63:32) */
int fp_exp:15; /* exponent */
int fp_sgn:1; /* mantissa sign */
#else
unsigned char fp_bytes[10];
#endif
};
/* Floating point context */
struct save87 {
struct env87 sv_env; /* floating point control/status */
struct fpacc87 sv_ac[8]; /* accumulator contents, 0-7 */
unsigned char sv_pad0[4]; /* padding for (now unused) saved status word */
/*
* Bogus padding for emulators. Emulators should use their own
* struct and arrange to store into this struct (ending here)
* before it is inspected for ptracing or for core dumps. Some
* emulators overwrite the whole struct. We have no good way of
* knowing how much padding to leave. Leave just enough for the
* GPL emulator's i387_union (176 bytes total).
*/
unsigned char sv_pad[64]; /* padding; used by emulators */
};
struct envxmm {
uint16_t en_cw; /* control word (16bits) */
uint16_t en_sw; /* status word (16bits) */
uint16_t en_tw; /* tag word (16bits) */
uint16_t en_opcode; /* opcode last executed (11 bits ) */
uint32_t en_fip; /* floating point instruction pointer */
uint16_t en_fcs; /* floating code segment selector */
uint16_t en_pad0; /* padding */
uint32_t en_foo; /* floating operand offset */
uint16_t en_fos; /* floating operand segment selector */
uint16_t en_pad1; /* padding */
uint32_t en_mxcsr; /* SSE sontorol/status register */
uint32_t en_mxcsr_mask; /* valid bits in mxcsr */
};
/* Contents of each SSE extended accumulator */
struct xmmacc {
unsigned char xmm_bytes[16];
};
struct savexmm {
struct envxmm sv_env;
struct {
struct fpacc87 fp_acc;
unsigned char fp_pad[6]; /* padding */
} sv_fp[8];
struct xmmacc sv_xmm[8];
unsigned char sv_pad[224];
} __attribute__((__aligned__(16)));
union savefpu {
struct save87 sv_87;
struct savexmm sv_xmm;
};
/*
* The hardware default control word for i387's and later coprocessors is
* 0x37F, giving:
*
* round to nearest
* 64-bit precision
* all exceptions masked.
*
* We modify the affine mode bit and precision bits in this to give:
*
* affine mode for 287's (if they work at all) (1 in bitfield 1<<12)
* 53-bit precision (2 in bitfield 3<<8)
*
* 64-bit precision often gives bad results with high level languages
* because it makes the results of calculations depend on whether
* intermediate values are stored in memory or in FPU registers.
*/
#define __INITIAL_NPXCW__ 0x127F
#define __INITIAL_MXCSR__ 0x1F80
#ifdef _KERNEL
#define IO_NPX 0x0F0 /* Numeric Coprocessor */
#define IO_NPXSIZE 16 /* 80387/80487 NPX registers */
#define IRQ_NPX 13
/* full reset on some systems, NOP on others */
#define npx_full_reset() outb(IO_NPX + 1, 0)
int npxdna(void);
void npxdrop(void);
void npxexit(struct thread *td);
int npxformat(void);
int npxgetregs(struct thread *td, union savefpu *addr);
void npxinit(unsigned short control);
void npxsave(union savefpu *addr);
void npxsetregs(struct thread *td, union savefpu *addr);
int npxtrap(void);
#endif
#endif /* !_MACHINE_NPX_H_ */

View File

@ -1,76 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
/* e^x = 2^(x * log2(e)) */
ENTRY(exp)
/*
* If x is +-Inf, then the subtraction would give Inf-Inf = NaN.
* Avoid this. Also avoid it if x is NaN for convenience.
*/
movl 8(%esp),%eax
andl $0x7fffffff,%eax
cmpl $0x7ff00000,%eax
jae x_Inf_or_NaN
fldl 4(%esp)
/*
* Extended precision is needed to reduce the maximum error from
* hundreds of ulps to less than 1 ulp. Switch to it if necessary.
* We may as well set the rounding mode to to-nearest and mask traps
* if we switch.
*/
fstcw 4(%esp)
movl 4(%esp),%eax
andl $0x0300,%eax
cmpl $0x0300,%eax /* RC == 0 && PC == 3? */
je 1f /* jump if mode is good */
movl $0x137f,8(%esp)
fldcw 8(%esp)
1:
fldl2e
fmulp /* x * log2(e) */
fst %st(1)
frndint /* int(x * log2(e)) */
fst %st(2)
fsubrp /* fract(x * log2(e)) */
f2xm1 /* 2^(fract(x * log2(e))) - 1 */
fld1
faddp /* 2^(fract(x * log2(e))) */
fscale /* e^x */
fstp %st(1)
je 1f
fldcw 4(%esp)
1:
ret
x_Inf_or_NaN:
/*
* Return 0 if x is -Inf. Otherwise just return x; when x is Inf
* this gives Inf, and when x is a NaN this gives the same result
* as (x + x) (x quieted).
*/
cmpl $0xfff00000,8(%esp)
jne x_not_minus_Inf
cmpl $0,4(%esp)
jne x_not_minus_Inf
fldz
ret
x_not_minus_Inf:
fldl 4(%esp)
ret
END(exp)
//
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,25 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/e_fmod.S,v 1.11 2011/01/07 16:13:12 kib Exp $")
ENTRY(fmod)
fldl 12(%esp)
fldl 4(%esp)
1: fprem
fstsw %ax
sahf
jp 1b
fstp %st(1)
ret
END(fmod)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,21 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/e_log.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
ENTRY(log)
fldln2
fldl 4(%esp)
fyl2x
ret
END(log)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,21 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/e_log10.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
ENTRY(log10)
fldlg2
fldl 4(%esp)
fyl2x
ret
END(log10)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,22 +0,0 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/e_log10f.S,v 1.4 2011/01/07 16:13:12 kib Exp $");
/* RCSID("$NetBSD: e_log10f.S,v 1.1 1996/07/03 16:50:22 jtc Exp $") */
ENTRY(log10f)
fldlg2
flds 4(%esp)
fyl2x
ret
END(log10f)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,21 +0,0 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/e_logf.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
/* RCSID("$NetBSD: e_logf.S,v 1.2 1996/07/06 00:15:45 jtc Exp $") */
ENTRY(logf)
fldln2
flds 4(%esp)
fyl2x
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,25 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/e_remainder.S,v 1.11 2011/01/07 16:13:12 kib Exp $")
ENTRY(remainder)
fldl 12(%esp)
fldl 4(%esp)
1: fprem1
fstsw %ax
sahf
jp 1b
fstp %st(1)
ret
END(remainder)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,26 +0,0 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/e_remainderf.S,v 1.4 2011/01/07 16:13:12 kib Exp $");
/* RCSID("$NetBSD: e_remainderf.S,v 1.2 1995/05/08 23:49:47 jtc Exp $") */
ENTRY(remainderf)
flds 8(%esp)
flds 4(%esp)
1: fprem1
fstsw %ax
sahf
jp 1b
fstp %st(1)
ret
END(remainderf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,25 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/e_remainderl.S,v 1.2 2011/01/07 16:13:12 kib Exp $")
ENTRY(remainderl)
fldt 16(%esp)
fldt 4(%esp)
1: fprem1
fstsw %ax
sahf
jp 1b
fstp %st(1)
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,20 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/e_sqrt.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
ENTRY(sqrt)
fldl 4(%esp)
fsqrt
ret
END(sqrt)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,21 +0,0 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/e_sqrtf.S,v 1.4 2011/01/07 16:13:12 kib Exp $");
/* RCSID("$NetBSD: e_sqrtf.S,v 1.2 1995/05/08 23:50:14 jtc Exp $") */
ENTRY(sqrtf)
flds 4(%esp)
fsqrt
ret
END(sqrtf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,19 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/e_sqrtl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
ENTRY(sqrtl)
fldt 4(%esp)
fsqrt
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,226 +0,0 @@
/*-
* Copyright (c) 2004-2005 David Schultz <das@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: src/lib/msun/i387/fenv.c,v 1.8 2011/10/21 06:25:31 das Exp $
*/
#include "cdefs-compat.h"
#include "types-compat.h"
#include "math_private.h"
#include "i387/bsd_npx.h"
#define __fenv_static
#include <openlibm_fenv.h>
#ifdef __GNUC_GNU_INLINE__
#error "This file must be compiled with C99 'inline' semantics"
#endif
const fenv_t __fe_dfl_env = {
__INITIAL_NPXCW__,
0x0000,
0x0000,
0x1f80,
0xffffffff,
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }
};
enum __sse_support __has_sse =
#ifdef __SSE__
__SSE_YES;
#else
__SSE_UNK;
#endif
#define getfl(x) __asm __volatile("pushfl\n\tpopl %0" : "=mr" (*(x)))
#define setfl(x) __asm __volatile("pushl %0\n\tpopfl" : : "g" (x))
#define cpuid_dx(x) __asm __volatile("pushl %%ebx\n\tmovl $1, %%eax\n\t" \
"cpuid\n\tpopl %%ebx" \
: "=d" (*(x)) : : "eax", "ecx")
/*
* Test for SSE support on this processor. We need to do this because
* we need to use ldmxcsr/stmxcsr to get correct results if any part
* of the program was compiled to use SSE floating-point, but we can't
* use SSE on older processors.
*/
int
__test_sse(void)
{
int flag, nflag;
int dx_features;
/* Am I a 486? */
getfl(&flag);
nflag = flag ^ 0x200000;
setfl(nflag);
getfl(&nflag);
if (flag != nflag) {
/* Not a 486, so CPUID should work. */
cpuid_dx(&dx_features);
if (dx_features & 0x2000000) {
__has_sse = __SSE_YES;
return (1);
}
}
__has_sse = __SSE_NO;
return (0);
}
extern inline OLM_DLLEXPORT int feclearexcept(int __excepts);
extern inline OLM_DLLEXPORT int fegetexceptflag(fexcept_t *__flagp, int __excepts);
OLM_DLLEXPORT int
fesetexceptflag(const fexcept_t *flagp, int excepts)
{
fenv_t env;
uint32_t mxcsr;
__fnstenv(&env);
env.__status &= ~excepts;
env.__status |= *flagp & excepts;
__fldenv(env);
if (__HAS_SSE()) {
__stmxcsr(&mxcsr);
mxcsr &= ~excepts;
mxcsr |= *flagp & excepts;
__ldmxcsr(mxcsr);
}
return (0);
}
OLM_DLLEXPORT int
feraiseexcept(int excepts)
{
fexcept_t ex = excepts;
fesetexceptflag(&ex, excepts);
__fwait();
return (0);
}
extern inline OLM_DLLEXPORT int fetestexcept(int __excepts);
extern inline OLM_DLLEXPORT int fegetround(void);
extern inline OLM_DLLEXPORT int fesetround(int __round);
int
fegetenv(fenv_t *envp)
{
uint32_t mxcsr;
__fnstenv(envp);
/*
* fnstenv masks all exceptions, so we need to restore
* the old control word to avoid this side effect.
*/
__fldcw(envp->__control);
if (__HAS_SSE()) {
__stmxcsr(&mxcsr);
__set_mxcsr(*envp, mxcsr);
}
return (0);
}
int
feholdexcept(fenv_t *envp)
{
uint32_t mxcsr;
__fnstenv(envp);
__fnclex();
if (__HAS_SSE()) {
__stmxcsr(&mxcsr);
__set_mxcsr(*envp, mxcsr);
mxcsr &= ~FE_ALL_EXCEPT;
mxcsr |= FE_ALL_EXCEPT << _SSE_EMASK_SHIFT;
__ldmxcsr(mxcsr);
}
return (0);
}
extern inline OLM_DLLEXPORT int fesetenv(const fenv_t *__envp);
OLM_DLLEXPORT int
feupdateenv(const fenv_t *envp)
{
uint32_t mxcsr;
uint16_t status;
__fnstsw(&status);
if (__HAS_SSE())
__stmxcsr(&mxcsr);
else
mxcsr = 0;
fesetenv(envp);
feraiseexcept((mxcsr | status) & FE_ALL_EXCEPT);
return (0);
}
int
feenableexcept(int mask)
{
uint32_t mxcsr, omask;
uint16_t control;
mask &= FE_ALL_EXCEPT;
__fnstcw(&control);
if (__HAS_SSE())
__stmxcsr(&mxcsr);
else
mxcsr = 0;
omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
control &= ~mask;
__fldcw(control);
if (__HAS_SSE()) {
mxcsr &= ~(mask << _SSE_EMASK_SHIFT);
__ldmxcsr(mxcsr);
}
return (omask);
}
int
fedisableexcept(int mask)
{
uint32_t mxcsr, omask;
uint16_t control;
mask &= FE_ALL_EXCEPT;
__fnstcw(&control);
if (__HAS_SSE())
__stmxcsr(&mxcsr);
else
mxcsr = 0;
omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
control |= mask;
__fldcw(control);
if (__HAS_SSE()) {
mxcsr |= mask << _SSE_EMASK_SHIFT;
__ldmxcsr(mxcsr);
}
return (omask);
}

View File

@ -1,86 +0,0 @@
/*-
* Copyright (c) 2008 David Schultz <das@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.
*/
#include <sys/cdefs.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/invtrig.c,v 1.1 2008/08/02 03:56:22 das Exp $");
#include <stdint.h>
#define STRUCT_DECLS
#include "invtrig.h"
/*
* asinl() and acosl()
*/
const LONGDOUBLE
pS0 = { 0xaaaaaaaaaaaaaaa8ULL, 0x3ffcU }, /* 1.66666666666666666631e-01L */
pS1 = { 0xd5271b6699b48bfaULL, 0xbffdU }, /* -4.16313987993683104320e-01L */
pS2 = { 0xbcf67ca9e9f669cfULL, 0x3ffdU }, /* 3.69068046323246813704e-01L */
pS3 = { 0x8b7baa3d15f9830dULL, 0xbffcU }, /* -1.36213932016738603108e-01L */
pS4 = { 0x92154b093a3bff1cULL, 0x3ff9U }, /* 1.78324189708471965733e-02L */
pS5 = { 0xe5dd76401964508cULL, 0xbff2U }, /* -2.19216428382605211588e-04L */
pS6 = { 0xee69c5b0fdb76951ULL, 0xbfedU }, /* -7.10526623669075243183e-06L */
qS1 = { 0xbcaa2159c01436a0ULL, 0xc000U }, /* -2.94788392796209867269e+00L */
qS2 = { 0xd17a73d1e1564c29ULL, 0x4000U }, /* 3.27309890266528636716e+00L */
qS3 = { 0xd767e411c9cf4c2cULL, 0xbfffU }, /* -1.68285799854822427013e+00L */
qS4 = { 0xc809c0dfb9b0d0b7ULL, 0x3ffdU }, /* 3.90699412641738801874e-01L */
qS5 = { 0x80c3a2197c8ced57ULL, 0xbffaU }; /* -3.14365703596053263322e-02L */
/*
* atanl()
*/
const LONGDOUBLE atanhi[] = {
{ 0xed63382b0dda7b45ULL, 0x3ffdU }, /* 4.63647609000806116202e-01L */
{ 0xc90fdaa22168c235ULL, 0x3ffeU }, /* 7.85398163397448309628e-01L */
{ 0xfb985e940fb4d900ULL, 0x3ffeU }, /* 9.82793723247329067960e-01L */
{ 0xc90fdaa22168c235ULL, 0x3fffU }, /* 1.57079632679489661926e+00L */
};
const LONGDOUBLE atanlo[] = {
{ 0xdfc88bd978751a07ULL, 0x3fbcU }, /* 1.18469937025062860669e-20L */
{ 0xece675d1fc8f8cbbULL, 0xbfbcU }, /* -1.25413940316708300586e-20L */
{ 0xf10f5e197793c283ULL, 0x3fbdU }, /* 2.55232234165405176172e-20L */
{ 0xece675d1fc8f8cbbULL, 0xbfbdU }, /* -2.50827880633416601173e-20L */
};
const LONGDOUBLE aT[] = {
{ 0xaaaaaaaaaaaaaa9fULL, 0x3ffdU }, /* 3.33333333333333333017e-01L */
{ 0xcccccccccccc62bcULL, 0xbffcU }, /* -1.99999999999999632011e-01L */
{ 0x9249249248b81e3fULL, 0x3ffcU }, /* 1.42857142857046531280e-01L */
{ 0xe38e38e3316f3de5ULL, 0xbffbU }, /* -1.11111111100562372733e-01L */
{ 0xba2e8b8dc280726aULL, 0x3ffbU }, /* 9.09090902935647302252e-02L */
{ 0x9d89d5b4c6847ec4ULL, 0xbffbU }, /* -7.69230552476207730353e-02L */
{ 0x8888461d3099c677ULL, 0x3ffbU }, /* 6.66661718042406260546e-02L */
{ 0xf0e8ee0f5328dc29ULL, 0xbffaU }, /* -5.88158892835030888692e-02L */
{ 0xd73ea84d24bae54aULL, 0x3ffaU }, /* 5.25499891539726639379e-02L */
{ 0xc08fa381dcd9213aULL, 0xbffaU }, /* -4.70119845393155721494e-02L */
{ 0xa54a26f4095f2a3aULL, 0x3ffaU }, /* 4.03539201366454414072e-02L */
{ 0xeea2d8d059ef3ad6ULL, 0xbff9U }, /* -2.91303858419364158725e-02L */
{ 0xcc82292ab894b051ULL, 0x3ff8U }, /* 1.24822046299269234080e-02L */
};
const LONGDOUBLE
pi_lo = { 0xece675d1fc8f8cbbULL, 0xbfbeU }; /* -5.01655761266833202345e-20L */

View File

@ -1,408 +0,0 @@
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
#ifndef _I386_ASM_H_
#define _I386_ASM_H_
#ifdef _KERNEL
#include <gprof.h>
#endif /* _KERNEL */
#ifdef MACH_KERNEL
#include <mach_kdb.h>
#else /* !MACH_KERNEL */
#define MACH_KDB 0
#endif /* !MACH_KERNEL */
#if defined(MACH_KERNEL) || defined(_KERNEL)
#include <gprof.h>
#endif /* MACH_KERNEL || _KERNEL */
#if defined(__i386__)
#define S_PC (%esp)
#define S_ARG0 4(%esp)
#define S_ARG1 8(%esp)
#define S_ARG2 12(%esp)
#define S_ARG3 16(%esp)
#define S_ARG4 20(%esp)
#define FRAME pushl %ebp; movl %esp, %ebp
#define EMARF leave
#define B_LINK (%ebp)
#define B_PC 4(%ebp)
#define B_ARG0 8(%ebp)
#define B_ARG1 12(%ebp)
#define B_ARG2 16(%ebp)
#define B_ARG3 20(%ebp)
#elif defined(__x86_64__)
#define S_PC (%rsp)
#define FRAME pushq %rbp; movq %rsp, %rbp
#define EMARF leave
#define B_LINK (%rbp)
#define B_PC 8(%rbp)
#else
#error unsupported architecture
#endif
/* There is another definition of ALIGN for .c sources */
#ifdef ASSEMBLER
#define ALIGN 4,0x90
#endif /* ASSEMBLER */
#ifndef FALIGN
#define FALIGN ALIGN
#endif
#define LB(x,n) n
#if __STDC__
#ifndef __NO_UNDERSCORES__
#define LCL(x) L ## x
#define EXT(x) _ ## x
#define LEXT(x) _ ## x ## :
#else
#define LCL(x) .L ## x
#define EXT(x) x
#define LEXT(x) x ## :
#endif
#define LBc(x,n) n ## :
#define LBb(x,n) n ## b
#define LBf(x,n) n ## f
#else /* __STDC__ */
#ifndef __NO_UNDERSCORES__
#define LCL(x) L/**/x
#define EXT(x) _/**/x
#define LEXT(x) _/**/x/**/:
#else /* __NO_UNDERSCORES__ */
#define LCL(x) .L/**/x
#define EXT(x) x
#define LEXT(x) x/**/:
#endif /* __NO_UNDERSCORES__ */
#define LBc(x,n) n/**/:
#define LBb(x,n) n/**/b
#define LBf(x,n) n/**/f
#endif /* __STDC__ */
#define SVC .byte 0x9a; .long 0; .word 0x7
#define RPC_SVC .byte 0x9a; .long 0; .word 0xf
#define String .asciz
#define Value .word
#define Times(a,b) (a*b)
#define Divide(a,b) (a/b)
#define INB inb %dx, %al
#define OUTB outb %al, %dx
#define INL inl %dx, %eax
#define OUTL outl %eax, %dx
#define data16 .byte 0x66
#define addr16 .byte 0x67
#if !GPROF
#define MCOUNT
#elif defined(__SHARED__)
#define MCOUNT ; .data;\
.align ALIGN;\
LBc(x, 8) .long 0;\
.text;\
Gpush;\
Gload;\
leal Gotoff(LBb(x,8)),%edx;\
Egaddr(%eax,_mcount_ptr);\
Gpop;\
call *(%eax);
#else /* !GPROF, !__SHARED__ */
#define MCOUNT ; call mcount;
#endif /* GPROF */
#ifdef __ELF__
#define ELF_FUNC(x) .type x,@function
#define ELF_DATA(x) .type x,@object
#define ELF_SIZE(x,s) .size x,s
#else
#define ELF_FUNC(x)
#define ELF_DATA(x)
#define ELF_SIZE(x,s)
#endif
#define Entry(x) .globl EXT(x); ELF_FUNC(EXT(x)); .align FALIGN; LEXT(x)
#define ENTRY(x) Entry(x) MCOUNT
#define ENTRY2(x,y) .globl EXT(x); .globl EXT(y); \
ELF_FUNC(EXT(x)); ELF_FUNC(EXT(y)); \
.align FALIGN; LEXT(x); LEXT(y) \
MCOUNT
#if __STDC__
#define ASENTRY(x) .globl x; .align FALIGN; x ## : ELF_FUNC(x) MCOUNT
#else
#define ASENTRY(x) .globl x; .align FALIGN; x: ELF_FUNC(x) MCOUNT
#endif /* __STDC__ */
#define DATA(x) .globl EXT(x); ELF_DATA(EXT(x)); .align ALIGN; LEXT(x)
#define End(x) ELF_SIZE(x,.-x)
#define END(x) End(EXT(x))
#define ENDDATA(x) END(x)
#define Enddata(x) End(x)
/*
* ELF shared library accessor macros.
* Gpush saves the %ebx register used for the GOT address
* Gpop pops %ebx if we need a GOT
* Gload loads %ebx with the GOT address if shared libraries are used
* Gcall calls an external function.
* Gotoff allows you to reference local labels.
* Gotoff2 allows you to reference local labels with an index reg.
* Gotoff3 allows you to reference local labels with an index reg & size.
* Gaddr loads up a register with an address of an external item.
* Gstack is the number of bytes that Gpush pushes on the stack.
*
* Varients of the above with E or L prefixes do EXT(name) or LCL(name)
* respectively.
*/
#ifndef __SHARED__
#define Gpush
#define Gpop
#define Gload
#define Gcall(func) call func
#define Gotoff(lab) lab
#define Gotoff2(l,r) l(r)
#define Gotoff3(l,r,s) l(,r,s)
#define Gaddr(to,lab) movl $lab,to
#define Gcmp(lab,reg) cmpl $lab,reg
#define Gmemload(lab,reg) movl lab,reg
#define Gmemstore(reg,lab,tmp) movl reg,lab
#define Gstack 0
#else
#ifdef __ELF__ /* ELF shared libraries */
#define Gpush pushl %ebx
#define Gpop popl %ebx
#define Gload call 9f; 9: popl %ebx; addl $_GLOBAL_OFFSET_TABLE_+[.-9b],%ebx
#define Gcall(func) call EXT(func)@PLT
#define Gotoff(lab) lab@GOTOFF(%ebx)
#define Gotoff2(l,r) l@GOTOFF(%ebx,r)
#define Gotoff3(l,r,s) l@GOTOFF(%ebx,r,s)
#define Gaddr(to,lab) movl lab@GOT(%ebx),to
#define Gcmp(lab,reg) cmpl reg,lab@GOT(%ebx)
#define Gmemload(lab,reg) movl lab@GOT(%ebx),reg; movl (reg),reg
#define Gmemstore(reg,lab,tmp) movl lab@GOT(%ebx),tmp; movl reg,(tmp)
#define Gstack 4
#else /* ROSE shared libraries */
#define Gpush
#define Gpop
#define Gload
#define Gcall(func) call *9f; .data; .align ALIGN; 9: .long func; .text
#define Gotoff(lab) lab
#define Gotoff2(l,r) l(r)
#define Gotoff3(l,r,s) l(,r,s)
#define Gaddr(to,lab) movl 9f,to; .data; .align ALIGN; 9: .long lab; .text
#define Gcmp(lab,reg) cmpl reg,9f; .data; .align ALIGN; 9: .long lab; .text
#define Gmemload(lab,reg) movl 9f,reg; movl (reg),reg; .data; .align ALIGN; 9: .long lab; .text
#define Gmemstore(reg,lab,tmp) movl 9f,tmp; movl reg,(tmp); .data; .align ALIGN; 9: .long lab; .text
#define Gstack 0
#endif /* __ELF__ */
#endif /* __SHARED__ */
/* Egotoff is not provided, since external symbols should not use @GOTOFF
relocations. */
#define Egcall(func) Gcall(EXT(func))
#define Egaddr(to,lab) Gaddr(to,EXT(lab))
#define Egcmp(lab,reg) Gcmp(EXT(lab),reg)
#define Egmemload(lab,reg) Gmemload(EXT(lab),reg)
#define Egmemstore(reg,lab,tmp) Gmemstore(reg,EXT(lab),tmp)
#define Lgotoff(lab) Gotoff(LCL(lab))
#define Lgotoff2(l,r) Gotoff2(LCL(l),r)
#define Lgotoff3(l,r,s) Gotoff3(LCL(l),r,s)
#define Lgcmp(lab,reg) Gcmp(LCL(lab),reg)
#define Lgmemload(lab,reg) movl Lgotoff(lab),reg
#define Lgmemstore(reg,lab,tmp) movl reg,Lgotoff(lab)
#ifdef ASSEMBLER
#if MACH_KDB
#include <ddb/stab.h>
/*
* This pseudo-assembler line is added so that there will be at least
* one N_SO entry in the symbol stable to define the current file name.
*/
#endif /* MACH_KDB */
#else /* NOT ASSEMBLER */
/* These defines are here for .c files that wish to reference global symbols
* within __asm__ statements.
*/
#ifndef __NO_UNDERSCORES__
#define CC_SYM_PREFIX "_"
#else
#define CC_SYM_PREFIX ""
#endif /* __NO_UNDERSCORES__ */
#endif /* ASSEMBLER */
/*
* The following macros make calls into C code.
* They dynamically align the stack to 16 bytes.
*/
#if defined(__i386__)
/*
* Arguments are moved (not pushed) onto the correctly aligned stack.
* NOTE: ESI is destroyed in the process, and hence cannot
* be directly used as a parameter. Users of this macro must
* independently preserve ESI (a non-volatile) if the routine is
* intended to be called from C, for instance.
*/
#define CCALL(fn) \
movl %esp, %esi ;\
andl $0xFFFFFFF0, %esp ;\
call EXT(fn) ;\
movl %esi, %esp
#define CCALL1(fn, arg1) \
movl %esp, %esi ;\
subl $4, %esp ;\
andl $0xFFFFFFF0, %esp ;\
movl arg1, (%esp) ;\
call EXT(fn) ;\
movl %esi, %esp
#define CCALL2(fn, arg1, arg2) \
movl %esp, %esi ;\
subl $8, %esp ;\
andl $0xFFFFFFF0, %esp ;\
movl arg2, 4(%esp) ;\
movl arg1, (%esp) ;\
call EXT(fn) ;\
movl %esi, %esp
/* This variant exists to permit adjustment of the stack by "dtrace" */
#define CCALL1WITHSP(fn, arg1) \
movl %esp, %esi ;\
subl $12, %esp ;\
andl $0xFFFFFFF0, %esp ;\
movl %esi, 8(%esp) ;\
leal 8(%esp), %esi ;\
movl %esi, 4(%esp) ;\
movl arg1, (%esp) ;\
call EXT(fn) ;\
movl 8(%esp), %esp
/*
* CCALL5 is used for callee functions with 3 arguments but
* where arg2 (a3:a2) and arg3 (a5:a4) are 64-bit values.
*/
#define CCALL5(fn, a1, a2, a3, a4, a5) \
movl %esp, %esi ;\
subl $20, %esp ;\
andl $0xFFFFFFF0, %esp ;\
movl a5, 16(%esp) ;\
movl a4, 12(%esp) ;\
movl a3, 8(%esp) ;\
movl a2, 4(%esp) ;\
movl a1, (%esp) ;\
call EXT(fn) ;\
movl %esi, %esp
#elif defined(__x86_64__)
/* This variant exists to permit adjustment of the stack by "dtrace" */
#define CCALLWITHSP(fn) \
mov %rsp, %r12 ;\
sub $8, %rsp ;\
and $0xFFFFFFFFFFFFFFF0, %rsp ;\
mov %r12, (%rsp) ;\
leaq (%rsp), %rsi ;\
call EXT(fn) ;\
mov (%rsp), %rsp
#define CCALL(fn) \
mov %rsp, %r12 ;\
and $0xFFFFFFFFFFFFFFF0, %rsp ;\
call EXT(fn) ;\
mov %r12, %rsp
#define CCALL1(fn, arg1) \
mov arg1, %rdi ;\
CCALL(fn)
#define CCALL2(fn, arg1, arg2) \
mov arg1, %rdi ;\
CCALL(fn)
#define CCALL3(fn, arg1, arg2, arg3) \
mov arg1, %rdi ;\
mov arg2, %rsi ;\
mov arg3, %rdx ;\
CCALL(fn)
#else
#error unsupported architecture
#endif
#endif /* _I386_ASM_H_ */

View File

@ -1,34 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
ENTRY(ceil)
pushl %ebp
movl %esp,%ebp
subl $8,%esp
fstcw -4(%ebp) /* store fpu control word */
movw -4(%ebp),%dx
orw $0x0800,%dx /* round towards +oo */
andw $0xfbff,%dx
movw %dx,-8(%ebp)
fldcw -8(%ebp) /* load modfied control word */
fldl 8(%ebp); /* round */
frndint
fldcw -4(%ebp) /* restore original control word */
leave
ret
END(ceil)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,36 +0,0 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_ceilf.S,v 1.4 2011/01/07 16:13:12 kib Exp $");
/* RCSID("$NetBSD: s_ceilf.S,v 1.3 1995/05/08 23:52:44 jtc Exp $") */
ENTRY(ceilf)
pushl %ebp
movl %esp,%ebp
subl $8,%esp
fstcw -4(%ebp) /* store fpu control word */
movw -4(%ebp),%dx
orw $0x0800,%dx /* round towards +oo */
andw $0xfbff,%dx
movw %dx,-8(%ebp)
fldcw -8(%ebp) /* load modfied control word */
flds 8(%ebp); /* round */
frndint
fldcw -4(%ebp) /* restore original control word */
leave
ret
END(ceilf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,34 +0,0 @@
/*
* Based on code written by J.T. Conklin <jtc@NetBSD.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_ceill.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
ENTRY(ceill)
pushl %ebp
movl %esp,%ebp
subl $8,%esp
fstcw -4(%ebp) /* store fpu control word */
movw -4(%ebp),%dx
orw $0x0800,%dx /* round towards +oo */
andw $0xfbff,%dx
movw %dx,-8(%ebp)
fldcw -8(%ebp) /* load modfied control word */
fldt 8(%ebp) /* round */
frndint
fldcw -4(%ebp) /* restore original control word */
leave
ret
END(ceill)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,25 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_copysign.S,v 1.9 2011/01/07 16:13:12 kib Exp $")
ENTRY(copysign)
movl 16(%esp),%edx
andl $0x80000000,%edx
movl 8(%esp),%eax
andl $0x7fffffff,%eax
orl %edx,%eax
movl %eax,8(%esp)
fldl 4(%esp)
ret
END(copysign)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,26 +0,0 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_copysignf.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
/* RCSID("$NetBSD: s_copysignf.S,v 1.3 1995/05/08 23:53:25 jtc Exp $") */
ENTRY(copysignf)
movl 8(%esp),%edx
andl $0x80000000,%edx
movl 4(%esp),%eax
andl $0x7fffffff,%eax
orl %edx,%eax
movl %eax,4(%esp)
flds 4(%esp)
ret
END(copysignf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,24 +0,0 @@
/*
* Based on code written by J.T. Conklin <jtc@NetBSD.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_copysignl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
ENTRY(copysignl)
movl 24(%esp),%edx
andl $0x8000,%edx
movl 12(%esp),%eax
andl $0x7fff,%eax
orl %edx,%eax
movl %eax,12(%esp)
fldt 4(%esp)
ret
END(copysignl)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,33 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_cos.S,v 1.9 2011/01/07 16:13:12 kib Exp $")
ENTRY(cos)
fldl 4(%esp)
fcos
fnstsw %ax
andw $0x400,%ax
jnz 1f
ret
1: fldpi
fadd %st(0)
fxch %st(1)
2: fprem1
fnstsw %ax
andw $0x400,%ax
jnz 2b
fstp %st(1)
fcos
ret
END(cos)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,35 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_floor.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
ENTRY(floor)
pushl %ebp
movl %esp,%ebp
subl $8,%esp
fstcw -4(%ebp) /* store fpu control word */
movw -4(%ebp),%dx
orw $0x0400,%dx /* round towards -oo */
andw $0xf7ff,%dx
movw %dx,-8(%ebp)
fldcw -8(%ebp) /* load modfied control word */
fldl 8(%ebp); /* round */
frndint
fldcw -4(%ebp) /* restore original control word */
leave
ret
END(floor)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,36 +0,0 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_floorf.S,v 1.4 2011/01/07 16:13:12 kib Exp $");
/* RCSID("$NetBSD: s_floorf.S,v 1.3 1995/05/09 00:04:32 jtc Exp $") */
ENTRY(floorf)
pushl %ebp
movl %esp,%ebp
subl $8,%esp
fstcw -4(%ebp) /* store fpu control word */
movw -4(%ebp),%dx
orw $0x0400,%dx /* round towards -oo */
andw $0xf7ff,%dx
movw %dx,-8(%ebp)
fldcw -8(%ebp) /* load modfied control word */
flds 8(%ebp); /* round */
frndint
fldcw -4(%ebp) /* restore original control word */
leave
ret
END(floorf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,34 +0,0 @@
/*
* Based on code written by J.T. Conklin <jtc@NetBSD.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_floorl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
ENTRY(floorl)
pushl %ebp
movl %esp,%ebp
subl $8,%esp
fstcw -4(%ebp) /* store fpu control word */
movw -4(%ebp),%dx
orw $0x0400,%dx /* round towards -oo */
andw $0xf7ff,%dx
movw %dx,-8(%ebp)
fldcw -8(%ebp) /* load modfied control word */
fldt 8(%ebp) /* round */
frndint
fldcw -4(%ebp) /* restore original control word */
leave
ret
END(floorl)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,43 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_llrint.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
ENTRY(llrint)
fldl 4(%esp)
subl $8,%esp
fistpll (%esp)
popl %eax
popl %edx
ret
END(llrint)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,43 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_llrintf.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
ENTRY(llrintf)
flds 4(%esp)
subl $8,%esp
fistpll (%esp)
popl %eax
popl %edx
ret
END(llrintf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,42 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_llrintl.S,v 1.2 2011/01/07 16:13:12 kib Exp $");
ENTRY(llrintl)
fldt 4(%esp)
subl $8,%esp
fistpll (%esp)
popl %eax
popl %edx
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,21 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_logb.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
ENTRY(logb)
fldl 4(%esp)
fxtract
fstp %st
ret
END(logb)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,22 +0,0 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_logbf.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
/* RCSID("$NetBSD: s_logbf.S,v 1.3 1995/05/09 00:15:12 jtc Exp $") */
ENTRY(logbf)
flds 4(%esp)
fxtract
fstp %st
ret
END(logbf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,20 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_logbl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
ENTRY(logbl)
fldt 4(%esp)
fxtract
fstp %st
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,42 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_lrint.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
ENTRY(lrint)
fldl 4(%esp)
subl $4,%esp
fistpl (%esp)
popl %eax
ret
END(lrint)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,42 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_lrintf.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
ENTRY(lrintf)
flds 4(%esp)
subl $4,%esp
fistpl (%esp)
popl %eax
ret
END(lrintf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,41 +0,0 @@
/*-
* Copyright (c) 2008 David Schultz <das@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.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_lrintl.S,v 1.2 2011/01/07 16:13:12 kib Exp $");
ENTRY(lrintl)
fldt 4(%esp)
subl $4,%esp
fistpl (%esp)
popl %eax
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,69 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
/*
* Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_remquo.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
ENTRY(remquo)
fldl 12(%esp)
fldl 4(%esp)
1: fprem1
fstsw %ax
sahf
jp 1b
fstp %st(1)
/* Extract the three low-order bits of the quotient from C0,C3,C1. */
shrl $6,%eax
movl %eax,%ecx
andl $0x108,%eax
rorl $7,%eax
orl %eax,%ecx
roll $4,%eax
orl %ecx,%eax
andl $7,%eax
/* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */
movl 16(%esp),%ecx
xorl 8(%esp),%ecx
sarl $16,%ecx
sarl $16,%ecx
xorl %ecx,%eax
andl $1,%ecx
addl %ecx,%eax
/* Store the quotient and return. */
movl 20(%esp),%ecx
movl %eax,(%ecx)
ret
END(remquo)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,69 +0,0 @@
/*-
* Copyright (c) 2005 David Schultz <das@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.
*/
/*
* Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_remquof.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
ENTRY(remquof)
flds 8(%esp)
flds 4(%esp)
1: fprem1
fstsw %ax
sahf
jp 1b
fstp %st(1)
/* Extract the three low-order bits of the quotient from C0,C3,C1. */
shrl $6,%eax
movl %eax,%ecx
andl $0x108,%eax
rorl $7,%eax
orl %eax,%ecx
roll $4,%eax
orl %ecx,%eax
andl $7,%eax
/* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */
movl 8(%esp),%ecx
xorl 4(%esp),%ecx
sarl $16,%ecx
sarl $16,%ecx
xorl %ecx,%eax
andl $1,%ecx
addl %ecx,%eax
/* Store the quotient and return. */
movl 12(%esp),%ecx
movl %eax,(%ecx)
ret
END(remquof)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,69 +0,0 @@
/*-
* Copyright (c) 2005-2008 David Schultz <das@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.
*/
/*
* Based on public-domain remainder routine by J.T. Conklin <jtc@NetBSD.org>.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_remquol.S,v 1.2 2011/01/07 16:13:12 kib Exp $");
ENTRY(remquol)
fldt 16(%esp)
fldt 4(%esp)
1: fprem1
fstsw %ax
sahf
jp 1b
fstp %st(1)
/* Extract the three low-order bits of the quotient from C0,C3,C1. */
shrl $6,%eax
movl %eax,%ecx
andl $0x108,%eax
rorl $7,%eax
orl %eax,%ecx
roll $4,%eax
orl %ecx,%eax
andl $7,%eax
/* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */
movl 24(%esp),%ecx
xorl 12(%esp),%ecx
movsx %cx,%ecx
sarl $16,%ecx
sarl $16,%ecx
xorl %ecx,%eax
andl $1,%ecx
addl %ecx,%eax
/* Store the quotient and return. */
movl 28(%esp),%ecx
movl %eax,(%ecx)
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,20 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_rint.S,v 1.9 2011/01/07 16:13:12 kib Exp $")
ENTRY(rint)
fldl 4(%esp)
frndint
ret
END(rint)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,21 +0,0 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_rintf.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
/* RCSID("$NetBSD: s_rintf.S,v 1.3 1995/05/09 00:17:22 jtc Exp $") */
ENTRY(rintf)
flds 4(%esp)
frndint
ret
END(rintf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,19 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_rintl.S,v 1.3 2011/01/07 16:13:12 kib Exp $")
ENTRY(rintl)
fldt 4(%esp)
frndint
ret
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,23 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_scalbn.S,v 1.10 2011/01/07 16:13:12 kib Exp $")
ENTRY(scalbn)
fildl 12(%esp)
fldl 4(%esp)
fscale
fstp %st(1)
ret
END(scalbn)
.globl CNAME(ldexp)
.set CNAME(ldexp),CNAME(scalbn)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,26 +0,0 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_scalbnf.S,v 1.4 2011/01/07 16:13:12 kib Exp $");
/* RCSID("$NetBSD: s_scalbnf.S,v 1.4 1999/01/02 05:15:40 kristerw Exp $") */
ENTRY(scalbnf)
fildl 8(%esp)
flds 4(%esp)
fscale
fstp %st(1) /* bug fix for fp stack overflow */
ret
END(scalbnf)
.globl CNAME(ldexpf)
.set CNAME(ldexpf),CNAME(scalbnf)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,26 +0,0 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_scalbnl.S,v 1.3 2011/01/07 16:13:12 kib Exp $");
/* RCSID("$NetBSD: s_scalbnf.S,v 1.4 1999/01/02 05:15:40 kristerw Exp $") */
ENTRY(scalbnl)
fildl 16(%esp)
fldt 4(%esp)
fscale
fstp %st(1)
ret
END(scalbnl)
.globl CNAME(ldexpl)
.set CNAME(ldexpl),CNAME(scalbnl)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,33 +0,0 @@
/*
* Written by:
* J.T. Conklin (jtc@netbsd.org)
* Public domain.
*/
#include <i387/bsd_asm.h>
//__FBSDID("$FreeBSD: src/lib/msun/i387/s_sin.S,v 1.9 2011/01/07 16:13:12 kib Exp $")
ENTRY(sin)
fldl 4(%esp)
fsin
fnstsw %ax
andw $0x400,%ax
jnz 1f
ret
1: fldpi
fadd %st(0)
fxch %st(1)
2: fprem1
fnstsw %ax
andw $0x400,%ax
jnz 2b
fstp %st(1)
fsin
ret
END(sin)
/* Enable stack protection */
#if defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif

Some files were not shown because too many files have changed in this diff Show More