138fd1498Szrj /* Copyright (C) 2012-2018 Free Software Foundation, Inc.
238fd1498Szrj
338fd1498Szrj This file is part of GCC.
438fd1498Szrj
538fd1498Szrj GCC is free software; you can redistribute it and/or modify
638fd1498Szrj it under the terms of the GNU General Public License as published by
738fd1498Szrj the Free Software Foundation; either version 3, or (at your option)
838fd1498Szrj any later version.
938fd1498Szrj
1038fd1498Szrj GCC is distributed in the hope that it will be useful,
1138fd1498Szrj but WITHOUT ANY WARRANTY; without even the implied warranty of
1238fd1498Szrj MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1338fd1498Szrj GNU General Public License for more details.
1438fd1498Szrj
1538fd1498Szrj Under Section 7 of GPL version 3, you are granted additional
1638fd1498Szrj permissions described in the GCC Runtime Library Exception, version
1738fd1498Szrj 3.1, as published by the Free Software Foundation.
1838fd1498Szrj
1938fd1498Szrj You should have received a copy of the GNU General Public License and
2038fd1498Szrj a copy of the GCC Runtime Library Exception along with this program;
2138fd1498Szrj see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
2238fd1498Szrj <http://www.gnu.org/licenses/>. */
2338fd1498Szrj
2438fd1498Szrj /* #if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED */
2538fd1498Szrj /* # error "Never use <xsaveintrin.h> directly; include <x86intrin.h> instead." */
2638fd1498Szrj /* #endif */
2738fd1498Szrj
2838fd1498Szrj #ifndef _XSAVEINTRIN_H_INCLUDED
2938fd1498Szrj #define _XSAVEINTRIN_H_INCLUDED
3038fd1498Szrj
3138fd1498Szrj #ifndef __XSAVE__
3238fd1498Szrj #pragma GCC push_options
3338fd1498Szrj #pragma GCC target("xsave")
3438fd1498Szrj #define __DISABLE_XSAVE__
3538fd1498Szrj #endif /* __XSAVE__ */
3638fd1498Szrj
3738fd1498Szrj extern __inline void
3838fd1498Szrj __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_xsave(void * __P,long long __M)3938fd1498Szrj _xsave (void *__P, long long __M)
4038fd1498Szrj {
4138fd1498Szrj __builtin_ia32_xsave (__P, __M);
4238fd1498Szrj }
4338fd1498Szrj
4438fd1498Szrj extern __inline void
4538fd1498Szrj __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_xrstor(void * __P,long long __M)4638fd1498Szrj _xrstor (void *__P, long long __M)
4738fd1498Szrj {
4838fd1498Szrj __builtin_ia32_xrstor (__P, __M);
4938fd1498Szrj }
5038fd1498Szrj
5138fd1498Szrj extern __inline void
5238fd1498Szrj __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_xsetbv(unsigned int __A,long long __V)5338fd1498Szrj _xsetbv (unsigned int __A, long long __V)
5438fd1498Szrj {
5538fd1498Szrj __builtin_ia32_xsetbv (__A, __V);
5638fd1498Szrj }
5738fd1498Szrj
5838fd1498Szrj extern __inline long long
5938fd1498Szrj __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_xgetbv(unsigned int __A)6038fd1498Szrj _xgetbv (unsigned int __A)
6138fd1498Szrj {
62*58e805e6Szrj return __builtin_ia32_xgetbv (__A);
6338fd1498Szrj }
6438fd1498Szrj
6538fd1498Szrj #ifdef __x86_64__
6638fd1498Szrj extern __inline void
6738fd1498Szrj __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_xsave64(void * __P,long long __M)6838fd1498Szrj _xsave64 (void *__P, long long __M)
6938fd1498Szrj {
7038fd1498Szrj __builtin_ia32_xsave64 (__P, __M);
7138fd1498Szrj }
7238fd1498Szrj
7338fd1498Szrj extern __inline void
7438fd1498Szrj __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_xrstor64(void * __P,long long __M)7538fd1498Szrj _xrstor64 (void *__P, long long __M)
7638fd1498Szrj {
7738fd1498Szrj __builtin_ia32_xrstor64 (__P, __M);
7838fd1498Szrj }
7938fd1498Szrj #endif
8038fd1498Szrj
8138fd1498Szrj #ifdef __DISABLE_XSAVE__
8238fd1498Szrj #undef __DISABLE_XSAVE__
8338fd1498Szrj #pragma GCC pop_options
8438fd1498Szrj #endif /* __DISABLE_XSAVE__ */
8538fd1498Szrj
8638fd1498Szrj #endif /* _XSAVEINTRIN_H_INCLUDED */
87