Skip to content

Commit 6b002b8

Browse files
authored
Merge pull request #6686 from compnerd/get-inline
Headers: use C++ inline semantics in C++ mode
2 parents c850ad5 + e291cd7 commit 6b002b8

File tree

1 file changed

+35
-22
lines changed

1 file changed

+35
-22
lines changed

clang/lib/Headers/adxintrin.h

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,56 +17,69 @@
1717
/* Define the default attributes for the functions in this file. */
1818
#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
1919

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+
2031
/* 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) {
2536
return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
2637
}
2738

2839
#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) {
3344
return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
3445
}
3546
#endif
3647

3748
/* 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) {
4253
return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
4354
}
4455

4556
#ifdef __x86_64__
46-
static __inline unsigned char __DEFAULT_FN_ATTRS
57+
__INLINE unsigned char __DEFAULT_FN_ATTRS
4758
_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) {
5060
return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
5161
}
5262
#endif
5363

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) {
5868
return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p);
5969
}
6070

6171
#ifdef __x86_64__
62-
static __inline unsigned char __DEFAULT_FN_ATTRS
72+
__INLINE unsigned char __DEFAULT_FN_ATTRS
6373
_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) {
6675
return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p);
6776
}
6877
#endif
6978

79+
#if defined(__cplusplus)
80+
}
81+
#endif
82+
7083
#undef __DEFAULT_FN_ATTRS
7184

7285
#endif /* __ADXINTRIN_H */

0 commit comments

Comments
 (0)