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

Thibault Monnier via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 10 09:02:17 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)
----------------
Thibault-Monnier wrote:

Thanks for your help. Unfortunately, I do not know much about MSVC environments, so I will leave out Windows from the runtime check. If you wish, you can always open a separate PR later to improve this.

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


More information about the cfe-commits mailing list