[PATCH] D151696: [x86] Remove CPU_SPECIFIC* MACROs and add getCPUDispatchMangling

Freddy, Ye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 3 19:29:54 PDT 2023


FreddyYe marked an inline comment as done.
FreddyYe added inline comments.


================
Comment at: clang/test/CodeGen/attr-cpuspecific-cpus.c:40
 ATTR(cpu_specific(knm)) void CPU(void){}
+ATTR(cpu_specific(cascadelake)) void CPU(void){}
+ATTR(cpu_specific(cooperlake)) void CPU(void){}
----------------
In this patch, I additionally supported some intel new CPU's _cpu_specific feature by creating a new mangling or copy some old ones (which means aliasing certain cpu). Maybe I should do this in a following patch?


================
Comment at: llvm/lib/TargetParser/X86TargetParser.cpp:378
+  { {"core_3rd_gen_avx"}, CK_IvyBridge, FEATURE_AVX, FeaturesIvyBridge, 'S', true },
+  { {"core-avx-i"}, CK_IvyBridge, FEATURE_AVX, FeaturesIvyBridge, '\0', false },
   // Haswell microarchitecture based processors.
----------------
RKSimon wrote:
> I'm still not clear on what determines the mangling mode and cpu dispatch flag for cpu targets are supposedly the same? For example, none of these ivybridge equivalent configs have the same values.
I assign them by following orders:
1. Copy the mangling from the original CPU_SPEICIFC MACRO.
2. If there's no way to copy, assign to '\0' by default, which means doesn't support __cpu_specific/dispatch feature.
3. If cpu name contain ''-', assign the mangling as '\0', too. Because '-' cannot be correctly identified in _cpu_specific/dispatch().
4. set OnlyForCPUDispatch flag as `true` if this cpu name was not listed here, which means it doesn't support -march, -mtune and so on. This flag makes this cpu name only support __cpu_dispatch/specific feature. E.g. core_3rd_gen_avx, core_4rd_gen_avx., ... And normally, these names are very old. So supporting them with -march=, -mtune= is not easy for now. And notice that new cpu names shouldn't set this flag as `true` since they should both support -march= and __cpu_specific/dispatch feature by default.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151696/new/

https://reviews.llvm.org/D151696



More information about the llvm-commits mailing list