arm_acle.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /* AArch64 Non-NEON ACLE intrinsics include file.
  2. Copyright (C) 2014-2020 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
  6. under the terms of the GNU General Public License as published
  7. by the Free Software Foundation; either version 3, or (at your
  8. option) any later version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT
  10. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  12. License 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. #ifndef _GCC_ARM_ACLE_H
  21. #define _GCC_ARM_ACLE_H
  22. #include <stdint.h>
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. #pragma GCC push_options
  27. #pragma GCC target ("arch=armv8.3-a")
  28. __extension__ static __inline int32_t __attribute__ ((__always_inline__))
  29. __jcvt (double __a)
  30. {
  31. return __builtin_aarch64_jcvtzs (__a);
  32. }
  33. #pragma GCC pop_options
  34. #pragma GCC push_options
  35. #pragma GCC target ("arch=armv8.5-a")
  36. __extension__ static __inline float __attribute__ ((__always_inline__))
  37. __rint32zf (float __a)
  38. {
  39. return __builtin_aarch64_frint32zsf (__a);
  40. }
  41. __extension__ static __inline double __attribute__ ((__always_inline__))
  42. __rint32z (double __a)
  43. {
  44. return __builtin_aarch64_frint32zdf (__a);
  45. }
  46. __extension__ static __inline float __attribute__ ((__always_inline__))
  47. __rint64zf (float __a)
  48. {
  49. return __builtin_aarch64_frint64zsf (__a);
  50. }
  51. __extension__ static __inline double __attribute__ ((__always_inline__))
  52. __rint64z (double __a)
  53. {
  54. return __builtin_aarch64_frint64zdf (__a);
  55. }
  56. __extension__ static __inline float __attribute__ ((__always_inline__))
  57. __rint32xf (float __a)
  58. {
  59. return __builtin_aarch64_frint32xsf (__a);
  60. }
  61. __extension__ static __inline double __attribute__ ((__always_inline__))
  62. __rint32x (double __a)
  63. {
  64. return __builtin_aarch64_frint32xdf (__a);
  65. }
  66. __extension__ static __inline float __attribute__ ((__always_inline__))
  67. __rint64xf (float __a)
  68. {
  69. return __builtin_aarch64_frint64xsf (__a);
  70. }
  71. __extension__ static __inline double __attribute__ ((__always_inline__))
  72. __rint64x (double __a)
  73. {
  74. return __builtin_aarch64_frint64xdf (__a);
  75. }
  76. #pragma GCC pop_options
  77. #pragma GCC push_options
  78. #pragma GCC target ("+nothing+crc")
  79. __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
  80. __crc32b (uint32_t __a, uint8_t __b)
  81. {
  82. return __builtin_aarch64_crc32b (__a, __b);
  83. }
  84. __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
  85. __crc32cb (uint32_t __a, uint8_t __b)
  86. {
  87. return __builtin_aarch64_crc32cb (__a, __b);
  88. }
  89. __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
  90. __crc32ch (uint32_t __a, uint16_t __b)
  91. {
  92. return __builtin_aarch64_crc32ch (__a, __b);
  93. }
  94. __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
  95. __crc32cw (uint32_t __a, uint32_t __b)
  96. {
  97. return __builtin_aarch64_crc32cw (__a, __b);
  98. }
  99. __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
  100. __crc32cd (uint32_t __a, uint64_t __b)
  101. {
  102. return __builtin_aarch64_crc32cx (__a, __b);
  103. }
  104. __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
  105. __crc32h (uint32_t __a, uint16_t __b)
  106. {
  107. return __builtin_aarch64_crc32h (__a, __b);
  108. }
  109. __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
  110. __crc32w (uint32_t __a, uint32_t __b)
  111. {
  112. return __builtin_aarch64_crc32w (__a, __b);
  113. }
  114. __extension__ static __inline uint32_t __attribute__ ((__always_inline__))
  115. __crc32d (uint32_t __a, uint64_t __b)
  116. {
  117. return __builtin_aarch64_crc32x (__a, __b);
  118. }
  119. #pragma GCC pop_options
  120. #ifdef __ARM_FEATURE_TME
  121. #pragma GCC push_options
  122. #pragma GCC target ("+nothing+tme")
  123. #define _TMFAILURE_REASON 0x00007fffu
  124. #define _TMFAILURE_RTRY 0x00008000u
  125. #define _TMFAILURE_CNCL 0x00010000u
  126. #define _TMFAILURE_MEM 0x00020000u
  127. #define _TMFAILURE_IMP 0x00040000u
  128. #define _TMFAILURE_ERR 0x00080000u
  129. #define _TMFAILURE_SIZE 0x00100000u
  130. #define _TMFAILURE_NEST 0x00200000u
  131. #define _TMFAILURE_DBG 0x00400000u
  132. #define _TMFAILURE_INT 0x00800000u
  133. #define _TMFAILURE_TRIVIAL 0x01000000u
  134. __extension__ static __inline uint64_t __attribute__ ((__always_inline__))
  135. __tstart (void)
  136. {
  137. return __builtin_aarch64_tstart ();
  138. }
  139. __extension__ static __inline void __attribute__ ((__always_inline__))
  140. __tcommit (void)
  141. {
  142. __builtin_aarch64_tcommit ();
  143. }
  144. __extension__ static __inline void __attribute__ ((__always_inline__))
  145. __tcancel (const uint64_t __reason)
  146. {
  147. __builtin_aarch64_tcancel (__reason);
  148. }
  149. __extension__ static __inline uint64_t __attribute__ ((__always_inline__))
  150. __ttest (void)
  151. {
  152. return __builtin_aarch64_ttest ();
  153. }
  154. #pragma GCC pop_options
  155. #endif
  156. #pragma GCC push_options
  157. #pragma GCC target ("+nothing+rng")
  158. __extension__ static __inline int __attribute__ ((__always_inline__))
  159. __rndr (uint64_t *__res)
  160. {
  161. return __builtin_aarch64_rndr (__res);
  162. }
  163. __extension__ static __inline int __attribute__ ((__always_inline__))
  164. __rndrrs (uint64_t *__res)
  165. {
  166. return __builtin_aarch64_rndrrs (__res);
  167. }
  168. #pragma GCC pop_options
  169. #pragma GCC push_options
  170. #pragma GCC target ("arch=armv8.5-a+memtag")
  171. #define __arm_mte_create_random_tag(__ptr, __u64_mask) \
  172. __builtin_aarch64_memtag_irg(__ptr, __u64_mask)
  173. #define __arm_mte_exclude_tag(__ptr, __u64_excluded) \
  174. __builtin_aarch64_memtag_gmi(__ptr, __u64_excluded)
  175. #define __arm_mte_ptrdiff(__ptr_a, __ptr_b) \
  176. __builtin_aarch64_memtag_subp(__ptr_a, __ptr_b)
  177. #define __arm_mte_increment_tag(__ptr, __u_offset) \
  178. __builtin_aarch64_memtag_inc_tag(__ptr, __u_offset)
  179. #define __arm_mte_set_tag(__tagged_address) \
  180. __builtin_aarch64_memtag_set_tag(__tagged_address)
  181. #define __arm_mte_get_tag(__address) \
  182. __builtin_aarch64_memtag_get_tag(__address)
  183. #pragma GCC pop_options
  184. #ifdef __cplusplus
  185. }
  186. #endif
  187. #endif