[compiler-rt] [llvm] [compiler-rt][X86] Unify getAMDProcessorTypeAndSubType (PR #97863)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 7 11:53:37 PDT 2024


================
@@ -707,9 +707,7 @@ static StringRef
 getIntelProcessorTypeAndSubtype(unsigned Family, unsigned Model,
                                 const unsigned *Features,
                                 unsigned *Type, unsigned *Subtype) {
-  auto testFeature = [&](unsigned F) {
-    return (Features[F / 32] & (1U << (F % 32))) != 0;
-  };
+#define testFeature(F) (Features[F / 32] & (1 << (F % 32))) != 0
----------------
boomanaiden154 wrote:

Fixed. I moved the definition above `getIntelProcessorType*` and added an undef after `getAMDProcessorType*`. Right, the lambda would be cleaner, but lambdas are a C++ feature, which means we can't use it in a unified implementation between LLVM and compiler-rt.

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


More information about the llvm-commits mailing list