Skip to content

Commit eba1ef5

Browse files
ahmedbougachatru
authored andcommitted
[AArch64] Make apple-m4 armv8.7-a again (from armv9.2-a). (#106312)
This is a partial revert of c66e1d6. Even though that allowed us to declare v9.2-a support without picking up SVE2 in both the backend and the driver, the frontend itself still enabled SVE via the arch version's default extensions. Avoid that by reverting back to v8.7-a while we look into longer-term solutions. (cherry picked from commit e5e38dd)
1 parent 1b643db commit eba1ef5

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Diff for: clang/test/CodeGen/aarch64-targetattr.c

+9
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ __attribute__((target("no-v9.3a")))
191191
//
192192
void minusarch() {}
193193

194+
__attribute__((target("cpu=apple-m4")))
195+
// CHECK-LABEL: define {{[^@]+}}@applem4
196+
// CHECK-SAME: () #[[ATTR18:[0-9]+]] {
197+
// CHECK-NEXT: entry:
198+
// CHECK-NEXT: ret void
199+
//
200+
void applem4() {}
201+
194202
//.
195203
// CHECK: attributes #[[ATTR0]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+fp-armv8,+lse,+neon,+ras,+rdm,+v8.1a,+v8.2a,+v8a" }
196204
// CHECK: attributes #[[ATTR1]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rdm,+sve,+v8.1a,+v8.2a,+v8a" }
@@ -210,6 +218,7 @@ void minusarch() {}
210218
// CHECK: attributes #[[ATTR15]] = { noinline nounwind optnone "branch-target-enforcement" "guarded-control-stack" "no-trapping-math"="true" "sign-return-address"="non-leaf" "sign-return-address-key"="a_key" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-n1" "target-features"="+aes,+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a" "tune-cpu"="cortex-a710" }
211219
// CHECK: attributes #[[ATTR16]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
212220
// CHECK: attributes #[[ATTR17]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="-v9.3a" }
221+
// CHECK: attributes #[[ATTR18]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m4" "target-features"="+aes,+bf16,+bti,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+sme,+sme-f64f64,+sme-i16i64,+sme2,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8.7a,+v8a,+wfxt" }
213222
//.
214223
// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
215224
// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"}

Diff for: llvm/lib/Target/AArch64/AArch64Processors.td

+6-1
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,12 @@ def ProcessorFeatures {
895895
FeatureLSE, FeaturePAuth,
896896
FeatureRAS, FeatureRCPC, FeatureRDM,
897897
FeatureBF16, FeatureDotProd, FeatureMatMulInt8, FeatureSSBS];
898-
list<SubtargetFeature> AppleM4 = [HasV9_2aOps, FeatureSHA2, FeatureFPARMv8,
898+
// Technically apple-m4 is v9.2a, but we can't use that here.
899+
// Historically, llvm defined v9.0a as requiring SVE, but it's optional
900+
// according to the Arm ARM, and not supported by the core. We decoupled the
901+
// two in the clang driver and in the backend subtarget features, but it's
902+
// still an issue in the clang frontend. v8.7a is the next closest choice.
903+
list<SubtargetFeature> AppleM4 = [HasV8_7aOps, FeatureSHA2, FeatureFPARMv8,
899904
FeatureNEON, FeaturePerfMon, FeatureSHA3,
900905
FeatureFullFP16, FeatureFP16FML,
901906
FeatureAES, FeatureBF16,

Diff for: llvm/unittests/TargetParser/TargetParserTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ INSTANTIATE_TEST_SUITE_P(
16381638
AArch64::AEK_I8MM, AArch64::AEK_JSCVT, AArch64::AEK_FCMA,
16391639
AArch64::AEK_PAUTH, AArch64::AEK_PERFMON, AArch64::AEK_HCX,
16401640
AArch64::AEK_SSBS}),
1641-
AArch64CPUTestParams("apple-m4", "armv9.2-a",
1641+
AArch64CPUTestParams("apple-m4", "armv8.7-a",
16421642
{AArch64::AEK_CRC, AArch64::AEK_AES,
16431643
AArch64::AEK_SHA2, AArch64::AEK_SHA3,
16441644
AArch64::AEK_FP, AArch64::AEK_SIMD,

0 commit comments

Comments
 (0)