================
@@ -1919,10 +1921,21 @@ 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 a compiler that supports
+// the 'target' attribute, which is used for runtime dispatch. Otherwise, we
+// fall back to the scalar implementation.
+#if (defined(__i386__) || defined(__x86_64__)) && defined(__has_attribute) &&  
\
+    __has_attribute(target) && !defined(_WIN32)
----------------
mstorsjo wrote:

Yes, it does seem to work for Clang for x86_64 too (that godbolt link doesn't 
show the resolver which is the more essential part though; that linked snippet 
does compile with mingw GCC too, but once you need to produce the resolver, it 
fails). But for clang-cl/MSVC mode I don't think we generally require linking 
in compiler-rt, so I'd avoid using it there.

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