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

Simon Pilgrim via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 4 02:08:40 PDT 2023


RKSimon 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){}
----------------
FreddyYe wrote:
> 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?
Yes please, that would great.


================
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.
----------------
FreddyYe wrote:
> 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.
> 
OK - please can you add that to a comment above line 311 for future reference?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151696



More information about the cfe-commits mailing list