[PATCH] D119788: [AArch64] Add support for -march=native for Apple M1 CPU

Tim Northover via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 15 01:51:00 PST 2022


t.p.northover added a comment.

Things have moved on since the ARM and (especially) PPC variants of that function were written. That field (despite the name) is now more of an ABI tag and not going to be updated with each CPU.

I think the modern replacement for it is `hw.cpufamily` obtained from `sysctl` (command line or `man 3 sysctl` for programmatically). The potential values (`CPUFAMILY_ARM_*` starting with Cyclone) are listed in  https://opensource.apple.com/source/xnu/xnu-4570.41.2/osfmk/mach/machine.h.auto.html (which should be in the SDK under `mach/machine.h`). It warns against inferring features from this, which is exactly what we'd be doing, but still probably has a better chance of being right long term.

I'd probably default to the latest known one rather than earliest too, since an unknown family is more likely to be new than old.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119788



More information about the cfe-commits mailing list