mirror of
https://git.planet-casio.com/Lephenixnoir/OpenLibm.git
synced 2024-12-28 20:43:41 +01:00
Fix build on amd64 linux
This commit is contained in:
parent
52dd430ac8
commit
87ce7cedda
9 changed files with 24 additions and 16 deletions
|
@ -41,6 +41,8 @@
|
||||||
#ifndef _X86_FPU_H_
|
#ifndef _X86_FPU_H_
|
||||||
#define _X86_FPU_H_
|
#define _X86_FPU_H_
|
||||||
|
|
||||||
|
#include "types-compat.h"
|
||||||
|
|
||||||
/* Environment information of floating point unit. */
|
/* Environment information of floating point unit. */
|
||||||
struct env87 {
|
struct env87 {
|
||||||
int32_t en_cw; /* control word (16bits) */
|
int32_t en_cw; /* control word (16bits) */
|
||||||
|
@ -128,7 +130,7 @@ struct savexmm {
|
||||||
} sv_fp[8];
|
} sv_fp[8];
|
||||||
struct xmmacc sv_xmm[8];
|
struct xmmacc sv_xmm[8];
|
||||||
uint8_t sv_pad[224];
|
uint8_t sv_pad[224];
|
||||||
} __aligned(16);
|
} __attribute__ ((aligned(16)));
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
union savefpu {
|
union savefpu {
|
||||||
|
@ -145,7 +147,7 @@ struct savefpu {
|
||||||
} sv_fp[8];
|
} sv_fp[8];
|
||||||
struct xmmacc sv_xmm[16];
|
struct xmmacc sv_xmm[16];
|
||||||
uint8_t sv_pad[96];
|
uint8_t sv_pad[96];
|
||||||
} __aligned(16);
|
} __attribute__ ((aligned(16)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct xstate_hdr {
|
struct xstate_hdr {
|
||||||
|
@ -168,7 +170,7 @@ struct savexmm_ymm {
|
||||||
struct xmmacc sv_xmm[16];
|
struct xmmacc sv_xmm[16];
|
||||||
uint8_t sv_pad[96];
|
uint8_t sv_pad[96];
|
||||||
struct savexmm_xstate sv_xstate;
|
struct savexmm_xstate sv_xstate;
|
||||||
} __aligned(64);
|
} __attribute__ ((aligned(16)));
|
||||||
|
|
||||||
struct savefpu_xstate {
|
struct savefpu_xstate {
|
||||||
struct xstate_hdr sx_hd;
|
struct xstate_hdr sx_hd;
|
||||||
|
@ -184,7 +186,7 @@ struct savefpu_ymm {
|
||||||
struct xmmacc sv_xmm[16];
|
struct xmmacc sv_xmm[16];
|
||||||
uint8_t sv_pad[96];
|
uint8_t sv_pad[96];
|
||||||
struct savefpu_xstate sv_xstate;
|
struct savefpu_xstate sv_xstate;
|
||||||
} __aligned(64);
|
} __attribute__ ((aligned(64)));
|
||||||
|
|
||||||
#undef __envxmm32
|
#undef __envxmm32
|
||||||
#undef __envxmm64
|
#undef __envxmm64
|
||||||
|
|
|
@ -26,11 +26,9 @@
|
||||||
* $FreeBSD: src/lib/msun/amd64/fenv.c,v 1.8 2011/10/21 06:25:31 das Exp $
|
* $FreeBSD: src/lib/msun/amd64/fenv.c,v 1.8 2011/10/21 06:25:31 das Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include "bsd_fpu.h"
|
#include "bsd_fpu.h"
|
||||||
|
|
||||||
#define __fenv_static
|
#define _fenv_static
|
||||||
#include "fenv.h"
|
#include "fenv.h"
|
||||||
|
|
||||||
#ifdef __GNUC_GNU_INLINE__
|
#ifdef __GNUC_GNU_INLINE__
|
||||||
|
|
|
@ -93,7 +93,7 @@ extern const fenv_t __fe_dfl_env;
|
||||||
#define __ldmxcsr(__csr) __asm __volatile("ldmxcsr %0" : : "m" (__csr))
|
#define __ldmxcsr(__csr) __asm __volatile("ldmxcsr %0" : : "m" (__csr))
|
||||||
#define __stmxcsr(__csr) __asm __volatile("stmxcsr %0" : "=m" (*(__csr)))
|
#define __stmxcsr(__csr) __asm __volatile("stmxcsr %0" : "=m" (*(__csr)))
|
||||||
|
|
||||||
__fenv_static inline int
|
__fenv_static __attribute__((always_inline)) inline int
|
||||||
feclearexcept(int __excepts)
|
feclearexcept(int __excepts)
|
||||||
{
|
{
|
||||||
fenv_t __env;
|
fenv_t __env;
|
||||||
|
@ -126,7 +126,7 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts)
|
||||||
int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
|
int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
|
||||||
int feraiseexcept(int __excepts);
|
int feraiseexcept(int __excepts);
|
||||||
|
|
||||||
__fenv_static inline int
|
__fenv_static __attribute__((always_inline)) inline int
|
||||||
fetestexcept(int __excepts)
|
fetestexcept(int __excepts)
|
||||||
{
|
{
|
||||||
uint32_t __mxcsr;
|
uint32_t __mxcsr;
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
#ifndef _FENV_H_
|
#ifndef _FENV_H_
|
||||||
#define _FENV_H_
|
#define _FENV_H_
|
||||||
|
|
||||||
#include "include/cdefs-compat.h"
|
#include "cdefs-compat.h"
|
||||||
#include "include/types-compat.h"
|
#include "types-compat.h"
|
||||||
|
|
||||||
#ifndef __fenv_static
|
#ifndef __fenv_static
|
||||||
#define __fenv_static static
|
#define __fenv_static static
|
||||||
|
|
5
include/fenv.h
Normal file
5
include/fenv.h
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#ifdef __LP64
|
||||||
|
#include "../amd64/fenv.h"
|
||||||
|
#else
|
||||||
|
#include "../i387/fenv.h"
|
||||||
|
#endif
|
|
@ -15,7 +15,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
/* Not sure what to do about __pure2 on linux */
|
/* Not sure what to do about __pure2 on windows */
|
||||||
#define __pure2
|
#define __pure2
|
||||||
typedef uint8_t u_int8_t;
|
typedef uint8_t u_int8_t;
|
||||||
typedef uint16_t u_int16_t;
|
typedef uint16_t u_int16_t;
|
||||||
|
|
3
test/.gitignore
vendored
3
test/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
/test-float
|
/test-float
|
||||||
/test-double
|
/test-float-system
|
||||||
|
/test-double-system
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
OPENLIBM_HOME=$(abspath ..)
|
OPENLIBM_HOME=$(abspath ..)
|
||||||
include ../Make.inc
|
include ../Make.inc
|
||||||
|
|
||||||
all: test-double test-float test-double-system
|
all: test-double test-float test-double-system test-float-system
|
||||||
|
|
||||||
test-double: test-double.c libm-test.c
|
test-double: test-double.c libm-test.c
|
||||||
$(CC) -g $< -D__BSD_VISIBLE -I ../include -I../src ../libopenlibm.a -o $@
|
$(CC) -g $@.c -D__BSD_VISIBLE -I ../include -I../src ../libopenlibm.a -o $@
|
||||||
|
|
||||||
test-float: test-float.c libm-test.c
|
test-float: test-float.c libm-test.c
|
||||||
$(CC) -g $< -D__BSD_VISIBLE -I ../include -I../src ../libopenlibm.a -o $@
|
$(CC) -g $@.c -D__BSD_VISIBLE -I ../include -I../src ../libopenlibm.a -o $@
|
||||||
|
|
||||||
test-double-system: test-double.c libm-test.c
|
test-double-system: test-double.c libm-test.c
|
||||||
$(CC) -g $< -DSYS_MATH_H -lm -o $@
|
$(CC) -g $< -DSYS_MATH_H -lm -o $@
|
||||||
|
|
|
@ -224,11 +224,13 @@ static FLOAT max_error, real_max_error, imag_max_error;
|
||||||
#define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1), \
|
#define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1), \
|
||||||
(LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
|
(LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
|
||||||
|
|
||||||
|
#ifndef SYS_MATH_H
|
||||||
void FUNC(sincos) (int n, FLOAT *s, FLOAT *c)
|
void FUNC(sincos) (int n, FLOAT *s, FLOAT *c)
|
||||||
{
|
{
|
||||||
*s = FUNC(sin) ( *s );
|
*s = FUNC(sin) ( *s );
|
||||||
*c = FUNC(cos) ( *c );
|
*c = FUNC(cos) ( *c );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_max_error (void)
|
init_max_error (void)
|
||||||
|
|
Loading…
Reference in a new issue