[clang] [X86][Clang] allow CRC32 intrinsics to be used in constexp (PR #173908)

Julian Pokrovsky via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 15 21:54:03 PST 2026


================
@@ -10,8 +10,14 @@
 #ifndef __CRC32INTRIN_H
 #define __CRC32INTRIN_H
 
-#define __DEFAULT_FN_ATTRS                                                     \
+/// We only declare crc32 as a constexpr if we are compiling C++ code
+#if defined(__cplusplus) && (__cplusplus >= 201103L)
+#define __DEFAULT_FN_ATTRS_CONSTEXPR                                           \
+  __attribute__((__always_inline__, __nodebug__, __target__("crc32"))) constexpr
+#else
+#define __DEFAULT_FN_ATTRS_CONSTEXPR                                           \
----------------
raventid wrote:

Fixed by https://github.com/llvm/llvm-project/pull/173908/changes/e06b49fd965ade188b3ff7fe9b0a77443050064d

https://github.com/llvm/llvm-project/pull/173908


More information about the cfe-commits mailing list