================
@@ -1920,10 +1921,25 @@ bool Lexer::LexUnicodeIdentifierStart(Token &Result, 
uint32_t C,
   return true;
 }
 
-static const char *
-fastParseASCIIIdentifier(const char *CurPtr,
-                         [[maybe_unused]] const char *BufferEnd) {
-#ifdef __SSE4_2__
+static const char *fastParseASCIIIdentifierScalar(const char *CurPtr) {
+  unsigned char C = *CurPtr;
+  while (isAsciiIdentifierContinue(C))
+    C = *++CurPtr;
+  return CurPtr;
+}
+
+// Fast path for lexing ASCII identifiers using SSE4.2 instructions.
+// Only enabled on x86/x86_64 when building with __SSE4_2__ enabled, or with a
+// compiler that supports the 'target' attribute, used for runtime dispatch.
+// Otherwise, we fall back to the scalar implementation.
+// We avoid runtime check on Windows because it is not yet well-supported.
+#if defined(__SSE4_2__) || (defined(__i386__) || defined(__x86_64__)) &&       
\
----------------
Thibault-Monnier wrote:

I tried to simplify with macros in e8370a9512f6851d39256139b722b09e783e0305, 
but I'm not satisfied with the result. What exactly were you proposing?

https://github.com/llvm/llvm-project/pull/175452
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to