I've extended the patch a bit, see attachment. Does this look
reasonable ? Basically I've changed all the inline assembler definitions
in a simple function definition, under the #if __MINGW32CE__ condition.

        Danny

On Wed, 2007-01-31 at 20:26 +0000, Nuno Lucas wrote:
> On 1/31/07, Danny Backx <[EMAIL PROTECTED]> wrote:
> > That's only a partial solution : from my scan, the "asm" construction
> > occurs in these places in math.h :
> >
> [...]
> > Your patch only addresses the lines between 634 and 703.
> 
> I'm aware of that, but I didn't know if the patch was the right thing
> to do, and the others weren't generating errors (most probably because
> I wasn't using them in the source I was compiling), so I left the
> others out, waiting for someone to say something.
> 
> > Some of the other constructions are less simple to fix, e.g. the first
> > one (definition of __fpclassifyl at line 362) doesn't appear to have an
> > equivalent anywhere else. There's no declaration for it in math.h, and
> > the only other mention of that function appears to be in
> > src/mingw/mingwex/math/fpclassifyl.c where it is coded in assembler
> > similar but slightly different from the implementation in math.h .
> 
> As I have no idea on the ARM assembly code (I did had some practice on
> MIPS assembly on the University, but that was some years ago), I'll
> have to leave that to who knows it.
> 
> Anyway, in the case of mingw32ce, I think we should only implement
> what is trivial or already implemented on mingw, and let the user make
> it's own routines if it needs to.
> 
> 
> Best regards,
> ~Nuno Lucas
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Cegcc-devel mailing list
> Cegcc-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cegcc-devel
-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
Index: math.h
===================================================================
--- math.h	(revision 856)
+++ math.h	(working copy)
@@ -329,11 +329,15 @@
 extern int __cdecl __fpclassifyf (float);
 extern int __cdecl __fpclassify (double);
 
+#ifdef	__MINGW32CE__
+extern int __cdecl __fpclassifyl (long double);
+#else
 __CRT_INLINE int __cdecl __fpclassifyl (long double x){
   unsigned short sw;
   __asm__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x));
   return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
 }
+#endif
 
 #define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x)	  \
 		       : sizeof (x) == sizeof (double) ? __fpclassify (x) \
@@ -349,6 +353,11 @@
 /* We don't need to worry about trucation here:
    A NaN stays a NaN. */
 
+#ifdef	__MINGW32CE__
+extern int __cdecl __isnan (double);
+extern int __cdecl __isnanf (float);
+extern int __cdecl __isnanl (long double);
+#else
 __CRT_INLINE int __cdecl __isnan (double _x)
 {
   unsigned short sw;
@@ -375,6 +384,7 @@
   return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL))
     == FP_NAN;
 }
+#endif
 
 
 #define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x)	\
@@ -384,6 +394,11 @@
 /* 7.12.3.5 */
 #define isnormal(x) (fpclassify(x) == FP_NORMAL)
 
+#ifdef	__MINGW32CE__
+extern int __cdecl __signbit (double);
+extern int __cdecl __signbitf (float);
+extern int __cdecl __signbitl (long double);
+#else
 /* 7.12.3.6 The signbit macro */
 __CRT_INLINE int __cdecl __signbit (double x) {
   unsigned short stw;
@@ -402,6 +417,7 @@
   __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x));
   return (stw & 0x0200) != 0;
 }
+#endif
 
 #define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x)	\
 		    : sizeof (x) == sizeof (double) ? __signbit (x)	\
@@ -517,7 +533,7 @@
 
 /* Inline versions.  GCC-4.0+ can do a better fast-math optimization
    with __builtins. */ 
-#if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ )
+#if !defined(__MINGW32CE__ & !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ )
 __CRT_INLINE double __cdecl logb (double x)
 {
   double res;
@@ -631,7 +647,7 @@
 
 /* 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__ )
+#if !defined(__MINGW32CE__) && !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ )
 __CRT_INLINE double __cdecl rint (double x)
 {
   double retval;
@@ -811,6 +827,9 @@
 
 #else
 /*  helper  */
+#ifdef	__MINGW32CE__
+extern int  __cdecl __fp_unordered_compare (long double, long double);
+#else
 __CRT_INLINE int  __cdecl
 __fp_unordered_compare (long double x, long double y){
   unsigned short retval;
@@ -818,6 +837,7 @@
 	   "fnstsw;": "=a" (retval) : "t" (x), "u" (y));
   return retval;
 }
+#endif
 
 #define isgreater(x, y) ((__fp_unordered_compare(x, y) \
 			   & 0x4500) == 0)

Attachment: signature.asc
Description: This is a digitally signed message part

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to