lwpintrin.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Copyright (C) 2007-2022 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3, or (at your option)
  6. any later version.
  7. GCC is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. #ifndef _X86GPRINTRIN_H_INCLUDED
  19. # error "Never use <lwpintrin.h> directly; include <x86gprintrin.h> instead."
  20. #endif
  21. #ifndef _LWPINTRIN_H_INCLUDED
  22. #define _LWPINTRIN_H_INCLUDED
  23. #ifndef __LWP__
  24. #pragma GCC push_options
  25. #pragma GCC target("lwp")
  26. #define __DISABLE_LWP__
  27. #endif /* __LWP__ */
  28. extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  29. __llwpcb (void *__pcbAddress)
  30. {
  31. __builtin_ia32_llwpcb (__pcbAddress);
  32. }
  33. extern __inline void * __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  34. __slwpcb (void)
  35. {
  36. return __builtin_ia32_slwpcb ();
  37. }
  38. #ifdef __OPTIMIZE__
  39. extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  40. __lwpval32 (unsigned int __data2, unsigned int __data1, unsigned int __flags)
  41. {
  42. __builtin_ia32_lwpval32 (__data2, __data1, __flags);
  43. }
  44. #ifdef __x86_64__
  45. extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  46. __lwpval64 (unsigned long long __data2, unsigned int __data1,
  47. unsigned int __flags)
  48. {
  49. __builtin_ia32_lwpval64 (__data2, __data1, __flags);
  50. }
  51. #endif
  52. #else
  53. #define __lwpval32(D2, D1, F) \
  54. (__builtin_ia32_lwpval32 ((unsigned int) (D2), (unsigned int) (D1), \
  55. (unsigned int) (F)))
  56. #ifdef __x86_64__
  57. #define __lwpval64(D2, D1, F) \
  58. (__builtin_ia32_lwpval64 ((unsigned long long) (D2), (unsigned int) (D1), \
  59. (unsigned int) (F)))
  60. #endif
  61. #endif
  62. #ifdef __OPTIMIZE__
  63. extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  64. __lwpins32 (unsigned int __data2, unsigned int __data1, unsigned int __flags)
  65. {
  66. return __builtin_ia32_lwpins32 (__data2, __data1, __flags);
  67. }
  68. #ifdef __x86_64__
  69. extern __inline unsigned char __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  70. __lwpins64 (unsigned long long __data2, unsigned int __data1,
  71. unsigned int __flags)
  72. {
  73. return __builtin_ia32_lwpins64 (__data2, __data1, __flags);
  74. }
  75. #endif
  76. #else
  77. #define __lwpins32(D2, D1, F) \
  78. (__builtin_ia32_lwpins32 ((unsigned int) (D2), (unsigned int) (D1), \
  79. (unsigned int) (F)))
  80. #ifdef __x86_64__
  81. #define __lwpins64(D2, D1, F) \
  82. (__builtin_ia32_lwpins64 ((unsigned long long) (D2), (unsigned int) (D1), \
  83. (unsigned int) (F)))
  84. #endif
  85. #endif
  86. #ifdef __DISABLE_LWP__
  87. #undef __DISABLE_LWP__
  88. #pragma GCC pop_options
  89. #endif /* __DISABLE_LWP__ */
  90. #endif /* _LWPINTRIN_H_INCLUDED */