ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/uae_cpu/fpu/mathlib.h
(Generate patch)

Comparing BasiliskII/src/uae_cpu/fpu/mathlib.h (file contents):
Revision 1.1 by gbeauche, 2002-09-13T12:50:40Z vs.
Revision 1.9 by gbeauche, 2005-01-30T21:42:16Z

# Line 1 | Line 1
1   /*
2   *  fpu/mathlib.h - Floating-point math support library
3   *
4 < *  Basilisk II (C) 1997-2001 Christian Bauer
4 > *  Basilisk II (C) 1997-2005 Christian Bauer
5   *
6   *  MC68881/68040 fpu emulation
7   *  
# Line 103 | Line 103 | union fpu_single_shape {
103  
104          /* This is the IEEE 754 single-precision format.  */
105          struct {
106 < #if UAE_BYTE_ORDER == UAE_BIG_ENDIAN
106 > #ifdef WORDS_BIGENDIAN
107                  unsigned int negative:1;
108                  unsigned int exponent:8;
109                  unsigned int mantissa:23;
110 < #endif                          /* Big endian.  */
111 < #if UAE_BYTE_ORDER == UAE_LITTLE_ENDIAN
110 > #else
111                  unsigned int mantissa:23;
112                  unsigned int exponent:8;
113                  unsigned int negative:1;
114 < #endif                          /* Little endian.  */
114 > #endif
115          } ieee;
116  
117          /* This format makes it easier to see if a NaN is a signalling NaN.  */
118          struct {
119 < #if UAE_BYTE_ORDER == UAE_BIG_ENDIAN
119 > #ifdef WORDS_BIGENDIAN
120                  unsigned int negative:1;
121                  unsigned int exponent:8;
122                  unsigned int quiet_nan:1;
123                  unsigned int mantissa:22;
124 < #endif                          /* Big endian.  */
126 < #if UAE_BYTE_ORDER == UAE_LITTLE_ENDIAN
124 > #else
125                  unsigned int mantissa:22;
126                  unsigned int quiet_nan:1;
127                  unsigned int exponent:8;
128                  unsigned int negative:1;
129 < #endif                          /* Little endian.  */
129 > #endif
130          } ieee_nan;
131   };
132  
# Line 138 | Line 136 | union fpu_double_shape {
136          
137          /* This is the IEEE 754 double-precision format.  */
138          struct {
139 < #if UAE_BYTE_ORDER == UAE_BIG_ENDIAN
139 > #ifdef WORDS_BIGENDIAN
140                  unsigned int negative:1;
141                  unsigned int exponent:11;
142                  /* Together these comprise the mantissa.  */
143                  unsigned int mantissa0:20;
144                  unsigned int mantissa1:32;
145 < #endif                          /* Big endian.  */
146 < #if UAE_BYTE_ORDER == UAE_LITTLE_ENDIAN
149 < #       if UAE_FLOAT_WORD_ORDER == UAE_BIG_ENDIAN
145 > #else
146 > #       if HOST_FLOAT_WORDS_BIG_ENDIAN
147                  unsigned int mantissa0:20;
148                  unsigned int exponent:11;
149                  unsigned int negative:1;
# Line 158 | Line 155 | union fpu_double_shape {
155                  unsigned int exponent:11;
156                  unsigned int negative:1;
157   #       endif
158 < #endif                          /* Little endian.  */
158 > #endif
159          } ieee;
160  
161          /* This format makes it easier to see if a NaN is a signalling NaN.  */
162          struct {
163 < #if UAE_BYTE_ORDER == UAE_BIG_ENDIAN
163 > #ifdef WORDS_BIGENDIAN
164                  unsigned int negative:1;
165                  unsigned int exponent:11;
166                  unsigned int quiet_nan:1;
# Line 171 | Line 168 | union fpu_double_shape {
168                  unsigned int mantissa0:19;
169                  unsigned int mantissa1:32;
170   #else
171 < # if UAE_FLOAT_WORD_ORDER == UAE_BIG_ENDIAN
171 > #       if HOST_FLOAT_WORDS_BIG_ENDIAN
172                  unsigned int mantissa0:19;
173                  unsigned int quiet_nan:1;
174                  unsigned int exponent:11;
# Line 187 | Line 184 | union fpu_double_shape {
184   #       endif
185   #endif
186          } ieee_nan;
190 };
187  
188 < #if SIZEOF_LONG_DOUBLE == 12
189 < # undef USE_QUAD_DOUBLE
190 < #elif SIZEOF_LONG_DOUBLE == 16
191 < # define USE_QUAD_DOUBLE
188 >        /* This format is used to extract the sign_exponent and mantissa parts only */
189 >        struct {
190 > #if HOST_FLOAT_WORDS_BIG_ENDIAN
191 >                unsigned int msw:32;
192 >                unsigned int lsw:32;
193   #else
194 < # error "unsupported long double format"
194 >                unsigned int lsw:32;
195 >                unsigned int msw:32;
196   #endif
197 +        } parts;
198 + };
199  
200 < #ifndef USE_QUAD_DOUBLE
200 > #ifdef USE_LONG_DOUBLE
201   // IEEE-854 long double format
202   union fpu_extended_shape {
203          fpu_extended value;
204          
205          /* This is the IEEE 854 double-extended-precision format.  */
206          struct {
207 < #if UAE_BYTE_ORDER == UAE_BIG_ENDIAN
207 > #ifdef WORDS_BIGENDIAN
208                  unsigned int negative:1;
209                  unsigned int exponent:15;
210                  unsigned int empty:16;
211                  unsigned int mantissa0:32;
212                  unsigned int mantissa1:32;
213 < #endif
214 < #if UAE_BYTE_ORDER == UAE_LITTLE_ENDIAN
215 < #       if UAE_FLOAT_WORD_ORDER == UAE_BIG_ENDIAN
213 > #else
214 > #       if HOST_FLOAT_WORDS_BIG_ENDIAN
215                  unsigned int exponent:15;
216                  unsigned int negative:1;
217                  unsigned int empty:16;
# Line 230 | Line 229 | union fpu_extended_shape {
229  
230          /* This is for NaNs in the IEEE 854 double-extended-precision format.  */
231          struct {
232 < #if UAE_BYTE_ORDER == UAE_BIG_ENDIAN
232 > #ifdef WORDS_BIGENDIAN
233                  unsigned int negative:1;
234                  unsigned int exponent:15;
235                  unsigned int empty:16;
# Line 238 | Line 237 | union fpu_extended_shape {
237                  unsigned int quiet_nan:1;
238                  unsigned int mantissa0:30;
239                  unsigned int mantissa1:32;
240 < #endif
241 < #if UAE_BYTE_ORDER == UAE_LITTLE_ENDIAN
243 < #       if UAE_FLOAT_WORD_ORDER == UAE_BIG_ENDIAN
240 > #else
241 > #       if HOST_FLOAT_WORDS_BIG_ENDIAN
242                  unsigned int exponent:15;
243                  unsigned int negative:1;
244                  unsigned int empty:16;
# Line 262 | Line 260 | union fpu_extended_shape {
260          
261          /* This format is used to extract the sign_exponent and mantissa parts only */
262          struct {
263 < #if UAE_FLOAT_WORD_ORDER == UAE_BIG_ENDIAN
263 > #if HOST_FLOAT_WORDS_BIG_ENDIAN
264                  unsigned int sign_exponent:16;
265                  unsigned int empty:16;
266                  unsigned int msw:32;
# Line 275 | Line 273 | union fpu_extended_shape {
273   #endif
274          } parts;
275   };
276 < #else
276 > #endif
277 >
278 > #ifdef USE_QUAD_DOUBLE
279   // IEEE-854 quad double format
280   union fpu_extended_shape {
281          fpu_extended value;
282          
283          /* This is the IEEE 854 quad-precision format.  */
284          struct {
285 < #if UAE_BYTE_ORDER == UAE_BIG_ENDIAN
285 > #ifdef WORDS_BIGENDIAN
286                  unsigned int negative:1;
287                  unsigned int exponent:15;
288                  unsigned int mantissa0:16;
# Line 301 | Line 301 | union fpu_extended_shape {
301  
302          /* This is for NaNs in the IEEE 854 quad-precision format.  */
303          struct {
304 < #if UAE_BYTE_ORDER == UAE_BIG_ENDIAN
304 > #ifdef WORDS_BIGENDIAN
305                  unsigned int negative:1;
306                  unsigned int exponent:15;
307                  unsigned int quiet_nan:1;
# Line 321 | Line 321 | union fpu_extended_shape {
321          } ieee_nan;
322  
323          /* This format is used to extract the sign_exponent and mantissa parts only */
324 < #if UAE_FLOAT_WORD_ORDER == UAE_BIG_ENDIAN
324 > #if HOST_FLOAT_WORDS_BIG_ENDIAN
325          struct {
326                  uae_u64 msw;
327                  uae_u64 lsw;
# Line 345 | Line 345 | union fpu_extended_shape {
345          } parts32;
346   #endif
347   };
348 < #endif // !USE_QUAD_DOUBLE
348 > #endif
349  
350   // Declare and initialize a pointer to a shape of the requested FP type
351   #define fp_declare_init_shape(psvar, rfvar, ftype) \
# Line 365 | Line 365 | union fpu_extended_shape {
365  
366   PRIVATE inline bool FFPU fp_do_isnan(fpu_register const & r)
367   {
368        fp_declare_init_shape(sxp, r, extended);
368   #ifdef BRANCHES_ARE_EXPENSIVE
369 < #ifdef USE_QUAD_DOUBLE
369 > #ifndef USE_LONG_DOUBLE
370 >        fp_declare_init_shape(sxp, r, double);
371 >        uae_s32 hx = sxp->parts.msw;
372 >        uae_s32 lx = sxp->parts.lsw;
373 >        hx &= 0x7fffffff;
374 >        hx |= (uae_u32)(lx | (-lx)) >> 31;
375 >        hx = 0x7ff00000 - hx;
376 >        return (int)(((uae_u32)hx) >> 31);
377 > #elif USE_QUAD_DOUBLE
378 >        fp_declare_init_shape(sxp, r, extended);
379          uae_s64 hx = sxp->parts64.msw;
380          uae_s64 lx = sxp->parts64.lsw;
381          hx &= 0x7fffffffffffffffLL;
# Line 375 | Line 383 | PRIVATE inline bool FFPU fp_do_isnan(fpu
383          hx = 0x7fff000000000000LL - hx;
384          return (int)((uae_u64)hx >> 63);
385   #else
386 +        fp_declare_init_shape(sxp, r, extended);
387          uae_s32 se = sxp->parts.sign_exponent;
388          uae_s32 hx = sxp->parts.msw;
389          uae_s32 lx = sxp->parts.lsw;
# Line 386 | Line 395 | PRIVATE inline bool FFPU fp_do_isnan(fpu
395          return (int)(((uae_u32)(se)) >> 16);
396   #endif
397   #else
398 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
399 +        fp_declare_init_shape(sxp, r, extended);
400          return  (sxp->ieee_nan.exponent == FP_EXTENDED_EXP_MAX)
401 + #else
402 +        fp_declare_init_shape(sxp, r, double);
403 +        return  (sxp->ieee_nan.exponent == FP_DOUBLE_EXP_MAX)
404 + #endif
405                  &&      (sxp->ieee_nan.mantissa0 != 0)
406                  &&      (sxp->ieee_nan.mantissa1 != 0)
407   #ifdef USE_QUAD_DOUBLE
# Line 406 | Line 421 | PRIVATE inline bool FFPU fp_do_isnan(fpu
421  
422   PRIVATE inline bool FFPU fp_do_isinf(fpu_register const & r)
423   {
409        fp_declare_init_shape(sxp, r, extended);
424   #ifdef BRANCHES_ARE_EXPENSIVE
425 < #ifdef USE_QUAD_DOUBLE
425 > #ifndef USE_LONG_DOUBLE
426 >        fp_declare_init_shape(sxp, r, double);
427 >        uae_s32 hx = sxp->parts.msw;
428 >        uae_s32 lx = sxp->parts.lsw;
429 >        lx |= (hx & 0x7fffffff) ^ 0x7ff00000;
430 >        lx |= -lx;
431 >        return ~(lx >> 31) & (hx >> 30);
432 > #elif USE_QUAD_DOUBLE
433 >        fp_declare_init_shape(sxp, r, extended);
434          uae_s64 hx = sxp->parts64.msw;
435          uae_s64 lx = sxp->parts64.lsw;
436          lx |= (hx & 0x7fffffffffffffffLL) ^ 0x7fff000000000000LL;
437          lx |= -lx;
438          return ~(lx >> 63) & (hx >> 62);
439   #else
440 +        fp_declare_init_shape(sxp, r, extended);
441          uae_s32 se = sxp->parts.sign_exponent;
442          uae_s32 hx = sxp->parts.msw;
443          uae_s32 lx = sxp->parts.lsw;
# Line 431 | Line 454 | PRIVATE inline bool FFPU fp_do_isinf(fpu
454          return ~(lx >> 31) & (1 - (se >> 14));
455   #endif
456   #else
457 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
458 +        fp_declare_init_shape(sxp, r, extended);
459          return  (sxp->ieee_nan.exponent == FP_EXTENDED_EXP_MAX)
460 + #else
461 +        fp_declare_init_shape(sxp, r, double);
462 +        return  (sxp->ieee_nan.exponent == FP_DOUBLE_EXP_MAX)
463 + #endif
464                  &&      (sxp->ieee_nan.mantissa0 == 0)
465                  &&      (sxp->ieee_nan.mantissa1 == 0)
466   #ifdef USE_QUAD_DOUBLE
# Line 447 | Line 476 | PRIVATE inline bool FFPU fp_do_isinf(fpu
476  
477   PRIVATE inline bool FFPU fp_do_isneg(fpu_register const & r)
478   {
479 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
480          fp_declare_init_shape(sxp, r, extended);
481 <        return  (sxp->ieee.negative)
482 <                ;
481 > #else
482 >        fp_declare_init_shape(sxp, r, double);
483 > #endif
484 >        return sxp->ieee.negative;
485   }
486  
487   #undef iszero
# Line 458 | Line 490 | PRIVATE inline bool FFPU fp_do_isneg(fpu
490   PRIVATE inline bool FFPU fp_do_iszero(fpu_register const & r)
491   {
492          // TODO: BRANCHES_ARE_EXPENSIVE
493 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
494          fp_declare_init_shape(sxp, r, extended);
495 + #else
496 +        fp_declare_init_shape(sxp, r, double);
497 + #endif
498          return  (sxp->ieee.exponent == 0)
499                  &&      (sxp->ieee.mantissa0 == 0)
500                  &&      (sxp->ieee.mantissa1 == 0)
# Line 490 | Line 526 | PRIVATE inline void FFPU get_source_flag
526   PRIVATE inline void FFPU make_nan(fpu_register & r)
527   {
528          // FIXME: is that correct ?
529 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
530          fp_declare_init_shape(sxp, r, extended);
531          sxp->ieee.exponent      = FP_EXTENDED_EXP_MAX;
532          sxp->ieee.mantissa0     = 0xffffffff;
533 + #else
534 +        fp_declare_init_shape(sxp, r, double);
535 +        sxp->ieee.exponent      = FP_DOUBLE_EXP_MAX;
536 +        sxp->ieee.mantissa0     = 0xfffff;
537 + #endif
538          sxp->ieee.mantissa1     = 0xffffffff;
539   #ifdef USE_QUAD_DOUBLE
540          sxp->ieee.mantissa2     = 0xffffffff;
# Line 505 | Line 547 | PRIVATE inline void FFPU make_zero_posit
547   #if 1
548          r = +0.0;
549   #else
550 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
551          fp_declare_init_shape(sxp, r, extended);
552 + #else
553 +        fp_declare_init_shape(sxp, r, double);
554 + #endif
555          sxp->ieee.negative      = 0;
556          sxp->ieee.exponent      = 0;
557          sxp->ieee.mantissa0     = 0;
# Line 522 | Line 568 | PRIVATE inline void FFPU make_zero_negat
568   #if 1
569          r = -0.0;
570   #else
571 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
572          fp_declare_init_shape(sxp, r, extended);
573 + #else
574 +        fp_declare_init_shape(sxp, r, double);
575 + #endif
576          sxp->ieee.negative      = 1;
577          sxp->ieee.exponent      = 0;
578          sxp->ieee.mantissa0     = 0;
# Line 536 | Line 586 | PRIVATE inline void FFPU make_zero_negat
586  
587   PRIVATE inline void FFPU make_inf_positive(fpu_register & r)
588   {
589 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
590          fp_declare_init_shape(sxp, r, extended);
540        sxp->ieee_nan.negative  = 0;
591          sxp->ieee_nan.exponent  = FP_EXTENDED_EXP_MAX;
592 + #else
593 +        fp_declare_init_shape(sxp, r, double);
594 +        sxp->ieee_nan.exponent  = FP_DOUBLE_EXP_MAX;
595 + #endif
596 +        sxp->ieee_nan.negative  = 0;
597          sxp->ieee_nan.mantissa0 = 0;
598          sxp->ieee_nan.mantissa1 = 0;
599   #ifdef USE_QUAD_DOUBLE
# Line 549 | Line 604 | PRIVATE inline void FFPU make_inf_positi
604  
605   PRIVATE inline void FFPU make_inf_negative(fpu_register & r)
606   {
607 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
608          fp_declare_init_shape(sxp, r, extended);
553        sxp->ieee_nan.negative  = 1;
609          sxp->ieee_nan.exponent  = FP_EXTENDED_EXP_MAX;
610 + #else
611 +        fp_declare_init_shape(sxp, r, double);
612 +        sxp->ieee_nan.exponent  = FP_DOUBLE_EXP_MAX;
613 + #endif
614 +        sxp->ieee_nan.negative  = 1;
615          sxp->ieee_nan.mantissa0 = 0;
616          sxp->ieee_nan.mantissa1 = 0;
617   #ifdef USE_QUAD_DOUBLE
# Line 560 | Line 620 | PRIVATE inline void FFPU make_inf_negati
620   #endif
621   }
622  
563 PRIVATE inline void FFPU fast_scale(fpu_register & r, int add)
564 {
565        fp_declare_init_shape(sxp, r, extended);
566        // TODO: overflow flags
567        int exp = sxp->ieee.exponent + add;
568        // FIXME: this test is not correct: see fpuop_fscale()
569        if (exp > FP_EXTENDED_EXP_BIAS) {
570                make_inf_positive(r);
571        } else if (exp < 0) {
572                // keep sign (+/- 0)
573                if (isneg(r))
574                        make_inf_negative(r);
575                else
576                        make_inf_positive(r);
577 //              p[FHI] &= 0x80000000;
578        } else {
579                sxp->ieee.exponent = exp;
580 //              p[FHI] = (p[FHI] & 0x800FFFFF) | ((uae_u32)exp << 20);
581        }
582 }
583
623   PRIVATE inline fpu_register FFPU fast_fgetexp(fpu_register const & r)
624   {
625 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
626          fp_declare_init_shape(sxp, r, extended);
627          return (sxp->ieee.exponent - FP_EXTENDED_EXP_BIAS);
628 + #else
629 +        fp_declare_init_shape(sxp, r, double);
630 +        return (sxp->ieee.exponent - FP_DOUBLE_EXP_BIAS);
631 + #endif
632   }
633  
634   // Normalize to range 1..2
635   PRIVATE inline void FFPU fast_remove_exponent(fpu_register & r)
636   {
637 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
638          fp_declare_init_shape(sxp, r, extended);
639          sxp->ieee.exponent = FP_EXTENDED_EXP_BIAS;
640 + #else
641 +        fp_declare_init_shape(sxp, r, double);
642 +        sxp->ieee.exponent = FP_DOUBLE_EXP_BIAS;
643 + #endif
644   }
645  
646   // The sign of the quotient is the exclusive-OR of the sign bits
647   // of the source and destination operands.
648   PRIVATE inline uae_u32 FFPU get_quotient_sign(fpu_register const & ra, fpu_register const & rb)
649   {
650 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
651          fp_declare_init_shape(sap, ra, extended);
652          fp_declare_init_shape(sbp, rb, extended);
653 <        return (((sap->ieee.mantissa0 ^ sbp->ieee.mantissa0) & 0x80000000) ? 0x800000 : 0);
653 > #else
654 >        fp_declare_init_shape(sap, ra, double);
655 >        fp_declare_init_shape(sbp, rb, double);
656 > #endif
657 >        return ((sap->ieee.negative ^ sbp->ieee.negative) ? FPSR_QUOTIENT_SIGN : 0);
658   }
659  
660   /* -------------------------------------------------------------------------- */
661   /* --- Math functions                                                     --- */
662   /* -------------------------------------------------------------------------- */
663  
664 < #if FPU_USE_ISO_C99
665 < # define fp_log         logl
666 < # define fp_log10       log10l
667 < # define fp_exp         expl
668 < # define fp_pow         powl
669 < # define fp_fabs        fabsl
670 < # define fp_sqrt        sqrtl
671 < # define fp_sin         sinl
672 < # define fp_cos         cosl
673 < # define fp_tan         tanl
674 < # define fp_sinh        sinhl
675 < # define fp_cosh        coshl
676 < # define fp_tanh        tanhl
677 < # define fp_asin        asinl
678 < # define fp_acos        acosl
679 < # define fp_atan        atanl
680 < # define fp_asinh       asinhl
681 < # define fp_acosh       acoshl
682 < # define fp_atanh       atanhl
683 < # define fp_floor       floorl
684 < # define fp_ceil        ceill
685 < #else
664 > #if FPU_USE_ISO_C99 && (USE_LONG_DOUBLE || USE_QUAD_DOUBLE)
665 > # ifdef HAVE_LOGL
666 > #  define fp_log        logl
667 > # endif
668 > # ifdef HAVE_LOG10L
669 > #  define fp_log10      log10l
670 > # endif
671 > # ifdef HAVE_EXPL
672 > #  define fp_exp        expl
673 > # endif
674 > # ifdef HAVE_POWL
675 > #  define fp_pow        powl
676 > # endif
677 > # ifdef HAVE_FABSL
678 > #  define fp_fabs       fabsl
679 > # endif
680 > # ifdef HAVE_SQRTL
681 > #  define fp_sqrt       sqrtl
682 > # endif
683 > # ifdef HAVE_SINL
684 > #  define fp_sin        sinl
685 > # endif
686 > # ifdef HAVE_COSL
687 > #  define fp_cos        cosl
688 > # endif
689 > # ifdef HAVE_TANL
690 > #  define fp_tan        tanl
691 > # endif
692 > # ifdef HAVE_SINHL
693 > #  define fp_sinh       sinhl
694 > # endif
695 > # ifdef HAVE_COSHL
696 > #  define fp_cosh       coshl
697 > # endif
698 > # ifdef HAVE_TANHL
699 > #  define fp_tanh       tanhl
700 > # endif
701 > # ifdef HAVE_ASINL
702 > #  define fp_asin       asinl
703 > # endif
704 > # ifdef HAVE_ACOSL
705 > #  define fp_acos       acosl
706 > # endif
707 > # ifdef HAVE_ATANL
708 > #  define fp_atan       atanl
709 > # endif
710 > # ifdef HAVE_ASINHL
711 > #  define fp_asinh      asinhl
712 > # endif
713 > # ifdef HAVE_ACOSHL
714 > #  define fp_acosh      acoshl
715 > # endif
716 > # ifdef HAVE_ATANHL
717 > #  define fp_atanh      atanhl
718 > # endif
719 > # ifdef HAVE_FLOORL
720 > #  define fp_floor      floorl
721 > # endif
722 > # ifdef HAVE_CEILL
723 > #  define fp_ceil       ceill
724 > # endif
725 > #endif
726 >
727 > #ifndef fp_log
728   # define fp_log         log
729 + #endif
730 + #ifndef fp_log10
731   # define fp_log10       log10
732 + #endif
733 + #ifndef fp_exp
734   # define fp_exp         exp
735 + #endif
736 + #ifndef fp_pow
737   # define fp_pow         pow
738 + #endif
739 + #ifndef fp_fabs
740   # define fp_fabs        fabs
741 + #endif
742 + #ifndef fp_sqrt
743   # define fp_sqrt        sqrt
744 + #endif
745 + #ifndef fp_sin
746   # define fp_sin         sin
747 + #endif
748 + #ifndef fp_cos
749   # define fp_cos         cos
750 + #endif
751 + #ifndef fp_tan
752   # define fp_tan         tan
753 + #endif
754 + #ifndef fp_sinh
755   # define fp_sinh        sinh
756 + #endif
757 + #ifndef fp_cosh
758   # define fp_cosh        cosh
759 + #endif
760 + #ifndef fp_tanh
761   # define fp_tanh        tanh
762 + #endif
763 + #ifndef fp_asin
764   # define fp_asin        asin
765 + #endif
766 + #ifndef fp_acos
767   # define fp_acos        acos
768 + #endif
769 + #ifndef fp_atan
770   # define fp_atan        atan
771 + #endif
772 + #ifndef fp_asinh
773   # define fp_asinh       asinh
774 + #endif
775 + #ifndef fp_acosh
776   # define fp_acosh       acosh
777 + #endif
778 + #ifndef fp_atanh
779   # define fp_atanh       atanh
780 + #endif
781 + #ifndef fp_floor
782   # define fp_floor       floor
783 + #endif
784 + #ifndef fp_ceil
785   # define fp_ceil        ceil
786   #endif
787  
788 < #if defined(FPU_IEEE) && defined(X86_ASSEMBLY)
788 > #if defined(FPU_IEEE) && defined(USE_X87_ASSEMBLY)
789   // Assembly optimized support functions. Taken from glibc 2.2.2
790  
791   #undef fp_log
# Line 789 | Line 923 | PRIVATE inline fpu_extended fp_do_expm1(
923  
924   PRIVATE inline fpu_extended fp_do_sgn1(fpu_extended x)
925   {
926 + #if USE_LONG_DOUBLE || USE_QUAD_DOUBLE
927          fp_declare_init_shape(sxp, x, extended);
928          sxp->ieee_nan.exponent  = FP_EXTENDED_EXP_MAX;
929          sxp->ieee_nan.one               = 1;
930 + #else
931 +        fp_declare_init_shape(sxp, x, double);
932 +        sxp->ieee_nan.exponent  = FP_DOUBLE_EXP_MAX;
933 + #endif
934          sxp->ieee_nan.quiet_nan = 0;
935          sxp->ieee_nan.mantissa0 = 0;
936          sxp->ieee_nan.mantissa1 = 0;
# Line 971 | Line 1110 | DEFINE_ROUND_FUNC(zero, 0xc00)
1110  
1111   DEFINE_ROUND_FUNC(nearest, 0x000)
1112  
1113 < #endif /* X86_ASSEMBLY */
1113 > #endif /* USE_X87_ASSEMBLY */
1114  
1115   #ifndef fp_round_to_minus_infinity
1116   #define fp_round_to_minus_infinity(x) fp_floor(x)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines