[PATCH] D47474: Implement cpu_dispatch/cpu_specific Multiversioning

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 29 14:29:28 PDT 2018


craig.topper added inline comments.


================
Comment at: include/clang/Basic/X86Target.def:295
+CPU_SPECIFIC("pentium_iii", 'H',
+             (1ULL << FEATURE_CMOV | 1ULL << FEATURE_MMX | 1ULL << FEATURE_SSE))
+CPU_SPECIFIC("pentium_iii_no_xmm_regs", 'H',
----------------
Could we just make the features a comma separated string? Then we wouldn't need a third version of EmitX86CpuSupports? Yeah it would incur string processing costs, but is that a big deal?


================
Comment at: lib/Sema/SemaDecl.cpp:9214
+    return MultiVersioning::Target;
+  else if (FD->hasAttr<CpuDispatchAttr>())
+    return MultiVersioning::CpuDispatch;
----------------
No need for else after return.


================
Comment at: lib/Sema/SemaDeclAttr.cpp:1901
+    const TargetInfo &Target = S.Context.getTargetInfo();
+    if (llvm::find_if(Cpus, [CpuName, &Target](const IdentifierInfo *Cur) {
+          return Target.cpuSpecificManglingCharacter(CpuName) ==
----------------
Maybe use llvm::any_of since you don't actually care about the iterator returned.


https://reviews.llvm.org/D47474





More information about the cfe-commits mailing list