clang  8.0.0svn
cetintrin.h
Go to the documentation of this file.
1 /*===---- cetintrin.h - CET intrinsic --------------------------------------===
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to deal
5  * in the Software without restriction, including without limitation the rights
6  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7  * copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19  * THE SOFTWARE.
20  *
21  *===-----------------------------------------------------------------------===
22  */
23 
24 #ifndef __IMMINTRIN_H
25 #error "Never use <cetintrin.h> directly; include <immintrin.h> instead."
26 #endif
27 
28 #ifndef __CETINTRIN_H
29 #define __CETINTRIN_H
30 
31 /* Define the default attributes for the functions in this file. */
32 #define __DEFAULT_FN_ATTRS \
33  __attribute__((__always_inline__, __nodebug__, __target__("shstk")))
34 
35 static __inline__ void __DEFAULT_FN_ATTRS _incsspd(int __a) {
36  __builtin_ia32_incsspd(__a);
37 }
38 
39 #ifdef __x86_64__
40 static __inline__ void __DEFAULT_FN_ATTRS _incsspq(unsigned long long __a) {
41  __builtin_ia32_incsspq(__a);
42 }
43 #endif /* __x86_64__ */
44 
45 #ifdef __x86_64__
46 static __inline__ void __DEFAULT_FN_ATTRS _inc_ssp(unsigned int __a) {
47  __builtin_ia32_incsspq(__a);
48 }
49 #else /* __x86_64__ */
50 static __inline__ void __DEFAULT_FN_ATTRS _inc_ssp(unsigned int __a) {
51  __builtin_ia32_incsspd((int)__a);
52 }
53 #endif /* __x86_64__ */
54 
55 static __inline__ unsigned int __DEFAULT_FN_ATTRS _rdsspd(unsigned int __a) {
56  return __builtin_ia32_rdsspd(__a);
57 }
58 
59 #ifdef __x86_64__
60 static __inline__ unsigned long long __DEFAULT_FN_ATTRS _rdsspq(unsigned long long __a) {
61  return __builtin_ia32_rdsspq(__a);
62 }
63 #endif /* __x86_64__ */
64 
65 #ifdef __x86_64__
66 static __inline__ unsigned long long __DEFAULT_FN_ATTRS _get_ssp(void) {
67  return __builtin_ia32_rdsspq(0);
68 }
69 #else /* __x86_64__ */
70 static __inline__ unsigned int __DEFAULT_FN_ATTRS _get_ssp(void) {
71  return __builtin_ia32_rdsspd(0);
72 }
73 #endif /* __x86_64__ */
74 
75 static __inline__ void __DEFAULT_FN_ATTRS _saveprevssp() {
76  __builtin_ia32_saveprevssp();
77 }
78 
79 static __inline__ void __DEFAULT_FN_ATTRS _rstorssp(void * __p) {
80  __builtin_ia32_rstorssp(__p);
81 }
82 
83 static __inline__ void __DEFAULT_FN_ATTRS _wrssd(unsigned int __a, void * __p) {
84  __builtin_ia32_wrssd(__a, __p);
85 }
86 
87 #ifdef __x86_64__
88 static __inline__ void __DEFAULT_FN_ATTRS _wrssq(unsigned long long __a, void * __p) {
89  __builtin_ia32_wrssq(__a, __p);
90 }
91 #endif /* __x86_64__ */
92 
93 static __inline__ void __DEFAULT_FN_ATTRS _wrussd(unsigned int __a, void * __p) {
94  __builtin_ia32_wrussd(__a, __p);
95 }
96 
97 #ifdef __x86_64__
98 static __inline__ void __DEFAULT_FN_ATTRS _wrussq(unsigned long long __a, void * __p) {
99  __builtin_ia32_wrussq(__a, __p);
100 }
101 #endif /* __x86_64__ */
102 
103 static __inline__ void __DEFAULT_FN_ATTRS _setssbsy() {
104  __builtin_ia32_setssbsy();
105 }
106 
107 static __inline__ void __DEFAULT_FN_ATTRS _clrssbsy(void * __p) {
108  __builtin_ia32_clrssbsy(__p);
109 }
110 
111 #undef __DEFAULT_FN_ATTRS
112 
113 #endif /* __CETINTRIN_H */
static __inline__ void __DEFAULT_FN_ATTRS _setssbsy()
Definition: cetintrin.h:103
static __inline__ void __DEFAULT_FN_ATTRS _rstorssp(void *__p)
Definition: cetintrin.h:79
static __inline__ void int __a
Definition: emmintrin.h:4099
static __inline__ void __DEFAULT_FN_ATTRS _clrssbsy(void *__p)
Definition: cetintrin.h:107
static __inline unsigned char unsigned int unsigned int unsigned int * __p
Definition: adxintrin.h:38
static __inline__ unsigned int __DEFAULT_FN_ATTRS _rdsspd(unsigned int __a)
Definition: cetintrin.h:55
static __inline__ void __DEFAULT_FN_ATTRS _wrussd(unsigned int __a, void *__p)
Definition: cetintrin.h:93
#define __DEFAULT_FN_ATTRS
Definition: cetintrin.h:32
static __inline__ void __DEFAULT_FN_ATTRS _wrssd(unsigned int __a, void *__p)
Definition: cetintrin.h:83
static __inline__ void __DEFAULT_FN_ATTRS _incsspd(int __a)
Definition: cetintrin.h:35
static __inline__ void __DEFAULT_FN_ATTRS _inc_ssp(unsigned int __a)
Definition: cetintrin.h:50
static __inline__ void __DEFAULT_FN_ATTRS _saveprevssp()
Definition: cetintrin.h:75
static __inline__ unsigned int __DEFAULT_FN_ATTRS _get_ssp(void)
Definition: cetintrin.h:70