|
17 | 17 | /* Define the default attributes for the functions in this file. */
|
18 | 18 | #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
|
19 | 19 |
|
| 20 | +/* Use C++ inline semantics in C++, GNU inline for C mode. */ |
| 21 | +#if defined(__cplusplus) |
| 22 | +#define __INLINE __inline |
| 23 | +#else |
| 24 | +#define __INLINE static __inline |
| 25 | +#endif |
| 26 | + |
| 27 | +#if defined(__cplusplus) |
| 28 | +extern "C" { |
| 29 | +#endif |
| 30 | + |
20 | 31 | /* Intrinsics that are available only if __ADX__ defined */
|
21 |
| -static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx"))) |
22 |
| -_addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y, |
23 |
| - unsigned int *__p) |
24 |
| -{ |
| 32 | +__INLINE unsigned char |
| 33 | + __attribute__((__always_inline__, __nodebug__, __target__("adx"))) |
| 34 | + _addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y, |
| 35 | + unsigned int *__p) { |
25 | 36 | return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
|
26 | 37 | }
|
27 | 38 |
|
28 | 39 | #ifdef __x86_64__
|
29 |
| -static __inline unsigned char __attribute__((__always_inline__, __nodebug__, __target__("adx"))) |
30 |
| -_addcarryx_u64(unsigned char __cf, unsigned long long __x, |
31 |
| - unsigned long long __y, unsigned long long *__p) |
32 |
| -{ |
| 40 | +__INLINE unsigned char |
| 41 | + __attribute__((__always_inline__, __nodebug__, __target__("adx"))) |
| 42 | + _addcarryx_u64(unsigned char __cf, unsigned long long __x, |
| 43 | + unsigned long long __y, unsigned long long *__p) { |
33 | 44 | return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
|
34 | 45 | }
|
35 | 46 | #endif
|
36 | 47 |
|
37 | 48 | /* Intrinsics that are also available if __ADX__ undefined */
|
38 |
| -static __inline unsigned char __DEFAULT_FN_ATTRS |
39 |
| -_addcarry_u32(unsigned char __cf, unsigned int __x, unsigned int __y, |
40 |
| - unsigned int *__p) |
41 |
| -{ |
| 49 | +__INLINE unsigned char __DEFAULT_FN_ATTRS _addcarry_u32(unsigned char __cf, |
| 50 | + unsigned int __x, |
| 51 | + unsigned int __y, |
| 52 | + unsigned int *__p) { |
42 | 53 | return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
|
43 | 54 | }
|
44 | 55 |
|
45 | 56 | #ifdef __x86_64__
|
46 |
| -static __inline unsigned char __DEFAULT_FN_ATTRS |
| 57 | +__INLINE unsigned char __DEFAULT_FN_ATTRS |
47 | 58 | _addcarry_u64(unsigned char __cf, unsigned long long __x,
|
48 |
| - unsigned long long __y, unsigned long long *__p) |
49 |
| -{ |
| 59 | + unsigned long long __y, unsigned long long *__p) { |
50 | 60 | return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
|
51 | 61 | }
|
52 | 62 | #endif
|
53 | 63 |
|
54 |
| -static __inline unsigned char __DEFAULT_FN_ATTRS |
55 |
| -_subborrow_u32(unsigned char __cf, unsigned int __x, unsigned int __y, |
56 |
| - unsigned int *__p) |
57 |
| -{ |
| 64 | +__INLINE unsigned char __DEFAULT_FN_ATTRS _subborrow_u32(unsigned char __cf, |
| 65 | + unsigned int __x, |
| 66 | + unsigned int __y, |
| 67 | + unsigned int *__p) { |
58 | 68 | return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p);
|
59 | 69 | }
|
60 | 70 |
|
61 | 71 | #ifdef __x86_64__
|
62 |
| -static __inline unsigned char __DEFAULT_FN_ATTRS |
| 72 | +__INLINE unsigned char __DEFAULT_FN_ATTRS |
63 | 73 | _subborrow_u64(unsigned char __cf, unsigned long long __x,
|
64 |
| - unsigned long long __y, unsigned long long *__p) |
65 |
| -{ |
| 74 | + unsigned long long __y, unsigned long long *__p) { |
66 | 75 | return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p);
|
67 | 76 | }
|
68 | 77 | #endif
|
69 | 78 |
|
| 79 | +#if defined(__cplusplus) |
| 80 | +} |
| 81 | +#endif |
| 82 | + |
70 | 83 | #undef __DEFAULT_FN_ATTRS
|
71 | 84 |
|
72 | 85 | #endif /* __ADXINTRIN_H */
|
0 commit comments