FreddyYe added inline comments. Herald added a subscriber: StephenFan.
================ Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2067 + // favor this processor. + TuneCPU = SD->getCPUName(GD.getMultiVersionIndex())->getName(); + } ---------------- pengfei wrote: > erichkeane wrote: > > andrew.w.kaylor wrote: > > > Unfortunately, I don't think it's this easy. The list of names used for > > > cpu_specific doesn't come from the same place as the list of names used > > > by "tune-cpu". For one thing, the cpu_specific names can't contain the > > > '-' character, so we have names like "skylake_avx512" in cpu_specific > > > that would need to be translated to "skylake-avx512" for "tune-cpu". I > > > believe the list of valid names for "tune-cpu" comes from here: > > > https://github.com/llvm/llvm-project/blob/26cd258420c774254cc48330b1f4d23d353baf05/llvm/lib/Support/X86TargetParser.cpp#L294 > > > > > > Also, some of the aliases supported by cpu_specific don't have any > > > corresponding "tune-cpu" name. You happen to have picked one of these for > > > the test. I believe "core_4th_gen_avx" should map to "haswell". > > Hmm... this is unfortunate. I wonder if we add some 'translation' type > > field to the X86TargetParser.def entries? Any idea who the right one to > > populate said list would be? > > I believe the list of valid names for "tune-cpu" comes from ... > > I think it's here > https://github.com/llvm/llvm-project/blob/26cd258420c774254cc48330b1f4d23d353baf05/llvm/lib/Target/X86/X86.td#L1408 > > So back to Andy's problems, where we consume the cpu_specific names in > compiler previously, e.g., mapping to different targets? Or it is done by > external libraries like compiler-rt? > > I think I have the same requirments that mapping `-` and `_` for "tune-cpu" > in https://github.com/llvm/llvm-project/issues/50125 where the preprocessor > defines use `_` as well. > Unfortunately, I don't think it's this easy. The list of names used for > cpu_specific doesn't come from the same place as the list of names used by > "tune-cpu". For one thing, the cpu_specific names can't contain the '-' > character, so we have names like "skylake_avx512" in cpu_specific that would > need to be translated to "skylake-avx512" for "tune-cpu". I believe the list > of valid names for "tune-cpu" comes from here: > https://github.com/llvm/llvm-project/blob/26cd258420c774254cc48330b1f4d23d353baf05/llvm/lib/Support/X86TargetParser.cpp#L294 > > Also, some of the aliases supported by cpu_specific don't have any > corresponding "tune-cpu" name. You happen to have picked one of these for the > test. I believe "core_4th_gen_avx" should map to "haswell". Happens to find this patch. I recently also change here back to the initial version of this patch at https://reviews.llvm.org/D151696. To resolve the problem @andrew.w.kaylor mentioned here, I added these "unsupported" names in X86.td like Phoebe mentioned below. If you are interested, feel free to comment there. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121410/new/ https://reviews.llvm.org/D121410 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits