[AArch64] Add support for -march=native for Apple M1 CPU
authorKeith Smiley <keithbsmiley@gmail.com>
Mon, 14 Feb 2022 19:27:43 +0000 (11:27 -0800)
committerKeith Smiley <keithbsmiley@gmail.com>
Wed, 23 Mar 2022 21:06:59 +0000 (14:06 -0700)
commitfcca10c69aaab539962d10fcc59a5f074b73b0de
tree0ca83f32c4a3c8f5a792f448b14ecdeec82272a1
parent460fc440ad8d41ca2e3882987512989b1c188fbe
[AArch64] Add support for -march=native for Apple M1 CPU

This improves the getHostCPUName check for Apple M1 CPUs, which
previously would always be considered cyclone instead. This also enables
`-march=native` support when building on M1 CPUs which would previously
fail. This isn't as sophisticated as the X86 CPU feature checking which
consults the CPU via getHostCPUFeatures, but this is still better than
before. This CPU selection could also be invalid if this was run on an
iOS device instead, ideally we can improve those cases as they come up.

Differential Revision: https://reviews.llvm.org/D119788
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
llvm/lib/Support/Host.cpp