[clang] 5dc7a5e - [clang][x86] popcntintrin.h - merge the __DEFAULT_FN_ATTRS / __DEFAULT_FN_ATTRS_CONSTEXPR defines. NFC.

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 7 06:10:56 PDT 2024


Author: Simon Pilgrim
Date: 2024-10-07T14:10:39+01:00
New Revision: 5dc7a5e50bd21cc818a3a71691af9780291b75b2

URL: https://github.com/llvm/llvm-project/commit/5dc7a5e50bd21cc818a3a71691af9780291b75b2
DIFF: https://github.com/llvm/llvm-project/commit/5dc7a5e50bd21cc818a3a71691af9780291b75b2.diff

LOG: [clang][x86] popcntintrin.h - merge the __DEFAULT_FN_ATTRS / __DEFAULT_FN_ATTRS_CONSTEXPR defines. NFC.

We only need one define - so consistently use __DEFAULT_FN_ATTRS like we do in other headers.

Added: 
    

Modified: 
    clang/lib/Headers/popcntintrin.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/popcntintrin.h b/clang/lib/Headers/popcntintrin.h
index 0aa94aecda5b80..b276b4da4dc291 100644
--- a/clang/lib/Headers/popcntintrin.h
+++ b/clang/lib/Headers/popcntintrin.h
@@ -11,12 +11,13 @@
 #define __POPCNTINTRIN_H
 
 /* Define the default attributes for the functions in this file. */
-#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("popcnt")))
-
 #if defined(__cplusplus) && (__cplusplus >= 201103L)
-#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
+#define __DEFAULT_FN_ATTRS                                                     \
+  __attribute__((__always_inline__, __nodebug__,                               \
+                 __target__("popcnt"))) constexpr
 #else
-#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
+#define __DEFAULT_FN_ATTRS                                                     \
+  __attribute__((__always_inline__, __nodebug__, __target__("popcnt")))
 #endif
 
 /// Counts the number of bits in the source operand having a value of 1.
@@ -29,7 +30,7 @@
 ///    An unsigned 32-bit integer operand.
 /// \returns A 32-bit integer containing the number of bits with value 1 in the
 ///    source operand.
-static __inline__ int __DEFAULT_FN_ATTRS_CONSTEXPR
+static __inline__ int __DEFAULT_FN_ATTRS
 _mm_popcnt_u32(unsigned int __A)
 {
   return __builtin_popcount(__A);
@@ -46,7 +47,7 @@ _mm_popcnt_u32(unsigned int __A)
 ///    An unsigned 64-bit integer operand.
 /// \returns A 64-bit integer containing the number of bits with value 1 in the
 ///    source operand.
-static __inline__ long long __DEFAULT_FN_ATTRS_CONSTEXPR
+static __inline__ long long __DEFAULT_FN_ATTRS
 _mm_popcnt_u64(unsigned long long __A)
 {
   return __builtin_popcountll(__A);
@@ -54,6 +55,5 @@ _mm_popcnt_u64(unsigned long long __A)
 #endif /* __x86_64__ */
 
 #undef __DEFAULT_FN_ATTRS
-#undef __DEFAULT_FN_ATTRS_CONSTEXPR
 
 #endif /* __POPCNTINTRIN_H */


        


More information about the cfe-commits mailing list