sfp-machine.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #define _FP_W_TYPE_SIZE 64
  2. #define _FP_W_TYPE unsigned long
  3. #define _FP_WS_TYPE signed long
  4. #define _FP_I_TYPE long
  5. typedef int TItype __attribute__ ((mode (TI)));
  6. typedef unsigned int UTItype __attribute__ ((mode (TI)));
  7. #define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
  8. /* The type of the result of a floating point comparison. This must
  9. match `__libgcc_cmp_return__' in GCC for the target. */
  10. typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
  11. #define CMPtype __gcc_CMPtype
  12. #define _FP_MUL_MEAT_Q(R,X,Y) \
  13. _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
  14. #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y)
  15. #define _FP_NANFRAC_S _FP_QNANBIT_S
  16. #define _FP_NANFRAC_D _FP_QNANBIT_D
  17. #define _FP_NANFRAC_E _FP_QNANBIT_E, 0
  18. #define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0
  19. #define _FP_KEEPNANFRACP 1
  20. #define _FP_QNANNEGATEDP 0
  21. #define _FP_NANSIGN_S 1
  22. #define _FP_NANSIGN_D 1
  23. #define _FP_NANSIGN_E 1
  24. #define _FP_NANSIGN_Q 1
  25. /* Here is something Intel misdesigned: the specs don't define
  26. the case where we have two NaNs with same mantissas, but
  27. different sign. Different operations pick up different NaNs. */
  28. #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
  29. do { \
  30. if (_FP_FRAC_GT_##wc(X, Y) \
  31. || (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*'))) \
  32. { \
  33. R##_s = X##_s; \
  34. _FP_FRAC_COPY_##wc(R,X); \
  35. } \
  36. else \
  37. { \
  38. R##_s = Y##_s; \
  39. _FP_FRAC_COPY_##wc(R,Y); \
  40. } \
  41. R##_c = FP_CLS_NAN; \
  42. } while (0)
  43. #define FP_EX_INVALID 0x01
  44. #define FP_EX_DENORM 0x02
  45. #define FP_EX_DIVZERO 0x04
  46. #define FP_EX_OVERFLOW 0x08
  47. #define FP_EX_UNDERFLOW 0x10
  48. #define FP_EX_INEXACT 0x20
  49. #define FP_EX_ALL \
  50. (FP_EX_INVALID | FP_EX_DENORM | FP_EX_DIVZERO | FP_EX_OVERFLOW \
  51. | FP_EX_UNDERFLOW | FP_EX_INEXACT)
  52. #define _FP_TININESS_AFTER_ROUNDING 1
  53. void __sfp_handle_exceptions (int);
  54. #define FP_HANDLE_EXCEPTIONS \
  55. do { \
  56. if (__builtin_expect (_fex, 0)) \
  57. __sfp_handle_exceptions (_fex); \
  58. } while (0)
  59. #define FP_TRAPPING_EXCEPTIONS (~_fcw & FP_EX_ALL)
  60. #define FP_RND_NEAREST 0
  61. #define FP_RND_ZERO 0xc00L
  62. #define FP_RND_PINF 0x800L
  63. #define FP_RND_MINF 0x400L
  64. #define FP_RND_MASK 0xc00L
  65. #define _FP_DECL_EX \
  66. unsigned long int _fcw __attribute__ ((unused)) = FP_RND_NEAREST
  67. #define FP_INIT_ROUNDMODE \
  68. do { \
  69. __asm__ __volatile__ ("mov.m %0 = ar.fpsr" : "=r" (_fcw)); \
  70. } while (0)
  71. #define FP_ROUNDMODE (_fcw & FP_RND_MASK)
  72. #define __LITTLE_ENDIAN 1234
  73. #define __BIG_ENDIAN 4321
  74. #define __BYTE_ORDER __LITTLE_ENDIAN
  75. /* Define ALIASNAME as a strong alias for NAME. */
  76. #define strong_alias(name, aliasname) _strong_alias(name, aliasname)
  77. #define _strong_alias(name, aliasname) \
  78. extern __typeof (name) aliasname __attribute__ ((alias (#name)));