sfp-machine.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* Machine description for AArch64 architecture.
  2. Copyright (C) 2009-2022 Free Software Foundation, Inc.
  3. Contributed by ARM Ltd.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 3, or (at your option) any later
  8. version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. Under Section 7 of GPL version 3, you are granted additional
  14. permissions described in the GCC Runtime Library Exception, version
  15. 3.1, as published by the Free Software Foundation.
  16. You should have received a copy of the GNU General Public License and
  17. a copy of the GCC Runtime Library Exception along with this program;
  18. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. <http://www.gnu.org/licenses/>. */
  20. #define _FP_W_TYPE_SIZE 64
  21. #define _FP_W_TYPE unsigned long long
  22. #define _FP_WS_TYPE signed long long
  23. #define _FP_I_TYPE long long
  24. typedef int TItype __attribute__ ((mode (TI)));
  25. typedef unsigned int UTItype __attribute__ ((mode (TI)));
  26. #define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
  27. /* The type of the result of a floating point comparison. This must
  28. match __libgcc_cmp_return__ in GCC for the target. */
  29. typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
  30. #define CMPtype __gcc_CMPtype
  31. #define _FP_MUL_MEAT_Q(R,X,Y) \
  32. _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
  33. #define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y)
  34. #define _FP_NANFRAC_H ((_FP_QNANBIT_H << 1) - 1)
  35. #define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
  36. #define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1)
  37. #define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1
  38. #define _FP_NANSIGN_H 0
  39. #define _FP_NANSIGN_S 0
  40. #define _FP_NANSIGN_D 0
  41. #define _FP_NANSIGN_Q 0
  42. #define _FP_KEEPNANFRACP 1
  43. #define _FP_QNANNEGATEDP 0
  44. /* This appears to be in line with the VFP conventions in the v7-a
  45. ARM-ARM. Need to check with the v8 version. */
  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 FP_EX_INVALID 0x01
  62. #define FP_EX_DIVZERO 0x02
  63. #define FP_EX_OVERFLOW 0x04
  64. #define FP_EX_UNDERFLOW 0x08
  65. #define FP_EX_INEXACT 0x10
  66. #define FP_EX_SHIFT 8
  67. #define FP_EX_ALL \
  68. (FP_EX_INVALID | FP_EX_DIVZERO | FP_EX_OVERFLOW | FP_EX_UNDERFLOW \
  69. | FP_EX_INEXACT)
  70. #define _FP_TININESS_AFTER_ROUNDING 0
  71. void __sfp_handle_exceptions (int);
  72. #define FP_HANDLE_EXCEPTIONS \
  73. do { \
  74. if (__builtin_expect (_fex, 0)) \
  75. __sfp_handle_exceptions (_fex); \
  76. } while (0)
  77. #define FP_TRAPPING_EXCEPTIONS ((_fpcr >> FP_EX_SHIFT) & FP_EX_ALL)
  78. #define FP_RND_NEAREST 0x000000
  79. #define FP_RND_PINF 0x400000
  80. #define FP_RND_MINF 0x800000
  81. #define FP_RND_ZERO 0xc00000
  82. #define FP_RND_MASK 0xc00000
  83. #define _FP_DECL_EX \
  84. unsigned long int _fpcr __attribute__ ((unused)) = FP_RND_NEAREST
  85. #define FP_INIT_ROUNDMODE \
  86. do { \
  87. __asm__ __volatile__ ("mrs %0, fpcr" \
  88. : "=r" (_fpcr)); \
  89. } while (0)
  90. #define FP_ROUNDMODE (_fpcr & FP_RND_MASK)
  91. #define __LITTLE_ENDIAN 1234
  92. #define __BIG_ENDIAN 4321
  93. #if defined __AARCH64EB__
  94. # define __BYTE_ORDER __BIG_ENDIAN
  95. #else
  96. # define __BYTE_ORDER __LITTLE_ENDIAN
  97. #endif
  98. /* Define ALIASNAME as a strong alias for NAME. */
  99. # define strong_alias(name, aliasname) _strong_alias(name, aliasname)
  100. # define _strong_alias(name, aliasname) \
  101. extern __typeof (name) aliasname __attribute__ ((alias (#name)));