[clang] [llvm] [llvm][AArch64] Support -mcpu=apple-m4 (PR #95478)

Tomas Matheson via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 14 02:06:49 PDT 2024


================
@@ -521,7 +521,14 @@ inline constexpr CpuInfo CpuInfos[] = {
      AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
                                AArch64::AEK_SHA3, AArch64::AEK_FP16,
                                AArch64::AEK_FP16FML})},
-
+    // Technically apple-m4 is ARMv9.2a, but a quirk of LLVM defines v9.0 as
+    // requiring SVE, which is optional according to the Arm ARM and not
+    // supported by the core. ARMv8.7a is the next closest choice.
----------------
tmatheson-arm wrote:

>From the Arm ARM: 
> FEAT_SVE2 is OPTIONAL from Armv9.0.

In LLVM, SVE2 is an `Implied` (read: mandatory) feature of 9.0-a (wrong), and SVE and SVE2 are both on by default for the architecture:
```
def HasV9_0aOps : Architecture64<9, 0, "a", "v9a",
  [HasV8_5aOps, FeatureMEC, FeatureSVE2],
  !listconcat(HasV8_5aOps.DefaultExts, [FeatureFullFP16, FeatureSVE,
    FeatureSVE2])>;
```

It should be possible to remove SVE2 from the `Implied` list while keeping it in the list of default extensions, which would avoid any user-facing changes.

I'm not sure why FEAT_MEC is enabled there either.
> FEAT_MEC is OPTIONAL from Armv9.2.


https://github.com/llvm/llvm-project/pull/95478


More information about the cfe-commits mailing list