xsaveintrin.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* Copyright (C) 2012-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 <xsaveintrin.h> directly; include <x86gprintrin.h> instead."
  20. #endif
  21. #ifndef _XSAVEINTRIN_H_INCLUDED
  22. #define _XSAVEINTRIN_H_INCLUDED
  23. #ifndef __XSAVE__
  24. #pragma GCC push_options
  25. #pragma GCC target("xsave")
  26. #define __DISABLE_XSAVE__
  27. #endif /* __XSAVE__ */
  28. extern __inline void
  29. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  30. _xsave (void *__P, long long __M)
  31. {
  32. __builtin_ia32_xsave (__P, __M);
  33. }
  34. extern __inline void
  35. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  36. _xrstor (void *__P, long long __M)
  37. {
  38. __builtin_ia32_xrstor (__P, __M);
  39. }
  40. extern __inline void
  41. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  42. _xsetbv (unsigned int __A, long long __V)
  43. {
  44. __builtin_ia32_xsetbv (__A, __V);
  45. }
  46. extern __inline long long
  47. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  48. _xgetbv (unsigned int __A)
  49. {
  50. return __builtin_ia32_xgetbv (__A);
  51. }
  52. #ifdef __x86_64__
  53. extern __inline void
  54. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  55. _xsave64 (void *__P, long long __M)
  56. {
  57. __builtin_ia32_xsave64 (__P, __M);
  58. }
  59. extern __inline void
  60. __attribute__((__gnu_inline__, __always_inline__, __artificial__))
  61. _xrstor64 (void *__P, long long __M)
  62. {
  63. __builtin_ia32_xrstor64 (__P, __M);
  64. }
  65. #endif
  66. #ifdef __DISABLE_XSAVE__
  67. #undef __DISABLE_XSAVE__
  68. #pragma GCC pop_options
  69. #endif /* __DISABLE_XSAVE__ */
  70. #endif /* _XSAVEINTRIN_H_INCLUDED */