Skip to content

Conversation

@markbhasawut
Copy link
Contributor

While working on PR #152910, I discovered some incorrectly defined __DEFAULT_FN_ATTRS*_CONSTEXPR macros for non-constexpr contexts.

While working on PR llvm#152910, I discovered some incorrectly defined
`__DEFAULT_FN_ATTRS*_CONSTEXPR` macros for non-constexpr contexts.
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:X86 clang:headers Headers provided by Clang, e.g. for intrinsics labels Aug 11, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 11, 2025

@llvm/pr-subscribers-backend-x86

@llvm/pr-subscribers-clang

Author: Bhasawut Singhaphan (markbhasawut)

Changes

While working on PR #152910, I discovered some incorrectly defined __DEFAULT_FN_ATTRS*_CONSTEXPR macros for non-constexpr contexts.


Full diff: https://github.com/llvm/llvm-project/pull/153060.diff

2 Files Affected:

  • (modified) clang/lib/Headers/avx512fintrin.h (+2-2)
  • (modified) clang/lib/Headers/avxintrin.h (+2-2)
diff --git a/clang/lib/Headers/avx512fintrin.h b/clang/lib/Headers/avx512fintrin.h
index b3e9efdd519ab..9fc1df3acd3d0 100644
--- a/clang/lib/Headers/avx512fintrin.h
+++ b/clang/lib/Headers/avx512fintrin.h
@@ -180,9 +180,9 @@ typedef enum
 #define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512 constexpr
 #define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
 #else
-#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS128
+#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
 #define __DEFAULT_FN_ATTRS512_CONSTEXPR __DEFAULT_FN_ATTRS512
-#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS
+#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
 #endif
 
 /* Create vectors with repeated elements */
diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h
index 5a6d48bc246e3..b8cfaee7cfb46 100644
--- a/clang/lib/Headers/avxintrin.h
+++ b/clang/lib/Headers/avxintrin.h
@@ -70,8 +70,8 @@ typedef __bf16 __m256bh __attribute__((__vector_size__(32), __aligned__(32)));
 #define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
 #define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128 constexpr
 #else
-#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS128
-#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS
+#define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
+#define __DEFAULT_FN_ATTRS128_CONSTEXPR __DEFAULT_FN_ATTRS128
 #endif
 
 /* Arithmetic */

Copy link
Contributor

@phoebewang phoebewang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@markbhasawut
Copy link
Contributor Author

Hi @phoebewang, Thanks for reviewing! Unfortunately, I don't have a commit access. Could you merge for me?

@phoebewang phoebewang merged commit 76942a2 into llvm:main Aug 12, 2025
13 checks passed
@phoebewang
Copy link
Contributor

Hi @phoebewang, Thanks for reviewing! Unfortunately, I don't have a commit access. Could you merge for me?

Sure!

@RKSimon
Copy link
Collaborator

RKSimon commented Aug 12, 2025

Thanks @markbhasawut !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:X86 clang:headers Headers provided by Clang, e.g. for intrinsics clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants