* include/_mingw.h (__MINGW_GNUC_PREREQ): Define. Use to

guard __MINGW_ATTRIB macro definitions.
	* include/math.h (logb[fl]):  Don't define inlines for
	GCC-4.0+ && __FAST_MATH__.
	(rint[fl], lrint[fl], llrint[fl]); Likewise.  Clean up
	line-continuation backslashes.
This commit is contained in:
Danny Smith 2005-06-16 11:41:49 +00:00
parent 7a9b2d82ec
commit dcd6cb4308
3 changed files with 57 additions and 20 deletions

View File

@ -1,9 +1,18 @@
2005-06-06 Danny Smith <dannysmith@users.sourceforge
2005-06-16 Danny Smith <dannysmith@users.sourceforge.net>
* include/_mingw.h (__MINGW_GNUC_PREREQ): Define. Use to
guard __MINGW_ATTRIB macro definitions.
* include/math.h (logb[fl]): Don't define inlines for
GCC-4.0+ && __FAST_MATH__.
(rint[fl], lrint[fl], llrint[fl]); Likewise. Clean up
line-continuation backslashes.
2005-06-06 Danny Smith <dannysmith@users.sourceforge.net>
* include/_mingw.h (__MINGW_ATTRIBUTE_NONNULL): Fix typo
in GNUC version guard.
2005-05-20 Danny Smith <dannysmith@users.sourceforge
2005-05-20 Danny Smith <dannysmith@users.sourceforge.net>
* crt1.c (_gnu_exception_handler): Handle illegal instruction
OS exception as a signal if user has defined a SIGILL handler.
@ -15,7 +24,7 @@
* mingwex/math/nextafterl.c: Add nexttowardl alias.
* mingwex/Makefile.in (MATH_DISTFILES): Add nexttoward.c,
mexttowardf.c,
(MATH_OBJS): Add nexttoward.o, mexttowardf.o,
(MATH_OBJS): Add nexttoward.o, nexttowardf.o,
* include/math.h (nexttoward, nextowardf, nexttowardl): Add
prototypes.

View File

@ -110,6 +110,14 @@
#define __CRT_INLINE extern __inline__
#endif
#if defined (__GNUC__) && defined (__GNUC_MINOR__)
#define __MINGW_GNUC_PREREQ(major, minor) \
(__GNUC__ > (major) \
|| (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
#else
#define __MINGW_GNUC_PREREQ(major, minor) 0
#endif
#ifdef __cplusplus
# define __UNUSED_PARAM(x)
#else
@ -128,7 +136,7 @@
#define __MINGW_ATTRIB_CONST
#endif
#if ( __GNUC__ >= 3)
#if __MINGW_GNUC_PREREQ (3, 0)
#define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
#define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
#else
@ -139,7 +147,7 @@
/* Attribute `nonnull' was valid as of gcc 3.3. We don't use GCC's
variadiac macro facility, because variadic macros cause syntax
errors with --traditional-cpp. */
#if (__GNUC__ > 3 ||( __GNUC__ == 3 && __GNUC_MINOR__ >= 3))
#if __MINGW_GNUC_PREREQ (3, 3)
#define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
#else
#define __MINGW_ATTRIB_NONNULL(arg)

View File

@ -500,6 +500,9 @@ extern double __cdecl logb (double);
extern float __cdecl logbf (float);
extern long double __cdecl logbl (long double);
/* Inline versions. GCC-4.0+ can do a better fast-math optimization
with __builtins. */
#if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ )
__CRT_INLINE double __cdecl logb (double x)
{
double res;
@ -523,6 +526,7 @@ __CRT_INLINE long double __cdecl logbl (long double x)
"fstp %%st" : "=t" (res) : "0" (x));
return res;
}
#endif /* !defined __FAST_MATH__ || !__MINGW_GNUC_PREREQ (4, 0) */
/* 7.12.6.12 Double in C89 */
extern float __cdecl modff (float, float*);
@ -597,6 +601,22 @@ extern long double __cdecl nearbyintl (long double);
/* 7.12.9.4 */
/* round, using fpu control word settings */
extern double __cdecl rint (double);
extern float __cdecl rintf (float);
extern long double __cdecl rintl (long double);
/* 7.12.9.5 */
extern long __cdecl lrint (double);
extern long __cdecl lrintf (float);
extern long __cdecl lrintl (long double);
extern long long __cdecl llrint (double);
extern long long __cdecl llrintf (float);
extern long long __cdecl llrintl (long double);
/* Inline versions of above.
GCC 4.0+ can do a better fast-math job with __builtins. */
#if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ )
__CRT_INLINE double __cdecl rint (double x)
{
double retval;
@ -618,54 +638,54 @@ __CRT_INLINE long double __cdecl rintl (long double x)
return retval;
}
/* 7.12.9.5 */
__CRT_INLINE long __cdecl lrint (double x)
{
long retval;
__asm__ __volatile__ \
("fistpl %0" : "=m" (retval) : "t" (x) : "st"); \
__asm__ __volatile__
("fistpl %0" : "=m" (retval) : "t" (x) : "st");
return retval;
}
__CRT_INLINE long __cdecl lrintf (float x)
{
long retval;
__asm__ __volatile__ \
("fistpl %0" : "=m" (retval) : "t" (x) : "st"); \
__asm__ __volatile__
("fistpl %0" : "=m" (retval) : "t" (x) : "st");
return retval;
}
__CRT_INLINE long __cdecl lrintl (long double x)
{
long retval;
__asm__ __volatile__ \
("fistpl %0" : "=m" (retval) : "t" (x) : "st"); \
__asm__ __volatile__
("fistpl %0" : "=m" (retval) : "t" (x) : "st");
return retval;
}
__CRT_INLINE long long __cdecl llrint (double x)
__CRT_INLINE long long __cdecl llrint (double x)
{
long long retval;
__asm__ __volatile__ \
("fistpll %0" : "=m" (retval) : "t" (x) : "st"); \
__asm__ __volatile__
("fistpll %0" : "=m" (retval) : "t" (x) : "st");
return retval;
}
__CRT_INLINE long long __cdecl llrintf (float x)
__CRT_INLINE long long __cdecl llrintf (float x)
{
long long retval;
__asm__ __volatile__ \
("fistpll %0" : "=m" (retval) : "t" (x) : "st"); \
__asm__ __volatile__
("fistpll %0" : "=m" (retval) : "t" (x) : "st");
return retval;
}
__CRT_INLINE long long __cdecl llrintl (long double x)
{
long long retval;
__asm__ __volatile__ \
("fistpll %0" : "=m" (retval) : "t" (x) : "st"); \
__asm__ __volatile__
("fistpll %0" : "=m" (retval) : "t" (x) : "st");
return retval;
}
#endif /* !__FAST_MATH__ || !__MINGW_GNUC_PREREQ (4,0) */
/* 7.12.9.6 */
/* round away from zero, regardless of fpu control word settings */