Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*===---- cetintrin.h - CET intrinsic --------------------------------------===
  2.  *
  3.  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4.  * See https://llvm.org/LICENSE.txt for license information.
  5.  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6.  *
  7.  *===-----------------------------------------------------------------------===
  8.  */
  9.  
  10. #ifndef __IMMINTRIN_H
  11. #error "Never use <cetintrin.h> directly; include <immintrin.h> instead."
  12. #endif
  13.  
  14. #ifndef __CETINTRIN_H
  15. #define __CETINTRIN_H
  16.  
  17. /* Define the default attributes for the functions in this file. */
  18. #define __DEFAULT_FN_ATTRS                                                     \
  19.   __attribute__((__always_inline__, __nodebug__, __target__("shstk")))
  20.  
  21. static __inline__ void __DEFAULT_FN_ATTRS _incsspd(int __a) {
  22.   __builtin_ia32_incsspd((unsigned int)__a);
  23. }
  24.  
  25. #ifdef __x86_64__
  26. static __inline__ void __DEFAULT_FN_ATTRS _incsspq(unsigned long long __a) {
  27.   __builtin_ia32_incsspq(__a);
  28. }
  29. #endif /* __x86_64__ */
  30.  
  31. #ifdef __x86_64__
  32. static __inline__ void __DEFAULT_FN_ATTRS _inc_ssp(unsigned int __a) {
  33.   __builtin_ia32_incsspq(__a);
  34. }
  35. #else /* __x86_64__ */
  36. static __inline__ void __DEFAULT_FN_ATTRS _inc_ssp(unsigned int __a) {
  37.   __builtin_ia32_incsspd(__a);
  38. }
  39. #endif /* __x86_64__ */
  40.  
  41. static __inline__ unsigned int __DEFAULT_FN_ATTRS _rdsspd(unsigned int __a) {
  42.   return __builtin_ia32_rdsspd(__a);
  43. }
  44.  
  45. static __inline__ unsigned int __DEFAULT_FN_ATTRS _rdsspd_i32(void) {
  46. #pragma clang diagnostic push
  47. #pragma clang diagnostic ignored "-Wuninitialized"
  48.   unsigned int t;
  49.   return __builtin_ia32_rdsspd(t);
  50. #pragma clang diagnostic pop
  51. }
  52.  
  53. #ifdef __x86_64__
  54. static __inline__ unsigned long long __DEFAULT_FN_ATTRS _rdsspq(unsigned long long __a) {
  55.   return __builtin_ia32_rdsspq(__a);
  56. }
  57.  
  58. static __inline__ unsigned long long __DEFAULT_FN_ATTRS _rdsspq_i64(void) {
  59. #pragma clang diagnostic push
  60. #pragma clang diagnostic ignored "-Wuninitialized"
  61.   unsigned long long t;
  62.   return __builtin_ia32_rdsspq(t);
  63. #pragma clang diagnostic pop
  64. }
  65. #endif /* __x86_64__ */
  66.  
  67. #ifdef __x86_64__
  68. static __inline__ unsigned long long __DEFAULT_FN_ATTRS _get_ssp(void) {
  69.   return __builtin_ia32_rdsspq(0);
  70. }
  71. #else /* __x86_64__ */
  72. static __inline__ unsigned int __DEFAULT_FN_ATTRS _get_ssp(void) {
  73.   return __builtin_ia32_rdsspd(0);
  74. }
  75. #endif /* __x86_64__ */
  76.  
  77. static __inline__ void __DEFAULT_FN_ATTRS _saveprevssp(void) {
  78.   __builtin_ia32_saveprevssp();
  79. }
  80.  
  81. static __inline__ void __DEFAULT_FN_ATTRS _rstorssp(void * __p) {
  82.   __builtin_ia32_rstorssp(__p);
  83. }
  84.  
  85. static __inline__ void __DEFAULT_FN_ATTRS _wrssd(unsigned int __a, void * __p) {
  86.   __builtin_ia32_wrssd(__a, __p);
  87. }
  88.  
  89. #ifdef __x86_64__
  90. static __inline__ void __DEFAULT_FN_ATTRS _wrssq(unsigned long long __a, void * __p) {
  91.   __builtin_ia32_wrssq(__a, __p);
  92. }
  93. #endif /* __x86_64__ */
  94.  
  95. static __inline__ void __DEFAULT_FN_ATTRS _wrussd(unsigned int __a, void * __p) {
  96.   __builtin_ia32_wrussd(__a, __p);
  97. }
  98.  
  99. #ifdef __x86_64__
  100. static __inline__ void __DEFAULT_FN_ATTRS _wrussq(unsigned long long __a, void * __p) {
  101.   __builtin_ia32_wrussq(__a, __p);
  102. }
  103. #endif /* __x86_64__ */
  104.  
  105. static __inline__ void __DEFAULT_FN_ATTRS _setssbsy(void) {
  106.   __builtin_ia32_setssbsy();
  107. }
  108.  
  109. static __inline__ void __DEFAULT_FN_ATTRS _clrssbsy(void * __p) {
  110.   __builtin_ia32_clrssbsy(__p);
  111. }
  112.  
  113. #undef __DEFAULT_FN_ATTRS
  114.  
  115. #endif /* __CETINTRIN_H */
  116.