sfp-machine.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #define _FP_W_TYPE_SIZE 32
  2. #define _FP_W_TYPE unsigned long
  3. #define _FP_WS_TYPE signed long
  4. #define _FP_I_TYPE long
  5. #define _FP_MUL_MEAT_S(R,X,Y) \
  6. _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
  7. #define _FP_MUL_MEAT_D(R,X,Y) \
  8. _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
  9. #define _FP_MUL_MEAT_Q(R,X,Y) \
  10. _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
  11. #define _FP_MUL_MEAT_DW_S(R,X,Y) \
  12. _FP_MUL_MEAT_DW_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
  13. #define _FP_MUL_MEAT_DW_D(R,X,Y) \
  14. _FP_MUL_MEAT_DW_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
  15. #define _FP_MUL_MEAT_DW_Q(R,X,Y) \
  16. _FP_MUL_MEAT_DW_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
  17. #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(S,R,X,Y)
  18. #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
  19. #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
  20. #ifdef __mips_nan2008
  21. # define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
  22. # define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
  23. # define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
  24. #else
  25. # define _FP_NANFRAC_S (_FP_QNANBIT_S - 1)
  26. # define _FP_NANFRAC_D (_FP_QNANBIT_D - 1), -1
  27. # define _FP_NANFRAC_Q (_FP_QNANBIT_Q - 1), -1, -1, -1
  28. #endif
  29. #define _FP_NANSIGN_S 0
  30. #define _FP_NANSIGN_D 0
  31. #define _FP_NANSIGN_Q 0
  32. #define _FP_KEEPNANFRACP 1
  33. #ifdef __mips_nan2008
  34. # define _FP_QNANNEGATEDP 0
  35. #else
  36. # define _FP_QNANNEGATEDP 1
  37. #endif
  38. #ifdef __mips_nan2008
  39. /* NaN payloads should be preserved for NAN2008. */
  40. # define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
  41. do \
  42. { \
  43. R##_s = X##_s; \
  44. _FP_FRAC_COPY_##wc (R, X); \
  45. R##_c = FP_CLS_NAN; \
  46. } \
  47. while (0)
  48. #else
  49. /* From my experiments it seems X is chosen unless one of the
  50. NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */
  51. # define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
  52. do { \
  53. if ((_FP_FRAC_HIGH_RAW_##fs(X) | \
  54. _FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs) \
  55. { \
  56. R##_s = _FP_NANSIGN_##fs; \
  57. _FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs); \
  58. } \
  59. else \
  60. { \
  61. R##_s = X##_s; \
  62. _FP_FRAC_COPY_##wc(R,X); \
  63. } \
  64. R##_c = FP_CLS_NAN; \
  65. } while (0)
  66. #endif
  67. #define FP_EX_INVALID (1 << 4)
  68. #define FP_EX_DIVZERO (1 << 3)
  69. #define FP_EX_OVERFLOW (1 << 2)
  70. #define FP_EX_UNDERFLOW (1 << 1)
  71. #define FP_EX_INEXACT (1 << 0)
  72. #define _FP_TININESS_AFTER_ROUNDING 1