Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2005-06-16 15:41:49 +0400
committerDanny Smith <dannysmith@users.sourceforge.net>2005-06-16 15:41:49 +0400
commitdcd6cb4308703ef1ed82d90466e31e5d3aff1994 (patch)
treef79667431dc4f64efa7e07519097b2aa1a40e2e7
parent7a9b2d82ec43d9704a28af6c621856997fb1b1fb (diff)
* 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.
-rw-r--r--winsup/mingw/ChangeLog15
-rw-r--r--winsup/mingw/include/_mingw.h12
-rw-r--r--winsup/mingw/include/math.h50
3 files changed, 57 insertions, 20 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog
index 01793dfee..9aeb29278 100644
--- a/winsup/mingw/ChangeLog
+++ b/winsup/mingw/ChangeLog
@@ -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.
diff --git a/winsup/mingw/include/_mingw.h b/winsup/mingw/include/_mingw.h
index 4b3b42d6c..2d7a47cde 100644
--- a/winsup/mingw/include/_mingw.h
+++ b/winsup/mingw/include/_mingw.h
@@ -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)
diff --git a/winsup/mingw/include/math.h b/winsup/mingw/include/math.h
index 2f39aeb3a..c7800623f 100644
--- a/winsup/mingw/include/math.h
+++ b/winsup/mingw/include/math.h
@@ -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 */