sfp-machine.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* Soft-FP definitions for TI C6X.
  2. Copyright (C) 2010-2022 Free Software Foundation, Inc.
  3. This files is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. In addition to the permissions in the GNU Lesser General Public
  8. License, the Free Software Foundation gives you unlimited
  9. permission to link the compiled version of this file into
  10. combinations with other programs, and to distribute those
  11. combinations without any restriction coming from the use of this
  12. file. (The Lesser General Public License restrictions do apply in
  13. other respects; for example, they cover modification of the file,
  14. and distribution when not linked into a combine executable.)
  15. This file is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. Lesser General Public License for more details.
  19. You should have received a copy of the GNU Lesser General Public
  20. License along with GCC; see the file COPYING.LIB. If not see
  21. <http://www.gnu.org/licenses/>. */
  22. #define _FP_W_TYPE_SIZE 32
  23. #define _FP_W_TYPE unsigned long
  24. #define _FP_WS_TYPE signed long
  25. #define _FP_I_TYPE long
  26. #define _FP_MUL_MEAT_S(R,X,Y) \
  27. _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
  28. #define _FP_MUL_MEAT_D(R,X,Y) \
  29. _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
  30. #define _FP_MUL_MEAT_Q(R,X,Y) \
  31. _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
  32. #define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(S,R,X,Y)
  33. #define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
  34. #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
  35. #define _FP_NANFRAC_H ((_FP_QNANBIT_H << 1) - 1)
  36. #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
  37. #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
  38. #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
  39. #define _FP_NANSIGN_H 0
  40. #define _FP_NANSIGN_S 0
  41. #define _FP_NANSIGN_D 0
  42. #define _FP_NANSIGN_Q 0
  43. #define _FP_KEEPNANFRACP 1
  44. #define _FP_QNANNEGATEDP 0
  45. /* Someone please check this. */
  46. #define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
  47. do { \
  48. if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \
  49. && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \
  50. { \
  51. R##_s = Y##_s; \
  52. _FP_FRAC_COPY_##wc(R,Y); \
  53. } \
  54. else \
  55. { \
  56. R##_s = X##_s; \
  57. _FP_FRAC_COPY_##wc(R,X); \
  58. } \
  59. R##_c = FP_CLS_NAN; \
  60. } while (0)
  61. #define __LITTLE_ENDIAN 1234
  62. #define __BIG_ENDIAN 4321
  63. #if defined _BIG_ENDIAN
  64. # define __BYTE_ORDER __BIG_ENDIAN
  65. #else
  66. # define __BYTE_ORDER __LITTLE_ENDIAN
  67. #endif
  68. /* Not checked. */
  69. #define _FP_TININESS_AFTER_ROUNDING 0
  70. /* Define ALIASNAME as a strong alias for NAME. */
  71. # define strong_alias(name, aliasname) _strong_alias(name, aliasname)
  72. # define _strong_alias(name, aliasname) \
  73. extern __typeof (name) aliasname __attribute__ ((alias (#name)));
  74. /* Rename helper functions to the names specified in the C6000 ELF ABI. */
  75. #define __fixdfsi __c6xabi_fixdi
  76. #define __fixsfsi __c6xabi_fixfi
  77. #define __floatsidf __c6xabi_fltid
  78. #define __floatunsidf __c6xabi_fltud
  79. #define __floatsisf __c6xabi_fltif
  80. #define __floatunsisf __c6xabi_fltuf
  81. #define __truncdfsf2 __c6xabi_cvtdf
  82. #define __extendsfdf2 __c6xabi_cvtfd
  83. #define __adddf3 __c6xabi_addd
  84. #define __subdf3 __c6xabi_subd
  85. #define __muldf3 __c6xabi_mpyd
  86. #define __divdf3 __c6xabi_divd
  87. #define __negdf2 __c6xabi_negd
  88. #define __absdf2 __c6xabi_absd
  89. #define __addsf3 __c6xabi_addf
  90. #define __subsf3 __c6xabi_subf
  91. #define __mulsf3 __c6xabi_mpyf
  92. #define __divsf3 __c6xabi_divf
  93. #define __negsf2 __c6xabi_negf
  94. #define __abssf2 __c6xabi_absf
  95. #define __lesf2 __c6xabi_cmpf
  96. #define __ledf2 __c6xabi_cmpd
  97. #define __ltsf2 __gnu_ltsf2
  98. #define __ltdf2 __gnu_ltdf2
  99. #define __gesf2 __gnu_gesf2
  100. #define __gedf2 __gnu_gedf2
  101. #define __gtsf2 __gnu_gtsf2
  102. #define __gtdf2 __gnu_gtdf2
  103. #define __eqsf2 __gnu_eqsf2
  104. #define __eqdf2 __gnu_eqdf2
  105. #define __nesf2 __c6xabi_neqf
  106. #define __nedf2 __c6xabi_neqd
  107. #define __unordsf2 __c6xabi_unordf
  108. #define __unorddf2 __c6xabi_unordd