sfp-machine.h 4.4 KB

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