[clang] [X86] Enable constexpr on LZCNT & BMI intrinsics (PR #94161)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 2 07:46:49 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 0310f7f2d0c56a5697710251cec9803cbf7b4d56 7ede5764c9279a64cd36a5703255ec94a8109341 -- clang/lib/Headers/bmiintrin.h clang/lib/Headers/lzcntintrin.h clang/test/CodeGen/X86/bmi-builtins.c clang/test/CodeGen/X86/lzcnt-builtins.c
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Headers/bmiintrin.h b/clang/lib/Headers/bmiintrin.h
index 801da6584f..a65e20605a 100644
--- a/clang/lib/Headers/bmiintrin.h
+++ b/clang/lib/Headers/bmiintrin.h
@@ -37,8 +37,7 @@
/// bits in the operand.
/// \see _tzcnt_u16
static __inline__ unsigned short __RELAXED_FN_ATTRS_CONSTEXPR
-__tzcnt_u16(unsigned short __X)
-{
+__tzcnt_u16(unsigned short __X) {
return __builtin_ia32_tzcnt_u16(__X);
}
@@ -71,8 +70,7 @@ __tzcnt_u16(unsigned short __X)
/// bits in the operand.
/// \see { _mm_tzcnt_32 _tzcnt_u32 }
static __inline__ unsigned int __RELAXED_FN_ATTRS_CONSTEXPR
-__tzcnt_u32(unsigned int __X)
-{
+__tzcnt_u32(unsigned int __X) {
return __builtin_ia32_tzcnt_u32(__X);
}
@@ -88,8 +86,7 @@ __tzcnt_u32(unsigned int __X)
/// the operand.
/// \see { __tzcnt_u32 _tzcnt_u32 }
static __inline__ int __RELAXED_FN_ATTRS_CONSTEXPR
-_mm_tzcnt_32(unsigned int __X)
-{
+_mm_tzcnt_32(unsigned int __X) {
return (int)__builtin_ia32_tzcnt_u32(__X);
}
@@ -124,8 +121,7 @@ _mm_tzcnt_32(unsigned int __X)
/// bits in the operand.
/// \see { _mm_tzcnt_64 _tzcnt_u64 }
static __inline__ unsigned long long __RELAXED_FN_ATTRS_CONSTEXPR
-__tzcnt_u64(unsigned long long __X)
-{
+__tzcnt_u64(unsigned long long __X) {
return __builtin_ia32_tzcnt_u64(__X);
}
@@ -141,8 +137,7 @@ __tzcnt_u64(unsigned long long __X)
/// the operand.
/// \see { __tzcnt_u64 _tzcnt_u64 }
static __inline__ long long __RELAXED_FN_ATTRS_CONSTEXPR
-_mm_tzcnt_64(unsigned long long __X)
-{
+_mm_tzcnt_64(unsigned long long __X) {
return (long long)__builtin_ia32_tzcnt_u64(__X);
}
@@ -194,8 +189,7 @@ _mm_tzcnt_64(unsigned long long __X)
/// operand with the one's complement of the first operand.
/// \see _andn_u32
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
-__andn_u32(unsigned int __X, unsigned int __Y)
-{
+__andn_u32(unsigned int __X, unsigned int __Y) {
return ~__X & __Y;
}
@@ -237,8 +231,7 @@ __andn_u32(unsigned int __X, unsigned int __Y)
/// extracted bits.
/// \see _bextr_u32
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
-__bextr_u32(unsigned int __X, unsigned int __Y)
-{
+__bextr_u32(unsigned int __X, unsigned int __Y) {
return __builtin_ia32_bextr_u32(__X, __Y);
}
@@ -262,8 +255,7 @@ __bextr_u32(unsigned int __X, unsigned int __Y)
/// extracted bits.
/// \see __bextr_u32
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
-_bextr_u32(unsigned int __X, unsigned int __Y, unsigned int __Z)
-{
+_bextr_u32(unsigned int __X, unsigned int __Y, unsigned int __Z) {
return __builtin_ia32_bextr_u32 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
}
@@ -302,8 +294,7 @@ _bextr2_u32(unsigned int __X, unsigned int __Y) {
/// the source operand.
/// \see _blsi_u32
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
-__blsi_u32(unsigned int __X)
-{
+__blsi_u32(unsigned int __X) {
return __X & -__X;
}
@@ -338,8 +329,7 @@ __blsi_u32(unsigned int __X)
/// \returns An unsigned integer containing the newly created mask.
/// \see _blsmsk_u32
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
-__blsmsk_u32(unsigned int __X)
-{
+__blsmsk_u32(unsigned int __X) {
return __X ^ (__X - 1);
}
@@ -374,8 +364,7 @@ __blsmsk_u32(unsigned int __X)
/// operand.
/// \see _blsr_u32
static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
-__blsr_u32(unsigned int __X)
-{
+__blsr_u32(unsigned int __X) {
return __X & (__X - 1);
}
@@ -414,8 +403,7 @@ __blsr_u32(unsigned int __X)
/// operand with the one's complement of the first operand.
/// \see _andn_u64
static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
-__andn_u64 (unsigned long long __X, unsigned long long __Y)
-{
+__andn_u64(unsigned long long __X, unsigned long long __Y) {
return ~__X & __Y;
}
@@ -458,8 +446,7 @@ __andn_u64 (unsigned long long __X, unsigned long long __Y)
/// extracted bits.
/// \see _bextr_u64
static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
-__bextr_u64(unsigned long long __X, unsigned long long __Y)
-{
+__bextr_u64(unsigned long long __X, unsigned long long __Y) {
return __builtin_ia32_bextr_u64(__X, __Y);
}
@@ -483,8 +470,7 @@ __bextr_u64(unsigned long long __X, unsigned long long __Y)
/// extracted bits.
/// \see __bextr_u64
static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
-_bextr_u64(unsigned long long __X, unsigned int __Y, unsigned int __Z)
-{
+_bextr_u64(unsigned long long __X, unsigned int __Y, unsigned int __Z) {
return __builtin_ia32_bextr_u64 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
}
@@ -523,8 +509,7 @@ _bextr2_u64(unsigned long long __X, unsigned long long __Y) {
/// bits from the source operand.
/// \see _blsi_u64
static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
-__blsi_u64(unsigned long long __X)
-{
+__blsi_u64(unsigned long long __X) {
return __X & -__X;
}
@@ -559,8 +544,7 @@ __blsi_u64(unsigned long long __X)
/// \returns An unsigned 64-bit integer containing the newly created mask.
/// \see _blsmsk_u64
static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
-__blsmsk_u64(unsigned long long __X)
-{
+__blsmsk_u64(unsigned long long __X) {
return __X ^ (__X - 1);
}
@@ -595,8 +579,7 @@ __blsmsk_u64(unsigned long long __X)
/// source operand.
/// \see _blsr_u64
static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
-__blsr_u64(unsigned long long __X)
-{
+__blsr_u64(unsigned long long __X) {
return __X & (__X - 1);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/94161
More information about the cfe-commits
mailing list