[clang] [llvm] [Clang][Lexer] Reland "Detect SSE4.2 availability at runtime in fastParseASCIIIdentifier" (PR #175452)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 15 10:12:58 PST 2026
================
@@ -1943,14 +1957,17 @@ fastParseASCIIIdentifier(const char *CurPtr,
continue;
return CurPtr;
}
-#endif
- unsigned char C = *CurPtr;
- while (isAsciiIdentifierContinue(C))
- C = *++CurPtr;
- return CurPtr;
+ return fastParseASCIIIdentifierScalar(CurPtr);
}
+LLVM_UNLESS_SSE42(__attribute__((target("default"))))
+#endif
+LLVM_UNLESS_SSE42(static const char *fastParseASCIIIdentifier(
----------------
AaronBallman wrote:
Would it be possible for us to: 1) put the `__attribute__((target))` bits behind a macro in Compiler.h so it will expand to nothing on platforms which don't support it, and 2) rework this more like:
```suggestion
#endif
LLVM_UNLESS_SSE42(LLVM_TARGET_DEFAULT static const char *fastParseASCIIIdentifier(
```
What's bothering me about the current code is that the target attribute is in a preprocessor block that's not also covering the definition of the function which uses the target attribute.
If this is a bad idea, feel free to say so. :-)
https://github.com/llvm/llvm-project/pull/175452
More information about the cfe-commits
mailing list