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

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 10 12:51:39 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)
----------------
Andarwinux wrote:

> so I will leave out Windows from the runtime check

`__builtin_cpu_supports` is supported for mingw.

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


More information about the cfe-commits mailing list