[clang] [llvm] [Clang][Lexer] Reland "Detect SSE4.2 availability at runtime in fastParseASCIIIdentifier" (PR #180631)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 10 08:01:57 PST 2026


================
@@ -762,4 +762,35 @@ void AnnotateIgnoreWritesEnd(const char *file, int line);
 #endif
 // clang-format on
 
+/// \macro LLVM_IS_X86
+/// Whether the target architecture is x86 / x86-64.
+#if defined(__x86_64__) || defined(__i386__)
+#define LLVM_IS_X86 1
+#else
+#define LLVM_IS_X86 0
+#endif
+
+/// \macro LLVM_TARGET_SSE42
+/// Function attribute to compile a function with SSE4.2 enabled.
+#if defined(__has_attribute) && __has_attribute(target)
+#define LLVM_TARGET_SSE42 __attribute__((target("sse4.2")))
+#else
+#define LLVM_TARGET_SSE42
+#endif
+
+#if __has_builtin(__builtin_cpu_supports)
+#define LLVM_CPU_SUPPORTS(feature) __builtin_cpu_supports(feature)
----------------
mstorsjo wrote:

In MSVC environments, even if building with clang, `clang_rt.builtins.lib` is not necessarily always available, in existing environments. (And when it is available, it can be available under two names, depending on the build configuration. Properly automatically linking in the builtins library in clang-cl configurations is a problem that isn't really solved yet.)

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


More information about the cfe-commits mailing list