Meta: Add OpenLibm
This commit is contained in:
parent
4a72f35e9b
commit
172b4ce7a3
724 changed files with 51312 additions and 0 deletions
7
src/openlibm/amd64/Make.files
Normal file
7
src/openlibm/amd64/Make.files
Normal file
|
@ -0,0 +1,7 @@
|
|||
$(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 \
|
||||
e_fmod.S e_fmodf.S e_fmodl.S
|
110
src/openlibm/amd64/bsd_asm.h
Normal file
110
src/openlibm/amd64/bsd_asm.h
Normal file
|
@ -0,0 +1,110 @@
|
|||
/*-
|
||||
* 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_ */
|
218
src/openlibm/amd64/bsd_fpu.h
Normal file
218
src/openlibm/amd64/bsd_fpu.h
Normal file
|
@ -0,0 +1,218 @@
|
|||
/*-
|
||||
* 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_ */
|
272
src/openlibm/amd64/bsd_ieeefp.h
Normal file
272
src/openlibm/amd64/bsd_ieeefp.h
Normal file
|
@ -0,0 +1,272 @@
|
|||
/*-
|
||||
* 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_ */
|
56
src/openlibm/amd64/e_fmod.S
Normal file
56
src/openlibm/amd64/e_fmod.S
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 1993,94 Winning Strategies, Inc.
|
||||
* 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 Winning Strategies, Inc.
|
||||
* 4. The name of the author 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Based on the i387 version written by:
|
||||
* J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
|
||||
*/
|
||||
|
||||
#include <amd64/bsd_asm.h>
|
||||
|
||||
ENTRY(fmod)
|
||||
movsd %xmm0,-8(%rsp)
|
||||
movsd %xmm1,-16(%rsp)
|
||||
fldl -16(%rsp)
|
||||
fldl -8(%rsp)
|
||||
1: fprem
|
||||
fstsw %ax
|
||||
testw $0x400,%ax
|
||||
jne 1b
|
||||
fstpl -8(%rsp)
|
||||
movsd -8(%rsp),%xmm0
|
||||
fstp %st
|
||||
ret
|
||||
END(fmod)
|
||||
|
||||
/* Enable stack protection */
|
||||
#if defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
BIN
src/openlibm/amd64/e_fmod.S.o
Normal file
BIN
src/openlibm/amd64/e_fmod.S.o
Normal file
Binary file not shown.
26
src/openlibm/amd64/e_fmodf.S
Normal file
26
src/openlibm/amd64/e_fmodf.S
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Based on the i387 version written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <amd64/bsd_asm.h>
|
||||
|
||||
ENTRY(fmodf)
|
||||
movss %xmm0,-4(%rsp)
|
||||
movss %xmm1,-8(%rsp)
|
||||
flds -8(%rsp)
|
||||
flds -4(%rsp)
|
||||
1: fprem
|
||||
fstsw %ax
|
||||
testw $0x400,%ax
|
||||
jne 1b
|
||||
fstps -4(%rsp)
|
||||
movss -4(%rsp),%xmm0
|
||||
fstp %st
|
||||
ret
|
||||
END(fmodf)
|
||||
|
||||
/* Enable stack protection */
|
||||
#if defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
BIN
src/openlibm/amd64/e_fmodf.S.o
Normal file
BIN
src/openlibm/amd64/e_fmodf.S.o
Normal file
Binary file not shown.
52
src/openlibm/amd64/e_fmodl.S
Normal file
52
src/openlibm/amd64/e_fmodl.S
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 1993,94 Winning Strategies, Inc.
|
||||
* 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 Winning Strategies, Inc.
|
||||
* 4. The name of the author 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Based on the i387 version written by:
|
||||
* J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
|
||||
*/
|
||||
|
||||
#include <amd64/bsd_asm.h>
|
||||
|
||||
ENTRY(fmodl)
|
||||
fldt 24(%rsp)
|
||||
fldt 8(%rsp)
|
||||
1: fprem
|
||||
fstsw %ax
|
||||
testw $0x400,%ax
|
||||
jne 1b
|
||||
fstp %st(1)
|
||||
ret
|
||||
END(fmodl)
|
||||
|
||||
/* Enable stack protection */
|
||||
#if defined(__ELF__)
|
||||
.section .note.GNU-stack,"",%progbits
|
||||
#endif
|
BIN
src/openlibm/amd64/e_fmodl.S.o
Normal file
BIN
src/openlibm/amd64/e_fmodl.S.o
Normal file
Binary file not shown.
30
src/openlibm/amd64/e_remainder.S
Normal file
30
src/openlibm/amd64/e_remainder.S
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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
|
BIN
src/openlibm/amd64/e_remainder.S.o
Normal file
BIN
src/openlibm/amd64/e_remainder.S.o
Normal file
Binary file not shown.
29
src/openlibm/amd64/e_remainderf.S
Normal file
29
src/openlibm/amd64/e_remainderf.S
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* 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
|
BIN
src/openlibm/amd64/e_remainderf.S.o
Normal file
BIN
src/openlibm/amd64/e_remainderf.S.o
Normal file
Binary file not shown.
35
src/openlibm/amd64/e_remainderl.S
Normal file
35
src/openlibm/amd64/e_remainderl.S
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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
|
BIN
src/openlibm/amd64/e_remainderl.S.o
Normal file
BIN
src/openlibm/amd64/e_remainderl.S.o
Normal file
Binary file not shown.
40
src/openlibm/amd64/e_sqrt.S
Normal file
40
src/openlibm/amd64/e_sqrt.S
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*-
|
||||
* 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
|
BIN
src/openlibm/amd64/e_sqrt.S.o
Normal file
BIN
src/openlibm/amd64/e_sqrt.S.o
Normal file
Binary file not shown.
39
src/openlibm/amd64/e_sqrtf.S
Normal file
39
src/openlibm/amd64/e_sqrtf.S
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*-
|
||||
* 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
|
BIN
src/openlibm/amd64/e_sqrtf.S.o
Normal file
BIN
src/openlibm/amd64/e_sqrtf.S.o
Normal file
Binary file not shown.
46
src/openlibm/amd64/e_sqrtl.S
Normal file
46
src/openlibm/amd64/e_sqrtl.S
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*-
|
||||
* 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
|
BIN
src/openlibm/amd64/e_sqrtl.S.o
Normal file
BIN
src/openlibm/amd64/e_sqrtl.S.o
Normal file
Binary file not shown.
162
src/openlibm/amd64/fenv.c
Normal file
162
src/openlibm/amd64/fenv.c
Normal file
|
@ -0,0 +1,162 @@
|
|||
/*-
|
||||
* 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);
|
||||
}
|
BIN
src/openlibm/amd64/fenv.c.o
Normal file
BIN
src/openlibm/amd64/fenv.c.o
Normal file
Binary file not shown.
12
src/openlibm/amd64/s_llrint.S
Normal file
12
src/openlibm/amd64/s_llrint.S
Normal file
|
@ -0,0 +1,12 @@
|
|||
#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
|
BIN
src/openlibm/amd64/s_llrint.S.o
Normal file
BIN
src/openlibm/amd64/s_llrint.S.o
Normal file
Binary file not shown.
12
src/openlibm/amd64/s_llrintf.S
Normal file
12
src/openlibm/amd64/s_llrintf.S
Normal file
|
@ -0,0 +1,12 @@
|
|||
#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
|
BIN
src/openlibm/amd64/s_llrintf.S.o
Normal file
BIN
src/openlibm/amd64/s_llrintf.S.o
Normal file
Binary file not shown.
45
src/openlibm/amd64/s_llrintl.S
Normal file
45
src/openlibm/amd64/s_llrintl.S
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*-
|
||||
* 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
|
BIN
src/openlibm/amd64/s_llrintl.S.o
Normal file
BIN
src/openlibm/amd64/s_llrintl.S.o
Normal file
Binary file not shown.
29
src/openlibm/amd64/s_logbl.S
Normal file
29
src/openlibm/amd64/s_logbl.S
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* 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
|
BIN
src/openlibm/amd64/s_logbl.S.o
Normal file
BIN
src/openlibm/amd64/s_logbl.S.o
Normal file
Binary file not shown.
44
src/openlibm/amd64/s_lrint.S
Normal file
44
src/openlibm/amd64/s_lrint.S
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*-
|
||||
* 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
|
BIN
src/openlibm/amd64/s_lrint.S.o
Normal file
BIN
src/openlibm/amd64/s_lrint.S.o
Normal file
Binary file not shown.
44
src/openlibm/amd64/s_lrintf.S
Normal file
44
src/openlibm/amd64/s_lrintf.S
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*-
|
||||
* 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
|
BIN
src/openlibm/amd64/s_lrintf.S.o
Normal file
BIN
src/openlibm/amd64/s_lrintf.S.o
Normal file
Binary file not shown.
45
src/openlibm/amd64/s_lrintl.S
Normal file
45
src/openlibm/amd64/s_lrintl.S
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*-
|
||||
* 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
|
BIN
src/openlibm/amd64/s_lrintl.S.o
Normal file
BIN
src/openlibm/amd64/s_lrintl.S.o
Normal file
Binary file not shown.
76
src/openlibm/amd64/s_remquo.S
Normal file
76
src/openlibm/amd64/s_remquo.S
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*-
|
||||
* 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
|
BIN
src/openlibm/amd64/s_remquo.S.o
Normal file
BIN
src/openlibm/amd64/s_remquo.S.o
Normal file
Binary file not shown.
76
src/openlibm/amd64/s_remquof.S
Normal file
76
src/openlibm/amd64/s_remquof.S
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*-
|
||||
* 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
|
BIN
src/openlibm/amd64/s_remquof.S.o
Normal file
BIN
src/openlibm/amd64/s_remquof.S.o
Normal file
Binary file not shown.
81
src/openlibm/amd64/s_remquol.S
Normal file
81
src/openlibm/amd64/s_remquol.S
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*-
|
||||
* 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
|
BIN
src/openlibm/amd64/s_remquol.S.o
Normal file
BIN
src/openlibm/amd64/s_remquol.S.o
Normal file
Binary file not shown.
26
src/openlibm/amd64/s_rintl.S
Normal file
26
src/openlibm/amd64/s_rintl.S
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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
|
BIN
src/openlibm/amd64/s_rintl.S.o
Normal file
BIN
src/openlibm/amd64/s_rintl.S.o
Normal file
Binary file not shown.
55
src/openlibm/amd64/s_scalbn.S
Normal file
55
src/openlibm/amd64/s_scalbn.S
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*-
|
||||
* 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
|
BIN
src/openlibm/amd64/s_scalbn.S.o
Normal file
BIN
src/openlibm/amd64/s_scalbn.S.o
Normal file
Binary file not shown.
55
src/openlibm/amd64/s_scalbnf.S
Normal file
55
src/openlibm/amd64/s_scalbnf.S
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*-
|
||||
* 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
|
BIN
src/openlibm/amd64/s_scalbnf.S.o
Normal file
BIN
src/openlibm/amd64/s_scalbnf.S.o
Normal file
Binary file not shown.
40
src/openlibm/amd64/s_scalbnl.S
Normal file
40
src/openlibm/amd64/s_scalbnl.S
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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
|
BIN
src/openlibm/amd64/s_scalbnl.S.o
Normal file
BIN
src/openlibm/amd64/s_scalbnl.S.o
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue