Remove libthr, csu, libthread_db and testfloat sparc64 specific directories.

Submitted by:	kib@ (libthr)
This commit is contained in:
Warner Losh 2020-02-27 04:44:58 +00:00
parent c49be4f1c6
commit f33b14f02e
25 changed files with 0 additions and 3565 deletions

View File

@ -1,28 +0,0 @@
# $FreeBSD$
.PATH: ${.CURDIR:H}/common
SRCS= crt1.c crti.S crtn.S
OBJS= ${SRCS:N*.h:R:S/$/.o/g}
OBJS+= Scrt1.o gcrt1.o
CFLAGS+= -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include
CFLAGS+= -DCRT_IRELOC_SUPPRESS
FILES= ${OBJS}
FILESMODE= ${LIBMODE}
FILESOWN= ${LIBOWN}
FILESGRP= ${LIBGRP}
FILESDIR= ${LIBDIR}
# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY.
.undef LIBRARIES_ONLY
CLEANFILES= ${OBJS}
gcrt1.o: crt1.c
${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC}
Scrt1.o: crt1.c
${CC} ${CFLAGS} -fPIC -DPIC -c -o Scrt1.o ${.ALLSRC}
.include <bsd.lib.mk>

View File

@ -1,12 +0,0 @@
# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
include \
.include <dirdeps.mk>
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
.endif

View File

@ -1,33 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-1-Clause
*
* Copyright 2018 Andrew Turner
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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$
*/
#ifndef _CRT_H_
#define _CRT_H_
#define HAVE_CTORS
#define CTORS_CONSTRUCTORS
#define INIT_CALL_SEQ(func) "call " __STRING(func) "; nop"
#endif

View File

@ -1,105 +0,0 @@
/* LINTLIBRARY */
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright 2001 David E. O'Brien.
* All rights reserved.
* Copyright (c) 1995, 1998 Berkeley Software Design, Inc.
* All rights reserved.
* Copyright 1996-1998 John D. Polstra.
* 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. The name of the authors may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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$");
#include <stdlib.h>
#include "libc_private.h"
#include "crtbrand.c"
#include "ignore_init.c"
struct Struct_Obj_Entry;
struct ps_strings;
extern void __sparc_utrap_setup(void);
#ifdef GCRT
extern void _mcleanup(void);
extern void monstartup(void *, void *);
extern int eprol;
extern int etext;
#endif
void _start(char **, void (*)(void), struct Struct_Obj_Entry *,
struct ps_strings *);
/* The entry function. */
/*
* %o0 holds ps_strings pointer.
*
* Note: kernel may (is not set in stone yet) pass ELF aux vector in %o1,
* but for now we do not use it here.
*
* The SPARC compliance definitions specifies that the kernel pass the
* address of a function to be executed on exit in %g1. We do not make
* use of it as it is quite broken, because gcc can use this register
* as a temporary, so it is not safe from C code. Its even more broken
* for dynamic executables since rtld runs first.
*/
/* ARGSUSED */
void
_start(char **ap, void (*cleanup)(void), struct Struct_Obj_Entry *obj __unused,
struct ps_strings *ps_strings __unused)
{
int argc;
char **argv;
char **env;
argc = *(long *)(void *)ap;
argv = ap + 1;
env = ap + 2 + argc;
handle_argv(argc, argv, env);
if (&_DYNAMIC != NULL)
atexit(cleanup);
else {
__sparc_utrap_setup();
_init_tls();
}
#ifdef GCRT
atexit(_mcleanup);
monstartup(&eprol, &etext);
#endif
handle_static_init(argc, argv, env);
exit(main(argc, argv, env));
}
#ifdef GCRT
__asm__(".text");
__asm__("eprol:");
__asm__(".previous");
#endif

View File

@ -1,57 +0,0 @@
/*-
* Copyright 2001 David E. O'Brien
* 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 author nor the names of additional contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 <machine/asm.h>
__FBSDID("$FreeBSD$");
.file "crti.S"
/* The minimum stack frame size (bytes) is:
* 16 extended words for saving the current register window,
* 1 extended word for "hidden parameter",
* 6 extended words in wihch a callee can store its arguments
* ("The SPARC Architecure Manual" by Weaver & Germond)
* This gives 184 bytes. However we must round up to an extended
* word boundary, thus 192 bytes.
* (if we weren't v9, it would be 96 bytes rather than 192)
*/
.section .init,"ax",@progbits
.align 4
.globl _init
.type _init,#function
_init:
save %sp,-192,%sp
.section .fini,"ax",@progbits
.globl _fini
.type _fini,#function
.align 4
_fini:
save %sp,-192,%sp

View File

@ -1,42 +0,0 @@
/*-
* Copyright 2001 David E. O'Brien
* 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 author nor the names of additional contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 <machine/asm.h>
__FBSDID("$FreeBSD$");
.file "crtn.S"
.section .init,"ax",@progbits
.align 4
ret
restore
.section .fini,"ax",@progbits
.align 4
ret
restore

View File

@ -1,3 +0,0 @@
# $FreeBSD$
SRCS+= _umtx_op_err.S

View File

@ -1,80 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2003 Jake Burkholder <jake@freebsd.org>.
* Copyright (c) 2003 Marcel Moolenaar
* 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 ``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 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$
*/
/*
* Machine-dependent thread prototypes/definitions.
*/
#ifndef _PTHREAD_MD_H_
#define _PTHREAD_MD_H_
#include <stddef.h>
#define CPU_SPINWAIT
#define DTV_OFFSET offsetof(struct tcb, tcb_dtv)
/*
* Variant II tcb, first two members are required by rtld.
* %g7 points to the structure.
*/
struct tcb {
struct tcb *tcb_self; /* required by rtld */
void *tcb_dtv; /* required by rtld */
struct pthread *tcb_thread; /* our hook */
void *tcb_spare[1];
};
/* Called from the thread to set its private data. */
static __inline void
_tcb_set(struct tcb *tcb)
{
__asm __volatile("mov %0, %%g7" : : "r" (tcb));
}
static __inline struct tcb *
_tcb_get(void)
{
register struct tcb *tp __asm("%g7");
return (tp);
}
static __inline struct pthread *
_get_curthread(void)
{
return (_tcb_get()->tcb_thread);
}
#define HAS__UMTX_OP_ERR 1
#endif /* _PTHREAD_MD_H_ */

View File

@ -1,46 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2019 The FreeBSD Foundation
*
* This software was developed by Konstantin Belousov <kib@FreeBSD.org>
* under sponsorship from the FreeBSD Foundation.
*
* 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$
*/
#ifndef _ARCH_SPARC64_PTHREAD_TLS_H
#define _ARCH_SPARC64_PTHREAD_TLS_H
static __inline uintptr_t
_get_static_tls_base(struct pthread *thr, size_t offset)
{
uintptr_t tlsbase;
tlsbase = (uintptr_t)thr->tcb;
tlsbase -= offset;
return (tlsbase);
}
#endif

View File

@ -1,38 +0,0 @@
/*-
* Copyright (c) 2011 Marius Strobl <marius@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 <machine/asm.h>
__FBSDID("$FreeBSD$");
#include <sys/syscall.h>
#include <machine/utrap.h>
ENTRY(_umtx_op_err)
mov SYS__umtx_op, %g1
retl
ta %xcc, ST_SYSCALL
END(_umtx_op_err)

View File

@ -1,92 +0,0 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2004 Marcel Moolenaar
* Copyright (c) 2011 Marius Strobl <marius@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 ``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 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$");
#include <sys/types.h>
#include <string.h>
#include <thread_db.h>
#include <ucontext.h>
#include <machine/fsr.h>
#include "libpthread_db.h"
void
pt_reg_to_ucontext(const struct reg *r, ucontext_t *uc)
{
memcpy(&uc->uc_mcontext, r, MIN(sizeof(uc->uc_mcontext), sizeof(*r)));
}
void
pt_ucontext_to_reg(const ucontext_t *uc, struct reg *r)
{
memcpy(r, &uc->uc_mcontext, MIN(sizeof(uc->uc_mcontext), sizeof(*r)));
}
void
pt_fpreg_to_ucontext(const struct fpreg* r, ucontext_t *uc)
{
mcontext_t *mc = &uc->uc_mcontext;
memcpy(mc->mc_fp, r->fr_regs, MIN(sizeof(mc->mc_fp),
sizeof(r->fr_regs)));
mc->_mc_fsr = r->fr_fsr;
mc->_mc_gsr = r->fr_gsr;
mc->_mc_fprs |= FPRS_FEF;
}
void
pt_ucontext_to_fpreg(const ucontext_t *uc, struct fpreg *r)
{
const mcontext_t *mc = &uc->uc_mcontext;
if ((mc->_mc_fprs & FPRS_FEF) != 0) {
memcpy(r->fr_regs, mc->mc_fp, MIN(sizeof(mc->mc_fp),
sizeof(r->fr_regs)));
r->fr_fsr = mc->_mc_fsr;
r->fr_gsr = mc->_mc_gsr;
} else
memset(r, 0, sizeof(*r));
}
void
pt_md_init(void)
{
}
int
pt_reg_sstep(struct reg *reg __unused, int step __unused)
{
return (0);
}

View File

@ -1,105 +0,0 @@
# Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.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 ``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$
.PATH: ${.CURDIR}/../../../../lib/libc/softfloat/bits64 ${.CURDIR}/..
LIBC_DIR= ${.CURDIR}/../../../../lib/libc
EMUFLOAT_DIR= ${LIBC_DIR}/sparc64/fpu
LN= ln -sf
# Common source files
SRCS1= fail.c random.c softfloat.c testCases.c testLoops.c writeHex.c
# Additional common sources to build testfloat/testemufloat
SRCS2= testFunction.c testfloat.c
# Additional sources to build testemufloat
SRCS3= fpu.c fpu_add.c fpu_compare.c fpu_div.c fpu_emul.S fpu_explode.c \
fpu_implode.c fpu_mul.c fpu_qp.c fpu_sqrt.c fpu_subr.c fpu_util.c
# Additional sources to build testfloat
SRCS4= systflags.c systfloat.S systmodes.c
# Additional sources to build testsoftfloat
SRCS5= slowfloat.c testsoftfloat.c
SRCS= ${SRCS1} ${SRCS2} ${SRCS3} ${SRCS4} ${SRCS5}
OBJ_TF= ${SRCS1:R:S/$/.o/g} ${SRCS2:R:S/$/.o/g} ${SRCS4:R:S/$/.o/g}
OBJ_TEF= ${SRCS1:R:S/$/.o/g} ${SRCS2:R:S/$/.o/g} ${SRCS3:R:S/$/.o/g}
OBJ_TSF= ${SRCS1:R:S/$/.o/g} ${SRCS5:R:S/$/.o/g}
all: testfloat testemufloat testsoftfloat
CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/.. -I${LIBC_DIR}/sparc64/fpu \
-I${LIBC_DIR}/sparc64/sys -I${LIBC_DIR}/softfloat/bits64 \
-I${LIBC_DIR}/softfloat
CLEANFILES+= fpu.c fpu_add.c fpu_compare.c fpu_div.c fpu_emu.h \
fpu_explode.c fpu_implode.c fpu_mul.c fpu_qp.c fpu_sqrt.c fpu_subr.c \
${SRCS:R:S/$/.o/g} testfloat testemufloat testsoftfloat
testsoftfloat: ${OBJ_TSF}
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJ_TSF}
testfloat: ${OBJ_TF}
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJ_TF}
testemufloat: ${OBJ_TEF}
${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${OBJ_TEF}
beforedepend: fpu_emu.h
# The emulator code needs to be built with a local fpu_reg.h instead of
# the one in ${EMUFLOAT_DIR}. Unfortunately, C preprocessor semantics
# means that a header file in the same directory as the source file
# overrides any alternative header file location. In order to include
# the wanted header file, create symlinks pointing to the real files
# and compile through the symlink.
fpu.c: ${EMUFLOAT_DIR}/fpu.c
${LN} ${.ALLSRC} ${.TARGET}
fpu_add.c: ${EMUFLOAT_DIR}/fpu_add.c
${LN} ${.ALLSRC} ${.TARGET}
fpu_compare.c: ${EMUFLOAT_DIR}/fpu_compare.c
${LN} ${.ALLSRC} ${.TARGET}
fpu_div.c: ${EMUFLOAT_DIR}/fpu_div.c
${LN} ${.ALLSRC} ${.TARGET}
fpu_emu.h: ${EMUFLOAT_DIR}/fpu_emu.h
${LN} ${.ALLSRC} ${.TARGET}
fpu_explode.c: ${EMUFLOAT_DIR}/fpu_explode.c
${LN} ${.ALLSRC} ${.TARGET}
fpu_implode.c: ${EMUFLOAT_DIR}/fpu_implode.c
${LN} ${.ALLSRC} ${.TARGET}
fpu_mul.c: ${EMUFLOAT_DIR}/fpu_mul.c
${LN} ${.ALLSRC} ${.TARGET}
fpu_qp.c: ${EMUFLOAT_DIR}/fpu_qp.c
${LN} ${.ALLSRC} ${.TARGET}
fpu_sqrt.c: ${EMUFLOAT_DIR}/fpu_sqrt.c
${LN} ${.ALLSRC} ${.TARGET}
fpu_subr.c: ${EMUFLOAT_DIR}/fpu_subr.c
${LN} ${.ALLSRC} ${.TARGET}
.include <bsd.prog.mk>

View File

@ -1,186 +0,0 @@
/*-
* Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.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 ``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 <machine/asm.h>
__FBSDID("$FreeBSD$");
.section "rodata1",#alloc
.align 8
.global insn_int32_to_float32
insn_int32_to_float32:
fitos %f0,%f0
.global insn_int32_to_float64
insn_int32_to_float64:
fitod %f0,%f0
.global insn_int32_to_float128
insn_int32_to_float128:
fitoq %f0,%f0
.global insn_int64_to_float32
insn_int64_to_float32:
fxtos %f0,%f0
.global insn_int64_to_float64
insn_int64_to_float64:
fxtod %f0,%f0
.global insn_int64_to_float128
insn_int64_to_float128:
fxtoq %f0,%f0
.global insn_float32_to_int32_round_to_zero
insn_float32_to_int32_round_to_zero:
fstoi %f0,%f0
.global insn_float32_to_int64_round_to_zero
insn_float32_to_int64_round_to_zero:
fstox %f0,%f0
.global insn_float32_to_float64
insn_float32_to_float64:
fstod %f0,%f0
.global insn_float32_to_float128
insn_float32_to_float128:
fstoq %f0,%f0
.global insn_float32_add
insn_float32_add:
fadds %f0,%f1,%f0
.global insn_float32_sub
insn_float32_sub:
fsubs %f0,%f1,%f0
.global insn_float32_mul
insn_float32_mul:
fmuls %f0,%f1,%f0
.global insn_float32_div
insn_float32_div:
fdivs %f0,%f1,%f0
.global insn_float32_sqrt
insn_float32_sqrt:
fsqrts %f0,%f0
.global insn_float32_cmp
insn_float32_cmp:
fcmps %fcc0,%f0,%f1
.global insn_float32_cmpe
insn_float32_cmpe:
fcmpes %fcc0,%f0,%f1
.global insn_float64_to_int32_round_to_zero
insn_float64_to_int32_round_to_zero:
fdtoi %f0,%f0
.global insn_float64_to_int64_round_to_zero
insn_float64_to_int64_round_to_zero:
fdtox %f0,%f0
.global insn_float64_to_float32
insn_float64_to_float32:
fdtos %f0,%f0
.global insn_float64_to_float128
insn_float64_to_float128:
fdtoq %f0,%f0
.global insn_float64_add
insn_float64_add:
faddd %f0,%f2,%f0
.global insn_float64_sub
insn_float64_sub:
fsubd %f0,%f2,%f0
.global insn_float64_mul
insn_float64_mul:
fmuld %f0,%f2,%f0
.global insn_float64_div
insn_float64_div:
fdivd %f0,%f2,%f0
.global insn_float64_sqrt
insn_float64_sqrt:
fsqrtd %f0,%f0
.global insn_float64_cmp
insn_float64_cmp:
fcmpd %fcc0,%f0,%f2
.global insn_float64_cmpe
insn_float64_cmpe:
fcmped %fcc0,%f0,%f2
.global insn_float128_to_int32_round_to_zero
insn_float128_to_int32_round_to_zero:
fqtoi %f0,%f0
.global insn_float128_to_int64_round_to_zero
insn_float128_to_int64_round_to_zero:
fqtox %f0,%f0
.global insn_float128_to_float32
insn_float128_to_float32:
fqtos %f0,%f0
.global insn_float128_to_float64
insn_float128_to_float64:
fqtod %f0,%f0
.global insn_float128_add
insn_float128_add:
faddq %f0,%f4,%f0
.global insn_float128_sub
insn_float128_sub:
fsubq %f0,%f4,%f0
.global insn_float128_mul
insn_float128_mul:
fmulq %f0,%f4,%f0
.global insn_float128_div
insn_float128_div:
fdivq %f0,%f4,%f0
.global insn_float128_sqrt
insn_float128_sqrt:
fsqrtq %f0,%f0
.global insn_float128_cmp
insn_float128_cmp:
fcmpq %fcc0,%f0,%f4
.global insn_float128_cmpe
insn_float128_cmpe:
fcmpeq %fcc0,%f0,%f4

View File

@ -1,63 +0,0 @@
/*-
* Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.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 ``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$
*/
#ifndef _TESTFLOAT_SPARC64_FPU_REG_H_
#define _TESTFLOAT_SPARC64_FPU_REG_H_
#include <sys/types.h>
extern u_int32_t __fpreg[64];
static __inline u_int32_t
__fpu_getreg(int r)
{
return (__fpreg[r]);
}
static __inline u_int64_t
__fpu_getreg64(int r)
{
return ((u_int64_t)__fpreg[r] << 32 | (u_int64_t)__fpreg[r + 1]);
}
static __inline void
__fpu_setreg(int r, u_int32_t v)
{
__fpreg[r] = v;
}
static __inline void
__fpu_setreg64(int r, u_int64_t v)
{
__fpreg[r] = (u_int32_t)(v >> 32);
__fpreg[r + 1] = (u_int32_t)v;
}
#endif /* _TESTFLOAT_SPARC64_FPU_REG_H_ */

View File

@ -1,706 +0,0 @@
/*-
* Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.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 ``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$");
#include <sys/param.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "__sparc_utrap_private.h"
#include "fpu_extern.h"
#include "fpu_reg.h"
static u_long ireg[32];
void
__utrap_panic(const char *msg)
{
fprintf(stderr, "panic: %s\n", msg);
exit(1);
}
void __utrap_write(const char *msg)
{
fprintf(stderr, "%s", msg);
}
u_long
__emul_fetch_reg(struct utrapframe *uf, int reg)
{
return (ireg[reg]);
}
typedef unsigned char int8;
typedef unsigned int int32;
typedef unsigned long int64;
typedef unsigned int float32;
typedef unsigned long float64;
typedef struct {
unsigned long high, low;
} float128;
typedef unsigned long flag;
struct utrapframe utf;
u_int32_t __fpreg[64];
static __inline float128
__fpu_getreg128(int r)
{
float128 v;
v.high = ((u_int64_t)__fpreg[r] << 32 | (u_int64_t)__fpreg[r + 1]);
v.low = ((u_int64_t)__fpreg[r + 2] << 32 | (u_int64_t)__fpreg[r + 3]);
return (v);
}
static __inline void
__fpu_setreg128(int r, float128 v)
{
__fpreg[r] = (u_int32_t)(v.high >> 32);
__fpreg[r + 1] = (u_int32_t)v.high;
__fpreg[r + 2] = (u_int32_t)(v.low >> 32);
__fpreg[r + 3] = (u_int32_t)v.low;
}
/*
-------------------------------------------------------------------------------
Clears the system's IEC/IEEE floating-point exception flags. Returns the
previous value of the flags.
-------------------------------------------------------------------------------
*/
#include <fenv.h>
#include <ieeefp.h>
int8 syst_float_flags_clear(void)
{
int32 flags;
flags = (utf.uf_fsr & FE_ALL_EXCEPT) >> 5;
utf.uf_fsr &= ~(u_long)FE_ALL_EXCEPT;
return (flags);
}
static void
emul_trap(const u_int *insn, u_long mask)
{
u_int32_t savreg[64];
int i;
for (i = 0; i < 64; i++)
savreg[i] = __fpreg[i];
utf.uf_fsr = (utf.uf_fsr & ~FSR_FTT_MASK) |
(FSR_FTT_UNFIN << FSR_FTT_SHIFT);
utf.uf_pc = (u_long)insn;
if (__fpu_exception(&utf) == 0)
__asm("stx %%fsr,%0" : "=m" (utf.uf_fsr));
for (i = 0; i < 64; i++) {
if (!(mask & (1UL << i)) && savreg[i] != __fpreg[i]) {
fprintf(stderr, "### %2d %08x != %08x\n",
i, savreg[i], __fpreg[i]);
}
}
}
extern u_int insn_int32_to_float32;
extern u_int insn_int32_to_float64;
extern u_int insn_int32_to_float128;
extern u_int insn_int64_to_float32;
extern u_int insn_int64_to_float64;
extern u_int insn_int64_to_float128;
extern u_int insn_float32_to_int32_round_to_zero;
extern u_int insn_float32_to_int64_round_to_zero;
extern u_int insn_float32_to_float64;
extern u_int insn_float32_to_float128;
extern u_int insn_float32_add;
extern u_int insn_float32_sub;
extern u_int insn_float32_mul;
extern u_int insn_float32_div;
extern u_int insn_float32_sqrt;
extern u_int insn_float32_cmp;
extern u_int insn_float32_cmpe;
extern u_int insn_float64_to_int32_round_to_zero;
extern u_int insn_float64_to_int64_round_to_zero;
extern u_int insn_float64_to_float32;
extern u_int insn_float64_to_float128;
extern u_int insn_float64_add;
extern u_int insn_float64_sub;
extern u_int insn_float64_mul;
extern u_int insn_float64_div;
extern u_int insn_float64_sqrt;
extern u_int insn_float64_cmp;
extern u_int insn_float64_cmpe;
extern u_int insn_float128_to_int32_round_to_zero;
extern u_int insn_float128_to_int64_round_to_zero;
extern u_int insn_float128_to_float32;
extern u_int insn_float128_to_float64;
extern u_int insn_float128_add;
extern u_int insn_float128_sub;
extern u_int insn_float128_mul;
extern u_int insn_float128_div;
extern u_int insn_float128_sqrt;
extern u_int insn_float128_cmp;
extern u_int insn_float128_cmpe;
float32
syst_int32_to_float32(int32 a)
{
__fpu_setreg(0, a);
emul_trap(&insn_int32_to_float32, 0x1UL);
return (__fpu_getreg(0));
}
float64
syst_int32_to_float64(int32 a)
{
__fpu_setreg(0, a);
emul_trap(&insn_int32_to_float64, 0x3UL);
return (__fpu_getreg64(0));
}
float128
syst_int32_to_float128(int32 a)
{
__fpu_setreg(0, a);
emul_trap(&insn_int32_to_float128, 0xfUL);
return (__fpu_getreg128(0));
}
float32
syst_int64_to_float32(int64 a)
{
__fpu_setreg64(0, a);
emul_trap(&insn_int64_to_float32, 0x1UL);
return (__fpu_getreg(0));
}
float64
syst_int64_to_float64(int64 a)
{
__fpu_setreg64(0, a);
emul_trap(&insn_int64_to_float64, 0x3UL);
return (__fpu_getreg64(0));
}
float128
syst_int64_to_float128(int64 a)
{
__fpu_setreg64(0, a);
emul_trap(&insn_int64_to_float128, 0xfUL);
return (__fpu_getreg128(0));
}
int32
syst_float32_to_int32_round_to_zero(float32 a)
{
__fpu_setreg(0, a);
emul_trap(&insn_float32_to_int32_round_to_zero, 0x1UL);
return (__fpu_getreg(0));
}
int64
syst_float32_to_int64_round_to_zero(float32 a)
{
__fpu_setreg(0, a);
emul_trap(&insn_float32_to_int64_round_to_zero, 0x3UL);
return (__fpu_getreg64(0));
}
float64
syst_float32_to_float64(float32 a)
{
__fpu_setreg(0, a);
emul_trap(&insn_float32_to_float64, 0x3UL);
return (__fpu_getreg64(0));
}
float128
syst_float32_to_float128(float32 a)
{
__fpu_setreg(0, a);
emul_trap(&insn_float32_to_float128, 0xfUL);
return (__fpu_getreg128(0));
}
float32
syst_float32_add(float32 a, float32 b)
{
__fpu_setreg(0, a);
__fpu_setreg(1, b);
emul_trap(&insn_float32_add, 0x1UL);
return (__fpu_getreg(0));
}
float32
syst_float32_sub(float32 a, float32 b)
{
__fpu_setreg(0, a);
__fpu_setreg(1, b);
emul_trap(&insn_float32_sub, 0x1UL);
return (__fpu_getreg(0));
}
float32
syst_float32_mul(float32 a, float32 b)
{
__fpu_setreg(0, a);
__fpu_setreg(1, b);
emul_trap(&insn_float32_mul, 0x1UL);
return (__fpu_getreg(0));
}
float32
syst_float32_div(float32 a, float32 b)
{
__fpu_setreg(0, a);
__fpu_setreg(1, b);
emul_trap(&insn_float32_div, 0x1UL);
return (__fpu_getreg(0));
}
float32
syst_float32_sqrt(float32 a)
{
__fpu_setreg(0, a);
emul_trap(&insn_float32_sqrt, 0x1UL);
return (__fpu_getreg(0));
}
flag syst_float32_eq(float32 a, float32 b)
{
u_long r;
__fpu_setreg(0, a);
__fpu_setreg(1, b);
emul_trap(&insn_float32_cmp, 0x0UL);
__asm __volatile("mov 0,%0; move %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float32_le(float32 a, float32 b)
{
u_long r;
__fpu_setreg(0, a);
__fpu_setreg(1, b);
emul_trap(&insn_float32_cmpe, 0x0UL);
__asm __volatile("mov 0,%0; movle %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float32_lt(float32 a, float32 b)
{
u_long r;
__fpu_setreg(0, a);
__fpu_setreg(1, b);
emul_trap(&insn_float32_cmpe, 0x0UL);
__asm __volatile("mov 0,%0; movl %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float32_eq_signaling(float32 a, float32 b)
{
u_long r;
__fpu_setreg(0, a);
__fpu_setreg(1, b);
emul_trap(&insn_float32_cmpe, 0x0UL);
__asm __volatile("mov 0,%0; move %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float32_le_quiet(float32 a, float32 b)
{
u_long r;
__fpu_setreg(0, a);
__fpu_setreg(1, b);
emul_trap(&insn_float32_cmp, 0x0UL);
__asm __volatile("mov 0,%0; movle %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float32_lt_quiet(float32 a, float32 b)
{
u_long r;
__fpu_setreg(0, a);
__fpu_setreg(1, b);
emul_trap(&insn_float32_cmp, 0x0UL);
__asm __volatile("mov 0,%0; movl %%fcc0,1,%0" : "=r" (r));
return (r);
}
int32
syst_float64_to_int32_round_to_zero(float64 a)
{
__fpu_setreg64(0, a);
emul_trap(&insn_float64_to_int32_round_to_zero, 0x1UL);
return (__fpu_getreg(0));
}
int64
syst_float64_to_int64_round_to_zero(float64 a)
{
__fpu_setreg64(0, a);
emul_trap(&insn_float64_to_int64_round_to_zero, 0x3UL);
return (__fpu_getreg64(0));
}
float32
syst_float64_to_float32(float64 a)
{
__fpu_setreg64(0, a);
emul_trap(&insn_float64_to_float32, 0x1UL);
return (__fpu_getreg(0));
}
float128
syst_float64_to_float128(float64 a)
{
__fpu_setreg64(0, a);
emul_trap(&insn_float64_to_float128, 0xfUL);
return (__fpu_getreg128(0));
}
float64
syst_float64_add(float64 a, float64 b)
{
__fpu_setreg64(0, a);
__fpu_setreg64(2, b);
emul_trap(&insn_float64_add, 0x3UL);
return (__fpu_getreg64(0));
}
float64
syst_float64_sub(float64 a, float64 b)
{
__fpu_setreg64(0, a);
__fpu_setreg64(2, b);
emul_trap(&insn_float64_sub, 0x3UL);
return (__fpu_getreg64(0));
}
float64
syst_float64_mul(float64 a, float64 b)
{
__fpu_setreg64(0, a);
__fpu_setreg64(2, b);
emul_trap(&insn_float64_mul, 0x3UL);
return (__fpu_getreg64(0));
}
float64
syst_float64_div(float64 a, float64 b)
{
__fpu_setreg64(0, a);
__fpu_setreg64(2, b);
emul_trap(&insn_float64_div, 0x3UL);
return (__fpu_getreg64(0));
}
float64
syst_float64_sqrt(float64 a)
{
__fpu_setreg64(0, a);
emul_trap(&insn_float64_sqrt, 0x3UL);
return (__fpu_getreg64(0));
}
flag syst_float64_eq(float64 a, float64 b)
{
u_long r;
__fpu_setreg64(0, a);
__fpu_setreg64(2, b);
emul_trap(&insn_float64_cmp, 0x0UL);
__asm __volatile("mov 0,%0; move %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float64_le(float64 a, float64 b)
{
u_long r;
__fpu_setreg64(0, a);
__fpu_setreg64(2, b);
emul_trap(&insn_float64_cmpe, 0x0UL);
__asm __volatile("mov 0,%0; movle %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float64_lt(float64 a, float64 b)
{
u_long r;
__fpu_setreg64(0, a);
__fpu_setreg64(2, b);
emul_trap(&insn_float64_cmpe, 0x0UL);
__asm __volatile("mov 0,%0; movl %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float64_eq_signaling(float64 a, float64 b)
{
u_long r;
__fpu_setreg64(0, a);
__fpu_setreg64(2, b);
emul_trap(&insn_float64_cmpe, 0x0UL);
__asm __volatile("mov 0,%0; move %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float64_le_quiet(float64 a, float64 b)
{
u_long r;
__fpu_setreg64(0, a);
__fpu_setreg64(2, b);
emul_trap(&insn_float64_cmp, 0x0UL);
__asm __volatile("mov 0,%0; movle %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float64_lt_quiet(float64 a, float64 b)
{
u_long r;
__fpu_setreg64(0, a);
__fpu_setreg64(2, b);
emul_trap(&insn_float64_cmp, 0x0UL);
__asm __volatile("mov 0,%0; movl %%fcc0,1,%0" : "=r" (r));
return (r);
}
int32
syst_float128_to_int32_round_to_zero(float128 a)
{
__fpu_setreg128(0, a);
emul_trap(&insn_float128_to_int32_round_to_zero, 0x1UL);
return (__fpu_getreg(0));
}
int64
syst_float128_to_int64_round_to_zero(float128 a)
{
__fpu_setreg128(0, a);
emul_trap(&insn_float128_to_int64_round_to_zero, 0x3UL);
return (__fpu_getreg64(0));
}
float32
syst_float128_to_float32(float128 a)
{
__fpu_setreg128(0, a);
emul_trap(&insn_float128_to_float32, 0x1UL);
return (__fpu_getreg(0));
}
float64
syst_float128_to_float64(float128 a)
{
__fpu_setreg128(0, a);
emul_trap(&insn_float128_to_float64, 0x3UL);
return (__fpu_getreg64(0));
}
float128
syst_float128_add(float128 a, float128 b)
{
__fpu_setreg128(0, a);
__fpu_setreg128(4, b);
emul_trap(&insn_float128_add, 0xfUL);
return (__fpu_getreg128(0));
}
float128
syst_float128_sub(float128 a, float128 b)
{
__fpu_setreg128(0, a);
__fpu_setreg128(4, b);
emul_trap(&insn_float128_sub, 0xfUL);
return (__fpu_getreg128(0));
}
float128
syst_float128_mul(float128 a, float128 b)
{
__fpu_setreg128(0, a);
__fpu_setreg128(4, b);
emul_trap(&insn_float128_mul, 0xfUL);
return (__fpu_getreg128(0));
}
float128
syst_float128_div(float128 a, float128 b)
{
__fpu_setreg128(0, a);
__fpu_setreg128(4, b);
emul_trap(&insn_float128_div, 0xfUL);
return (__fpu_getreg128(0));
}
float128
syst_float128_sqrt(float128 a)
{
__fpu_setreg128(0, a);
emul_trap(&insn_float128_sqrt, 0xfUL);
return (__fpu_getreg128(0));
}
flag syst_float128_eq(float128 a, float128 b)
{
u_long r;
__fpu_setreg128(0, a);
__fpu_setreg128(4, b);
emul_trap(&insn_float128_cmp, 0x0UL);
__asm __volatile("mov 0,%0; move %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float128_le(float128 a, float128 b)
{
u_long r;
__fpu_setreg128(0, a);
__fpu_setreg128(4, b);
emul_trap(&insn_float128_cmpe, 0x0UL);
__asm __volatile("mov 0,%0; movle %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float128_lt(float128 a, float128 b)
{
u_long r;
__fpu_setreg128(0, a);
__fpu_setreg128(4, b);
emul_trap(&insn_float128_cmpe, 0x0UL);
__asm __volatile("mov 0,%0; movl %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float128_eq_signaling(float128 a, float128 b)
{
u_long r;
__fpu_setreg128(0, a);
__fpu_setreg128(4, b);
emul_trap(&insn_float128_cmpe, 0x0UL);
__asm __volatile("mov 0,%0; move %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float128_le_quiet(float128 a, float128 b)
{
u_long r;
__fpu_setreg128(0, a);
__fpu_setreg128(4, b);
emul_trap(&insn_float128_cmp, 0x0UL);
__asm __volatile("mov 0,%0; movle %%fcc0,1,%0" : "=r" (r));
return (r);
}
flag syst_float128_lt_quiet(float128 a, float128 b)
{
u_long r;
__fpu_setreg128(0, a);
__fpu_setreg128(4, b);
emul_trap(&insn_float128_cmp, 0x0UL);
__asm __volatile("mov 0,%0; movl %%fcc0,1,%0" : "=r" (r));
return (r);
}
/*
-------------------------------------------------------------------------------
Sets the system's IEC/IEEE floating-point rounding mode.
-------------------------------------------------------------------------------
*/
void syst_float_set_rounding_mode(int8 roundingMode)
{
utf.uf_fsr &= ~FSR_RD_MASK;
utf.uf_fsr |= FSR_RD((unsigned int)roundingMode & 0x03);
}
/*
-------------------------------------------------------------------------------
Does nothing.
-------------------------------------------------------------------------------
*/
void syst_float_set_rounding_precision(int8 precision)
{
}

View File

@ -1,30 +0,0 @@
/*-
* Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.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 ``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$
*/
/*
* This file has no content and is solely to satisfy a #include in
* the FP emulator code.
*/

View File

@ -1,56 +0,0 @@
#ifndef TESTFLOAT_SPARC64_MILIEU_H_
#define TESTFLOAT_SPARC64_MILIEU_H_
/*
===============================================================================
This C header file is part of TestFloat, Release 2a, a package of programs
for testing the correctness of floating-point arithmetic complying to the
IEC/IEEE Standard for Floating-Point.
Written by John R. Hauser. More information is available through the Web
page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
Derivative works are acceptable, even for commercial purposes, so long as
(1) they include prominent notice that the work is derivative, and (2) they
include prominent notice akin to these four paragraphs for those parts of
this code that are retained.
===============================================================================
*/
/* $FreeBSD$ */
/*
-------------------------------------------------------------------------------
Include common integer types and flags.
-------------------------------------------------------------------------------
*/
#include "sparc64.h"
/*
-------------------------------------------------------------------------------
If the `BITS64' macro is defined by the processor header file but the
version of SoftFloat being used/tested is the 32-bit one (`bits32'), the
`BITS64' macro must be undefined here.
-------------------------------------------------------------------------------
#undef BITS64
*/
/*
-------------------------------------------------------------------------------
Symbolic Boolean literals.
-------------------------------------------------------------------------------
*/
enum {
FALSE = 0,
TRUE = 1
};
#endif

View File

@ -1,30 +0,0 @@
/*-
* Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.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 ``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$
*/
/*
* This file has no content and is solely to satisfy a #include in
* the FP emulator code.
*/

View File

@ -1,267 +0,0 @@
#ifndef TESTFLOAT_SPARC64_SOFTFLOAT_H
#define TESTFLOAT_SPARC64_SOFTFLOAT_H
/*============================================================================
This C header file is part of the SoftFloat IEC/IEEE Floating-point Arithmetic
Package, Release 2b.
Written by John R. Hauser. This work was made possible in part by the
International Computer Science Institute, located at Suite 600, 1947 Center
Street, Berkeley, California 94704. Funding was partially provided by the
National Science Foundation under grant MIP-9311980. The original version
of this code was written as part of a project to build a fixed-point vector
processor in collaboration with the University of California at Berkeley,
overseen by Profs. Nelson Morgan and John Wawrzynek. More information
is available through the Web page `http://www.cs.berkeley.edu/~jhauser/
arithmetic/SoftFloat.html'.
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has
been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES
RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS
AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ALL LOSSES,
COSTS, OR OTHER PROBLEMS THEY INCUR DUE TO THE SOFTWARE, AND WHO FURTHERMORE
EFFECTIVELY INDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE
INSTITUTE (possibly via similar legal warning) AGAINST ALL LOSSES, COSTS, OR
OTHER PROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE.
Derivative works are acceptable, even for commercial purposes, so long as
(1) the source code for the derivative work includes prominent notice that
the work is derivative, and (2) the source code includes prominent notice with
these four paragraphs for those parts of this code that are retained.
=============================================================================*/
/* $FreeBSD$ */
#include <machine/ieeefp.h>
/*----------------------------------------------------------------------------
| The macro `FLOATX80' must be defined to enable the extended double-precision
| floating-point format `floatx80'. If this macro is not defined, the
| `floatx80' type will not be defined, and none of the functions that either
| input or output the `floatx80' type will be defined. The same applies to
| the `FLOAT128' macro and the quadruple-precision format `float128'.
*----------------------------------------------------------------------------*/
#define FLOATX80
#define FLOAT128
/*----------------------------------------------------------------------------
| Software IEC/IEEE floating-point types.
*----------------------------------------------------------------------------*/
typedef unsigned int float32;
typedef unsigned long float64;
#ifdef FLOATX80
typedef struct {
unsigned short high;
unsigned long low;
} floatx80;
#endif
#ifdef FLOAT128
typedef struct {
unsigned long high, low;
} float128;
#endif
/*----------------------------------------------------------------------------
| Software IEC/IEEE floating-point underflow tininess-detection mode.
*----------------------------------------------------------------------------*/
extern int float_detect_tininess;
enum {
float_tininess_after_rounding = 0,
float_tininess_before_rounding = 1
};
/*----------------------------------------------------------------------------
| Software IEC/IEEE floating-point rounding mode.
*----------------------------------------------------------------------------*/
extern fp_rnd_t float_rounding_mode;
enum {
float_round_nearest_even = 0,
float_round_to_zero = 1,
float_round_up = 2,
float_round_down = 3
};
/*----------------------------------------------------------------------------
| Software IEC/IEEE floating-point exception flags.
*----------------------------------------------------------------------------*/
typedef int fp_except;
extern fp_except float_exception_flags;
enum {
float_flag_inexact = 1,
float_flag_divbyzero = 2,
float_flag_underflow = 4,
float_flag_overflow = 8,
float_flag_invalid = 16
};
/*----------------------------------------------------------------------------
| Routine to raise any or all of the software IEC/IEEE floating-point
| exception flags.
*----------------------------------------------------------------------------*/
void float_raise( int );
/*----------------------------------------------------------------------------
| Software IEC/IEEE integer-to-floating-point conversion routines.
*----------------------------------------------------------------------------*/
float32 int32_to_float32( int );
float64 int32_to_float64( int );
#ifdef FLOATX80
floatx80 int32_to_floatx80( int );
#endif
#ifdef FLOAT128
float128 int32_to_float128( int );
#endif
float32 int64_to_float32( long );
float64 int64_to_float64( long );
#ifdef FLOATX80
floatx80 int64_to_floatx80( long );
#endif
#ifdef FLOAT128
float128 int64_to_float128( long );
#endif
/*----------------------------------------------------------------------------
| Software IEC/IEEE single-precision conversion routines.
*----------------------------------------------------------------------------*/
int float32_to_int32( float32 );
int float32_to_int32_round_to_zero( float32 );
long float32_to_int64( float32 );
long float32_to_int64_round_to_zero( float32 );
float64 float32_to_float64( float32 );
#ifdef FLOATX80
floatx80 float32_to_floatx80( float32 );
#endif
#ifdef FLOAT128
float128 float32_to_float128( float32 );
#endif
/*----------------------------------------------------------------------------
| Software IEC/IEEE single-precision operations.
*----------------------------------------------------------------------------*/
float32 float32_round_to_int( float32 );
float32 float32_add( float32, float32 );
float32 float32_sub( float32, float32 );
float32 float32_mul( float32, float32 );
float32 float32_div( float32, float32 );
float32 float32_rem( float32, float32 );
float32 float32_sqrt( float32 );
int float32_eq( float32, float32 );
int float32_le( float32, float32 );
int float32_lt( float32, float32 );
int float32_eq_signaling( float32, float32 );
int float32_le_quiet( float32, float32 );
int float32_lt_quiet( float32, float32 );
int float32_is_signaling_nan( float32 );
/*----------------------------------------------------------------------------
| Software IEC/IEEE double-precision conversion routines.
*----------------------------------------------------------------------------*/
int float64_to_int32( float64 );
int float64_to_int32_round_to_zero( float64 );
long float64_to_int64( float64 );
long float64_to_int64_round_to_zero( float64 );
float32 float64_to_float32( float64 );
#ifdef FLOATX80
floatx80 float64_to_floatx80( float64 );
#endif
#ifdef FLOAT128
float128 float64_to_float128( float64 );
#endif
/*----------------------------------------------------------------------------
| Software IEC/IEEE double-precision operations.
*----------------------------------------------------------------------------*/
float64 float64_round_to_int( float64 );
float64 float64_add( float64, float64 );
float64 float64_sub( float64, float64 );
float64 float64_mul( float64, float64 );
float64 float64_div( float64, float64 );
float64 float64_rem( float64, float64 );
float64 float64_sqrt( float64 );
int float64_eq( float64, float64 );
int float64_le( float64, float64 );
int float64_lt( float64, float64 );
int float64_eq_signaling( float64, float64 );
int float64_le_quiet( float64, float64 );
int float64_lt_quiet( float64, float64 );
int float64_is_signaling_nan( float64 );
#ifdef FLOATX80
/*----------------------------------------------------------------------------
| Software IEC/IEEE extended double-precision conversion routines.
*----------------------------------------------------------------------------*/
int floatx80_to_int32( floatx80 );
int floatx80_to_int32_round_to_zero( floatx80 );
long floatx80_to_int64( floatx80 );
long floatx80_to_int64_round_to_zero( floatx80 );
float32 floatx80_to_float32( floatx80 );
float64 floatx80_to_float64( floatx80 );
#ifdef FLOAT128
float128 floatx80_to_float128( floatx80 );
#endif
/*----------------------------------------------------------------------------
| Software IEC/IEEE extended double-precision rounding precision. Valid
| values are 32, 64, and 80.
*----------------------------------------------------------------------------*/
extern int floatx80_rounding_precision;
/*----------------------------------------------------------------------------
| Software IEC/IEEE extended double-precision operations.
*----------------------------------------------------------------------------*/
floatx80 floatx80_round_to_int( floatx80 );
floatx80 floatx80_add( floatx80, floatx80 );
floatx80 floatx80_sub( floatx80, floatx80 );
floatx80 floatx80_mul( floatx80, floatx80 );
floatx80 floatx80_div( floatx80, floatx80 );
floatx80 floatx80_rem( floatx80, floatx80 );
floatx80 floatx80_sqrt( floatx80 );
int floatx80_eq( floatx80, floatx80 );
int floatx80_le( floatx80, floatx80 );
int floatx80_lt( floatx80, floatx80 );
int floatx80_eq_signaling( floatx80, floatx80 );
int floatx80_le_quiet( floatx80, floatx80 );
int floatx80_lt_quiet( floatx80, floatx80 );
int floatx80_is_signaling_nan( floatx80 );
#endif
#ifdef FLOAT128
/*----------------------------------------------------------------------------
| Software IEC/IEEE quadruple-precision conversion routines.
*----------------------------------------------------------------------------*/
int float128_to_int32( float128 );
int float128_to_int32_round_to_zero( float128 );
long float128_to_int64( float128 );
long float128_to_int64_round_to_zero( float128 );
float32 float128_to_float32( float128 );
float64 float128_to_float64( float128 );
#ifdef FLOATX80
floatx80 float128_to_floatx80( float128 );
#endif
/*----------------------------------------------------------------------------
| Software IEC/IEEE quadruple-precision operations.
*----------------------------------------------------------------------------*/
float128 float128_round_to_int( float128 );
float128 float128_add( float128, float128 );
float128 float128_sub( float128, float128 );
float128 float128_mul( float128, float128 );
float128 float128_div( float128, float128 );
float128 float128_rem( float128, float128 );
float128 float128_sqrt( float128 );
int float128_eq( float128, float128 );
int float128_le( float128, float128 );
int float128_lt( float128, float128 );
int float128_eq_signaling( float128, float128 );
int float128_le_quiet( float128, float128 );
int float128_lt_quiet( float128, float128 );
int float128_is_signaling_nan( float128 );
#endif
#endif

View File

@ -1,93 +0,0 @@
/*-
* Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.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 ``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$
*/
/*----------------------------------------------------------------------------
| One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
*----------------------------------------------------------------------------*/
#define BIGENDIAN
/*----------------------------------------------------------------------------
| The macro `BITS64' can be defined to indicate that 64-bit integer types are
| supported by the compiler.
*----------------------------------------------------------------------------*/
#define BITS64
/*----------------------------------------------------------------------------
| Each of the following `typedef's defines the most convenient type that holds
| integers of at least as many bits as specified. For example, `uint8' should
| be the most convenient type that can hold unsigned integers of as many as
| 8 bits. The `flag' type must be able to hold either a 0 or 1. For most
| implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
| to the same as `int'.
*----------------------------------------------------------------------------*/
typedef int flag;
typedef int uint8;
typedef int int8;
typedef int uint16;
typedef int int16;
typedef unsigned int uint32;
typedef signed int int32;
#ifdef BITS64
typedef unsigned long int uint64;
typedef signed long int int64;
#endif
/*----------------------------------------------------------------------------
| Each of the following `typedef's defines a type that holds integers
| of _exactly_ the number of bits specified. For instance, for most
| implementation of C, `bits16' and `sbits16' should be `typedef'ed to
| `unsigned short int' and `signed short int' (or `short int'), respectively.
*----------------------------------------------------------------------------*/
typedef unsigned char bits8;
typedef signed char sbits8;
typedef unsigned short int bits16;
typedef signed short int sbits16;
typedef unsigned int bits32;
typedef signed int sbits32;
#ifdef BITS64
typedef unsigned long int bits64;
typedef signed long int sbits64;
#endif
#ifdef BITS64
/*----------------------------------------------------------------------------
| The `LIT64' macro takes as its argument a textual integer literal and
| if necessary ``marks'' the literal as having a 64-bit integer type.
| For example, the GNU C Compiler (`gcc') requires that 64-bit literals be
| appended with the letters `LL' standing for `long long', which is `gcc's
| name for the 64-bit integer type. Some compilers may allow `LIT64' to be
| defined as the identity macro: `#define LIT64( a ) a'.
*----------------------------------------------------------------------------*/
#define LIT64( a ) a##L
#endif
/*----------------------------------------------------------------------------
| The macro `INLINE' can be used before functions that should be inlined. If
| a compiler does not support explicit inlining, this macro should be defined
| to be `static'.
*----------------------------------------------------------------------------*/
#define INLINE extern inline

View File

@ -1,73 +0,0 @@
/*-
* Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.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 ``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.
*/
/*
===============================================================================
This C source file is part of TestFloat, Release 2a, a package of programs
for testing the correctness of floating-point arithmetic complying to the
IEC/IEEE Standard for Floating-Point.
Written by John R. Hauser. More information is available through the Web
page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
Derivative works are acceptable, even for commercial purposes, so long as
(1) they include prominent notice that the work is derivative, and (2) they
include prominent notice akin to these four paragraphs for those parts of
this code that are retained.
===============================================================================
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#pragma STDC FENV_ACCESS ON
#include <fenv.h>
#include <ieeefp.h>
#include "milieu.h"
#include "systflags.h"
/*
-------------------------------------------------------------------------------
Clears the system's IEC/IEEE floating-point exception flags. Returns the
previous value of the flags.
-------------------------------------------------------------------------------
*/
int8 syst_float_flags_clear( void )
{
fexcept_t flags;
fegetexceptflag(&flags, FE_ALL_EXCEPT);
feclearexcept(FE_ALL_EXCEPT);
return (flags >> 5);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,216 +0,0 @@
/*
===============================================================================
This C header file is part of TestFloat, Release 2a, a package of programs
for testing the correctness of floating-point arithmetic complying to the
IEC/IEEE Standard for Floating-Point.
Written by John R. Hauser. More information is available through the Web
page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
Derivative works are acceptable, even for commercial purposes, so long as
(1) they include prominent notice that the work is derivative, and (2) they
include prominent notice akin to these four paragraphs for those parts of
this code that are retained.
===============================================================================
*/
/* $FreeBSD$ */
#include "softfloat.h"
#include "milieu.h"
/*
-------------------------------------------------------------------------------
The following macros are defined to indicate that the corresponding
functions exist.
-------------------------------------------------------------------------------
*/
#define SYST_INT32_TO_FLOAT32
#define SYST_INT32_TO_FLOAT64
#define SYST_INT32_TO_FLOAT128
#define SYST_INT64_TO_FLOAT32
#define SYST_INT64_TO_FLOAT64
#define SYST_INT64_TO_FLOAT128
#define SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
#define SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
#define SYST_FLOAT32_TO_FLOAT64
#define SYST_FLOAT32_TO_FLOAT128
#define SYST_FLOAT32_ADD
#define SYST_FLOAT32_SUB
#define SYST_FLOAT32_MUL
#define SYST_FLOAT32_DIV
#define SYST_FLOAT32_SQRT
#define SYST_FLOAT32_EQ
#define SYST_FLOAT32_LE
#define SYST_FLOAT32_LT
#define SYST_FLOAT32_EQ_SIGNALING
#define SYST_FLOAT32_LE_QUIET
#define SYST_FLOAT32_LT_QUIET
#define SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
#define SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
#define SYST_FLOAT64_TO_FLOAT32
#define SYST_FLOAT64_TO_FLOAT128
#define SYST_FLOAT64_ADD
#define SYST_FLOAT64_SUB
#define SYST_FLOAT64_MUL
#define SYST_FLOAT64_DIV
#define SYST_FLOAT64_SQRT
#define SYST_FLOAT64_EQ
#define SYST_FLOAT64_LE
#define SYST_FLOAT64_LT
#define SYST_FLOAT64_EQ_SIGNALING
#define SYST_FLOAT64_LE_QUIET
#define SYST_FLOAT64_LT_QUIET
#define SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
#define SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
#define SYST_FLOAT128_TO_FLOAT32
#define SYST_FLOAT128_TO_FLOAT64
#define SYST_FLOAT128_ADD
#define SYST_FLOAT128_SUB
#define SYST_FLOAT128_MUL
#define SYST_FLOAT128_DIV
#define SYST_FLOAT128_SQRT
#define SYST_FLOAT128_EQ
#define SYST_FLOAT128_LE
#define SYST_FLOAT128_LT
#define SYST_FLOAT128_EQ_SIGNALING
#define SYST_FLOAT128_LE_QUIET
#define SYST_FLOAT128_LT_QUIET
/*
-------------------------------------------------------------------------------
System function declarations. (Some of these functions may not exist.)
-------------------------------------------------------------------------------
*/
float32 syst_int32_to_float32( int32 );
float64 syst_int32_to_float64( int32 );
#ifdef FLOATX80
floatx80 syst_int32_to_floatx80( int32 );
#endif
#ifdef FLOAT128
float128 syst_int32_to_float128( int32 );
#endif
#ifdef BITS64
float32 syst_int64_to_float32( int64 );
float64 syst_int64_to_float64( int64 );
#ifdef FLOATX80
floatx80 syst_int64_to_floatx80( int64 );
#endif
#ifdef FLOAT128
float128 syst_int64_to_float128( int64 );
#endif
#endif
int32 syst_float32_to_int32( float32 );
int32 syst_float32_to_int32_round_to_zero( float32 );
#ifdef BITS64
int64 syst_float32_to_int64( float32 );
int64 syst_float32_to_int64_round_to_zero( float32 );
#endif
float64 syst_float32_to_float64( float32 );
#ifdef FLOATX80
floatx80 syst_float32_to_floatx80( float32 );
#endif
#ifdef FLOAT128
float128 syst_float32_to_float128( float32 );
#endif
float32 syst_float32_round_to_int( float32 );
float32 syst_float32_add( float32, float32 );
float32 syst_float32_sub( float32, float32 );
float32 syst_float32_mul( float32, float32 );
float32 syst_float32_div( float32, float32 );
float32 syst_float32_rem( float32, float32 );
float32 syst_float32_sqrt( float32 );
flag syst_float32_eq( float32, float32 );
flag syst_float32_le( float32, float32 );
flag syst_float32_lt( float32, float32 );
flag syst_float32_eq_signaling( float32, float32 );
flag syst_float32_le_quiet( float32, float32 );
flag syst_float32_lt_quiet( float32, float32 );
int32 syst_float64_to_int32( float64 );
int32 syst_float64_to_int32_round_to_zero( float64 );
#ifdef BITS64
int64 syst_float64_to_int64( float64 );
int64 syst_float64_to_int64_round_to_zero( float64 );
#endif
float32 syst_float64_to_float32( float64 );
#ifdef FLOATX80
floatx80 syst_float64_to_floatx80( float64 );
#endif
#ifdef FLOAT128
float128 syst_float64_to_float128( float64 );
#endif
float64 syst_float64_round_to_int( float64 );
float64 syst_float64_add( float64, float64 );
float64 syst_float64_sub( float64, float64 );
float64 syst_float64_mul( float64, float64 );
float64 syst_float64_div( float64, float64 );
float64 syst_float64_rem( float64, float64 );
float64 syst_float64_sqrt( float64 );
flag syst_float64_eq( float64, float64 );
flag syst_float64_le( float64, float64 );
flag syst_float64_lt( float64, float64 );
flag syst_float64_eq_signaling( float64, float64 );
flag syst_float64_le_quiet( float64, float64 );
flag syst_float64_lt_quiet( float64, float64 );
#ifdef FLOATX80
int32 syst_floatx80_to_int32( floatx80 );
int32 syst_floatx80_to_int32_round_to_zero( floatx80 );
#ifdef BITS64
int64 syst_floatx80_to_int64( floatx80 );
int64 syst_floatx80_to_int64_round_to_zero( floatx80 );
#endif
float32 syst_floatx80_to_float32( floatx80 );
float64 syst_floatx80_to_float64( floatx80 );
#ifdef FLOAT128
float128 syst_floatx80_to_float128( floatx80 );
#endif
floatx80 syst_floatx80_round_to_int( floatx80 );
floatx80 syst_floatx80_add( floatx80, floatx80 );
floatx80 syst_floatx80_sub( floatx80, floatx80 );
floatx80 syst_floatx80_mul( floatx80, floatx80 );
floatx80 syst_floatx80_div( floatx80, floatx80 );
floatx80 syst_floatx80_rem( floatx80, floatx80 );
floatx80 syst_floatx80_sqrt( floatx80 );
flag syst_floatx80_eq( floatx80, floatx80 );
flag syst_floatx80_le( floatx80, floatx80 );
flag syst_floatx80_lt( floatx80, floatx80 );
flag syst_floatx80_eq_signaling( floatx80, floatx80 );
flag syst_floatx80_le_quiet( floatx80, floatx80 );
flag syst_floatx80_lt_quiet( floatx80, floatx80 );
#endif
#ifdef FLOAT128
int32 syst_float128_to_int32( float128 );
int32 syst_float128_to_int32_round_to_zero( float128 );
#ifdef BITS64
int64 syst_float128_to_int64( float128 );
int64 syst_float128_to_int64_round_to_zero( float128 );
#endif
float32 syst_float128_to_float32( float128 );
float64 syst_float128_to_float64( float128 );
#ifdef FLOATX80
floatx80 syst_float128_to_floatx80( float128 );
#endif
float128 syst_float128_round_to_int( float128 );
float128 syst_float128_add( float128, float128 );
float128 syst_float128_sub( float128, float128 );
float128 syst_float128_mul( float128, float128 );
float128 syst_float128_div( float128, float128 );
float128 syst_float128_rem( float128, float128 );
float128 syst_float128_sqrt( float128 );
flag syst_float128_eq( float128, float128 );
flag syst_float128_le( float128, float128 );
flag syst_float128_lt( float128, float128 );
flag syst_float128_eq_signaling( float128, float128 );
flag syst_float128_le_quiet( float128, float128 );
flag syst_float128_lt_quiet( float128, float128 );
#endif

View File

@ -1,54 +0,0 @@
/*
===============================================================================
This C source file is part of TestFloat, Release 2a, a package of programs
for testing the correctness of floating-point arithmetic complying to the
IEC/IEEE Standard for Floating-Point.
Written by John R. Hauser. More information is available through the Web
page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
Derivative works are acceptable, even for commercial purposes, so long as
(1) they include prominent notice that the work is derivative, and (2) they
include prominent notice akin to these four paragraphs for those parts of
this code that are retained.
===============================================================================
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <ieeefp.h>
#include "milieu.h"
#include "systmodes.h"
/*
-------------------------------------------------------------------------------
Sets the system's IEC/IEEE floating-point rounding mode.
-------------------------------------------------------------------------------
*/
void syst_float_set_rounding_mode( int8 roundingMode )
{
(void) fpsetround( roundingMode );
}
/*
-------------------------------------------------------------------------------
Does nothing.
-------------------------------------------------------------------------------
*/
void syst_float_set_rounding_precision( int8 precision )
{
}

View File

@ -1,30 +0,0 @@
/*-
* Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.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 ``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$
*/
/*
* This file has no content and is solely to satisfy a #include in
* the FP emulator code.
*/