libgcc2.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 1989-2013 Free Software Foundation, Inc.
  4. */
  5. #ifndef __ASM_LIBGCC_H
  6. #define __ASM_LIBGCC_H
  7. #define UNITS_PER_WORD 4 /* for ARC */
  8. #define BITS_PER_UNIT 8 /* for ARC */
  9. #define W_TYPE_SIZE (4 * BITS_PER_UNIT)
  10. #define MIN_UNITS_PER_WORD UNITS_PER_WORD
  11. /* Work out the largest "word" size that we can deal with on this target. */
  12. #if MIN_UNITS_PER_WORD > 4
  13. # define LIBGCC2_MAX_UNITS_PER_WORD 8
  14. #elif (MIN_UNITS_PER_WORD > 2 \
  15. || (MIN_UNITS_PER_WORD > 1 && __SIZEOF_LONG_LONG__ > 4))
  16. # define LIBGCC2_MAX_UNITS_PER_WORD 4
  17. #else
  18. # define LIBGCC2_MAX_UNITS_PER_WORD MIN_UNITS_PER_WORD
  19. #endif
  20. /* Work out what word size we are using for this compilation.
  21. The value can be set on the command line. */
  22. #ifndef LIBGCC2_UNITS_PER_WORD
  23. #define LIBGCC2_UNITS_PER_WORD LIBGCC2_MAX_UNITS_PER_WORD
  24. #endif
  25. typedef int QItype __attribute__ ((mode (QI)));
  26. typedef unsigned int UQItype __attribute__ ((mode (QI)));
  27. typedef int HItype __attribute__ ((mode (HI)));
  28. typedef unsigned int UHItype __attribute__ ((mode (HI)));
  29. #if MIN_UNITS_PER_WORD > 1
  30. /* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1. */
  31. typedef int SItype __attribute__ ((mode (SI)));
  32. typedef unsigned int USItype __attribute__ ((mode (SI)));
  33. #if __SIZEOF_LONG_LONG__ > 4
  34. /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2. */
  35. typedef int DItype __attribute__ ((mode (DI)));
  36. typedef unsigned int UDItype __attribute__ ((mode (DI)));
  37. #if MIN_UNITS_PER_WORD > 4
  38. /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4. */
  39. typedef int TItype __attribute__ ((mode (TI)));
  40. typedef unsigned int UTItype __attribute__ ((mode (TI)));
  41. #endif
  42. #endif
  43. #endif
  44. #if LIBGCC2_UNITS_PER_WORD == 8
  45. #define W_TYPE_SIZE (8 * BITS_PER_UNIT)
  46. #define Wtype DItype
  47. #define UWtype UDItype
  48. #define HWtype DItype
  49. #define UHWtype UDItype
  50. #define DWtype TItype
  51. #define UDWtype UTItype
  52. #ifdef LIBGCC2_GNU_PREFIX
  53. #define __NW(a,b) __gnu_ ## a ## di ## b
  54. #define __NDW(a,b) __gnu_ ## a ## ti ## b
  55. #else
  56. #define __NW(a,b) __ ## a ## di ## b
  57. #define __NDW(a,b) __ ## a ## ti ## b
  58. #endif
  59. #elif LIBGCC2_UNITS_PER_WORD == 4
  60. #define W_TYPE_SIZE (4 * BITS_PER_UNIT)
  61. #define Wtype SItype
  62. #define UWtype USItype
  63. #define HWtype SItype
  64. #define UHWtype USItype
  65. #define DWtype DItype
  66. #define UDWtype UDItype
  67. #ifdef LIBGCC2_GNU_PREFIX
  68. #define __NW(a,b) __gnu_ ## a ## si ## b
  69. #define __NDW(a,b) __gnu_ ## a ## di ## b
  70. #else
  71. #define __NW(a,b) __ ## a ## si ## b
  72. #define __NDW(a,b) __ ## a ## di ## b
  73. #endif
  74. #elif LIBGCC2_UNITS_PER_WORD == 2
  75. #define W_TYPE_SIZE (2 * BITS_PER_UNIT)
  76. #define Wtype HItype
  77. #define UWtype UHItype
  78. #define HWtype HItype
  79. #define UHWtype UHItype
  80. #define DWtype SItype
  81. #define UDWtype USItype
  82. #ifdef LIBGCC2_GNU_PREFIX
  83. #define __NW(a,b) __gnu_ ## a ## hi ## b
  84. #define __NDW(a,b) __gnu_ ## a ## si ## b
  85. #else
  86. #define __NW(a,b) __ ## a ## hi ## b
  87. #define __NDW(a,b) __ ## a ## si ## b
  88. #endif
  89. #else
  90. #define W_TYPE_SIZE BITS_PER_UNIT
  91. #define Wtype QItype
  92. #define UWtype UQItype
  93. #define HWtype QItype
  94. #define UHWtype UQItype
  95. #define DWtype HItype
  96. #define UDWtype UHItype
  97. #ifdef LIBGCC2_GNU_PREFIX
  98. #define __NW(a,b) __gnu_ ## a ## qi ## b
  99. #define __NDW(a,b) __gnu_ ## a ## hi ## b
  100. #else
  101. #define __NW(a,b) __ ## a ## qi ## b
  102. #define __NDW(a,b) __ ## a ## hi ## b
  103. #endif
  104. #endif
  105. typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));
  106. #if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
  107. struct DWstruct {Wtype high, low;};
  108. #else
  109. struct DWstruct {Wtype low, high;};
  110. #endif
  111. /* We need this union to unpack/pack DImode values, since we don't have
  112. any arithmetic yet. Incoming DImode parameters are stored into the
  113. `ll' field, and the unpacked result is read from the struct `s'. */
  114. typedef union {
  115. struct DWstruct s;
  116. DWtype ll;
  117. } DWunion;
  118. #endif /* __ASM_LIBGCC_H */