libgcc2.h 3.8 KB

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