Skip to content

Commit ef5cee6

Browse files
tmatheson-armLukacma
authored andcommitted
[AArch64] set A14/M1 architecture version to v8.4-a (llvm#92600)
According to the Apple Silicon Optimization Guide, these are 8.4 with all features of 8.5 except BTI.
1 parent e7e77a3 commit ef5cee6

File tree

9 files changed

+24
-16
lines changed

9 files changed

+24
-16
lines changed

clang/lib/Basic/Targets/AArch64.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ void AArch64TargetInfo::getTargetDefinesARMV84A(const LangOptions &Opts,
286286
void AArch64TargetInfo::getTargetDefinesARMV85A(const LangOptions &Opts,
287287
MacroBuilder &Builder) const {
288288
Builder.defineMacro("__ARM_FEATURE_FRINT", "1");
289-
Builder.defineMacro("__ARM_FEATURE_BTI", "1");
290289
// Also include the Armv8.4 defines
291290
getTargetDefinesARMV84A(Opts, Builder);
292291
}
@@ -499,6 +498,9 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts,
499498
if (HasPAuthLR)
500499
Builder.defineMacro("__ARM_FEATURE_PAUTH_LR", "1");
501500

501+
if (HasBTI)
502+
Builder.defineMacro("__ARM_FEATURE_BTI", "1");
503+
502504
if (HasUnalignedAccess)
503505
Builder.defineMacro("__ARM_FEATURE_UNALIGNED", "1");
504506

clang/test/Driver/aarch64-mac-cpus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// RUN: %clang --target=arm64-apple-macos -mcpu=apple-m1 -### -c %s 2>&1 | FileCheck --check-prefix=EXPLICIT-M1 %s
1717

1818
// CHECK: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "apple-m1"
19-
// CHECK-SAME: "-target-feature" "+v8.5a"
19+
// CHECK-SAME: "-target-feature" "+v8.4a"
2020

2121
// EXPLICIT-A11: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "apple-a11"
2222
// EXPLICIT-A7: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "apple-a7"

clang/test/Preprocessor/aarch64-target-features.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@
335335
// CHECK-MCPU-CARMEL: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+v8.2a" "-target-feature" "+aes" "-target-feature" "+crc" "-target-feature" "+fp-armv8" "-target-feature" "+fullfp16" "-target-feature" "+lse" "-target-feature" "+ras" "-target-feature" "+rdm" "-target-feature" "+sha2" "-target-feature" "+neon"
336336

337337
// RUN: %clang -target x86_64-apple-macosx -arch arm64 -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH-ARM64 %s
338-
// CHECK-ARCH-ARM64: "-target-cpu" "apple-m1" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-feature" "+v8.5a" "-target-feature" "+aes" "-target-feature" "+crc" "-target-feature" "+dotprod" "-target-feature" "+complxnum" "-target-feature" "+fp-armv8" "-target-feature" "+fullfp16" "-target-feature" "+fp16fml" "-target-feature" "+jsconv" "-target-feature" "+lse" "-target-feature" "+pauth" "-target-feature" "+ras" "-target-feature" "+rcpc" "-target-feature" "+rdm" "-target-feature" "+sha2" "-target-feature" "+sha3" "-target-feature" "+neon"
338+
// CHECK-ARCH-ARM64: "-target-cpu" "apple-m1" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-feature" "+v8.4a" "-target-feature" "+aes" "-target-feature" "+crc" "-target-feature" "+dotprod" "-target-feature" "+complxnum" "-target-feature" "+fp-armv8" "-target-feature" "+fullfp16" "-target-feature" "+fp16fml" "-target-feature" "+jsconv" "-target-feature" "+lse" "-target-feature" "+pauth" "-target-feature" "+ras" "-target-feature" "+rcpc" "-target-feature" "+rdm" "-target-feature" "+sha2" "-target-feature" "+sha3" "-target-feature" "+neon"
339339

340340
// RUN: %clang -target x86_64-apple-macosx -arch arm64_32 -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH-ARM64_32 %s
341341
// CHECK-ARCH-ARM64_32: "-target-cpu" "apple-s4" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-feature" "+v8.3a" "-target-feature" "+aes" "-target-feature" "+crc" "-target-feature" "+complxnum" "-target-feature" "+fp-armv8" "-target-feature" "+fullfp16" "-target-feature" "+jsconv" "-target-feature" "+lse" "-target-feature" "+pauth" "-target-feature" "+ras" "-target-feature" "+rcpc" "-target-feature" "+rdm" "-target-feature" "+sha2" "-target-feature" "+neon"
@@ -671,10 +671,15 @@
671671
// CHECK-V83-OR-LATER: __ARM_FEATURE_JCVT 1
672672
// CHECK-V83-OR-LATER: __ARM_FEATURE_PAUTH 1
673673
// CHECK-V81-OR-LATER: __ARM_FEATURE_QRDMX 1
674+
// CHECK-BEFORE-V85-NOT: __ARM_FEATURE_BTI 1
674675
// CHECK-BEFORE-V83-NOT: __ARM_FEATURE_COMPLEX 1
675676
// CHECK-BEFORE-V83-NOT: __ARM_FEATURE_JCVT 1
676677
// CHECK-BEFORE-V85-NOT: __ARM_FEATURE_FRINT 1
677678

679+
// RUN: %clang -target aarch64 -mcpu=apple-a14 -x c -E -dM %s -o - | FileCheck --check-prefix=APPLE-A14-M1 %s
680+
// RUN: %clang -target aarch64 -mcpu=apple-m1 -x c -E -dM %s -o - | FileCheck --check-prefix=APPLE-A14-M1 %s
681+
// APPLE-A14-M1-NOT: __ARM_FEATURE_BTI 1
682+
678683
// RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-RCPC %s
679684
// CHECK-RCPC: __ARM_FEATURE_RCPC 1
680685

llvm/include/llvm/TargetParser/AArch64TargetParser.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ inline constexpr CpuInfo CpuInfos[] = {
438438
AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
439439
AArch64::AEK_SHA3, AArch64::AEK_FP16,
440440
AArch64::AEK_FP16FML})},
441-
{"apple-a14", ARMV8_5A,
441+
{"apple-a14", ARMV8_4A,
442442
AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
443443
AArch64::AEK_SHA3, AArch64::AEK_FP16,
444444
AArch64::AEK_FP16FML})},
@@ -455,7 +455,7 @@ inline constexpr CpuInfo CpuInfos[] = {
455455
AArch64::AEK_SHA3, AArch64::AEK_FP16,
456456
AArch64::AEK_FP16FML})},
457457

458-
{"apple-m1", ARMV8_5A,
458+
{"apple-m1", ARMV8_4A,
459459
AArch64::ExtensionBitset({AArch64::AEK_AES, AArch64::AEK_SHA2,
460460
AArch64::AEK_SHA3, AArch64::AEK_FP16,
461461
AArch64::AEK_FP16FML})},

llvm/lib/Target/AArch64/AArch64Processors.td

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,11 +741,12 @@ def ProcessorFeatures {
741741
FeatureNEON, FeaturePerfMon, FeatureFullFP16,
742742
FeatureFP16FML, FeatureSHA3];
743743
list<SubtargetFeature> AppleA14 = [HasV8_4aOps, FeatureCrypto, FeatureFPARMv8,
744-
FeatureNEON, FeaturePerfMon, FeatureFRInt3264,
745-
FeatureSpecRestrict, FeatureSSBS, FeatureSB,
746-
FeaturePredRes, FeatureCacheDeepPersist,
744+
FeatureNEON, FeaturePerfMon,
747745
FeatureFullFP16, FeatureFP16FML, FeatureSHA3,
748-
FeatureAltFPCmp];
746+
// ArmV8.5-a extensions, excluding BTI:
747+
FeatureAltFPCmp, FeatureFRInt3264,
748+
FeatureSpecRestrict, FeatureSSBS, FeatureSB,
749+
FeaturePredRes, FeatureCacheDeepPersist];
749750
list<SubtargetFeature> AppleA15 = [HasV8_6aOps, FeatureCrypto, FeatureFPARMv8,
750751
FeatureNEON, FeaturePerfMon, FeatureSHA3,
751752
FeatureFullFP16, FeatureFP16FML];

llvm/test/DebugInfo/debug_frame_symbol.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ entry:
2222
ret void, !dbg !12
2323
}
2424

25-
attributes #0 = { noinline nounwind optnone ssp "frame-pointer"="non-leaf" "no-builtins" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+sha3,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" }
25+
attributes #0 = { noinline nounwind optnone ssp "frame-pointer"="non-leaf" "no-builtins" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+sha3,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,+zcm,+zcz" }
2626

2727
!llvm.dbg.cu = !{!0}
2828
!llvm.module.flags = !{!2, !3, !4, !5, !6}

llvm/test/Instrumentation/AddressSanitizer/calls-only-smallfn.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ entry:
2424
store i8 2, ptr %arrayidx1, align 1
2525
ret void
2626
}
27-
attributes #0 = { noinline nounwind optnone sanitize_address ssp uwtable(sync) "frame-pointer"="non-leaf" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+crc,+crypto,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" }
27+
attributes #0 = { noinline nounwind optnone sanitize_address ssp uwtable(sync) "frame-pointer"="non-leaf" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+crc,+crypto,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,+zcm,+zcz" }
2828

llvm/test/Instrumentation/AddressSanitizer/calls-only.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ entry:
5151
; CHECK-NOT: store i64 -723401728380766731, ptr %126, align 1
5252
ret void
5353
}
54-
attributes #0 = { noinline nounwind optnone sanitize_address ssp uwtable(sync) "frame-pointer"="non-leaf" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+crc,+crypto,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+zcm,+zcz" }
54+
attributes #0 = { noinline nounwind optnone sanitize_address ssp uwtable(sync) "frame-pointer"="non-leaf" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+crc,+crypto,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+lse,+neon,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,+zcm,+zcz" }
5555

llvm/unittests/TargetParser/TargetParserTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,15 +1536,15 @@ INSTANTIATE_TEST_SUITE_P(
15361536
AArch64::AEK_FCMA, AArch64::AEK_PAUTH}),
15371537
"8.4-A"),
15381538
ARMCPUTestParams<AArch64::ExtensionBitset>(
1539-
"apple-a14", "armv8.5-a", "crypto-neon-fp-armv8",
1539+
"apple-a14", "armv8.4-a", "crypto-neon-fp-armv8",
15401540
AArch64::ExtensionBitset(
15411541
{AArch64::AEK_CRC, AArch64::AEK_AES, AArch64::AEK_SHA2,
15421542
AArch64::AEK_SHA3, AArch64::AEK_FP, AArch64::AEK_SIMD,
15431543
AArch64::AEK_LSE, AArch64::AEK_RAS, AArch64::AEK_RDM,
15441544
AArch64::AEK_RCPC, AArch64::AEK_DOTPROD, AArch64::AEK_FP16,
15451545
AArch64::AEK_FP16FML, AArch64::AEK_SHA3, AArch64::AEK_JSCVT,
15461546
AArch64::AEK_FCMA, AArch64::AEK_PAUTH}),
1547-
"8.5-A"),
1547+
"8.4-A"),
15481548
ARMCPUTestParams<AArch64::ExtensionBitset>(
15491549
"apple-a15", "armv8.6-a", "crypto-neon-fp-armv8",
15501550
AArch64::ExtensionBitset(
@@ -1579,15 +1579,15 @@ INSTANTIATE_TEST_SUITE_P(
15791579
AArch64::AEK_PAUTH}),
15801580
"8.6-A"),
15811581
ARMCPUTestParams<AArch64::ExtensionBitset>(
1582-
"apple-m1", "armv8.5-a", "crypto-neon-fp-armv8",
1582+
"apple-m1", "armv8.4-a", "crypto-neon-fp-armv8",
15831583
AArch64::ExtensionBitset(
15841584
{AArch64::AEK_CRC, AArch64::AEK_AES, AArch64::AEK_SHA2,
15851585
AArch64::AEK_SHA3, AArch64::AEK_FP, AArch64::AEK_SIMD,
15861586
AArch64::AEK_LSE, AArch64::AEK_RAS, AArch64::AEK_RDM,
15871587
AArch64::AEK_RCPC, AArch64::AEK_DOTPROD, AArch64::AEK_FP16,
15881588
AArch64::AEK_FP16FML, AArch64::AEK_SHA3, AArch64::AEK_JSCVT,
15891589
AArch64::AEK_FCMA, AArch64::AEK_PAUTH}),
1590-
"8.5-A"),
1590+
"8.4-A"),
15911591
ARMCPUTestParams<AArch64::ExtensionBitset>(
15921592
"apple-m2", "armv8.6-a", "crypto-neon-fp-armv8",
15931593
AArch64::ExtensionBitset(

0 commit comments

Comments
 (0)