-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[llvm][AArch64] Support -mcpu=apple-m4 #95478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -398,6 +398,22 @@ def TuneAppleA17 : SubtargetFeature<"apple-a17", "ARMProcFamily", "AppleA17", | |
FeatureZCRegMove, | ||
FeatureZCZeroing]>; | ||
|
||
def TuneAppleM4 : SubtargetFeature<"apple-m4", "ARMProcFamily", "AppleM4", | ||
"Apple M4", [ | ||
FeatureAlternateSExtLoadCVTF32Pattern, | ||
FeatureArithmeticBccFusion, | ||
FeatureArithmeticCbzFusion, | ||
FeatureDisableLatencySchedHeuristic, | ||
FeatureFuseAddress, | ||
FeatureFuseAES, | ||
FeatureFuseArithmeticLogic, | ||
FeatureFuseCCSelect, | ||
FeatureFuseCryptoEOR, | ||
FeatureFuseLiterals, | ||
FeatureZCRegMove, | ||
FeatureZCZeroing | ||
]>; | ||
|
||
def TuneExynosM3 : SubtargetFeature<"exynosm3", "ARMProcFamily", "ExynosM3", | ||
"Samsung Exynos-M3 processors", | ||
[FeatureExynosCheapAsMoveHandling, | ||
|
@@ -784,6 +800,14 @@ def ProcessorFeatures { | |
FeatureNEON, FeaturePerfMon, FeatureSHA3, | ||
FeatureFullFP16, FeatureFP16FML, | ||
FeatureHCX]; | ||
// Technically apple-m4 is ARMv9.2. See the corresponding comment in | ||
// AArch64TargetParser.h. | ||
list<SubtargetFeature> AppleM4 = [HasV8_7aOps, FeatureCrypto, FeatureFPARMv8, | ||
FeatureNEON, FeaturePerfMon, FeatureSHA3, | ||
FeatureFullFP16, FeatureFP16FML, | ||
FeatureAES, FeatureBF16, | ||
FeatureSME2, | ||
FeatureSMEF64F64, FeatureSMEI16I64]; | ||
list<SubtargetFeature> ExynosM3 = [HasV8_0aOps, FeatureCRC, FeatureCrypto, | ||
FeaturePerfMon]; | ||
list<SubtargetFeature> ExynosM4 = [HasV8_2aOps, FeatureCrypto, FeatureDotProd, | ||
|
@@ -1010,6 +1034,9 @@ def : ProcessorModel<"apple-a16", CycloneModel, ProcessorFeatures.AppleA16, | |
[TuneAppleA16]>; | ||
def : ProcessorModel<"apple-a17", CycloneModel, ProcessorFeatures.AppleA17, | ||
[TuneAppleA17]>; | ||
def : ProcessorModel<"apple-m4", CycloneModel, ProcessorFeatures.AppleM4, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this go below, under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it is an iPad CPU: https://www.apple.com/newsroom/2024/05/apple-introduces-m4-chip/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably rearrange them to remove that distinction though, so that aliases that share the same There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, right - sorry I forgot about that distinction. (I guess it'll end up in macs at some point too, and I know you can't comment on that - so until then this is indeed the right sorting.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
[TuneAppleM4]>; | ||
|
||
// Mac CPUs | ||
def : ProcessorModel<"apple-m1", CycloneModel, ProcessorFeatures.AppleA14, | ||
[TuneAppleA14]>; | ||
|
@@ -1025,8 +1052,8 @@ def : ProcessorModel<"apple-s5", CycloneModel, ProcessorFeatures.AppleA12, | |
[TuneAppleA12]>; | ||
|
||
// Alias for the latest Apple processor model supported by LLVM. | ||
def : ProcessorModel<"apple-latest", CycloneModel, ProcessorFeatures.AppleA16, | ||
[TuneAppleA16]>; | ||
def : ProcessorModel<"apple-latest", CycloneModel, ProcessorFeatures.AppleM4, | ||
[TuneAppleM4]>; | ||
|
||
// Fujitsu A64FX | ||
def : ProcessorModel<"a64fx", A64FXModel, ProcessorFeatures.A64FX, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the Arm ARM:
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: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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that as a separate change after this one. That order will ensure this is still correct (as it can be) even after the revert, without the author of the revert having to think about this.