Apple M2 Support Added To Upstream LLVM Along With The A15, A16
Apple compiler engineer Tim Northover has contributed the Apple M2 / A15 / A16 CPU targets to the upstream code-base for LLVM/Clang. He commented in the commit:
They're roughly ARMv8.6. This works in the .td file, but in AArch64TargetParser.def, marking them v8.6 brings in support for the SM4 cryptographic hash and we don't actually have that. So TargetParser side they're marked as v8.5, with the extra features (BF16 and I8MM added manually).
Finally, A16 supports the HCX extension in addition to v8.6. This has no TargetParser implications.
Now with the new "apple-a15", "apple-a16", and "apple-m2" targets it's much easier targeting the capabilities of these respective CPU cores if aiming for optimal instruction targeting.
More details within this commit for those interested. This addition was made to LLVM Git for the LLVM/Clang 16.0 release that will debut as stable around next March.