Skip to content

Commit 954db63

Browse files
committed
[ARM] Add Cortex-A78 and Cortex-X1 Support for Clang and LLVM
This patch upstreams support for the Arm-v8 Cortex-A78 and Cortex-X1 processors for AArch64 and ARM. In detail: - Adding cortex-a78 and cortex-x1 as cpu options for aarch64 and arm targets in clang - Adding Cortex-A78 and Cortex-X1 CPU names and ProcessorModels in llvm details of the CPU can be found here: https://www.arm.com/products/cortex-x https://www.arm.com/products/silicon-ip-cpu/cortex-a/cortex-a78 The following people contributed to this patch: - Luke Geeson - Mikhail Maltsev Reviewers: t.p.northover, dmgreen Reviewed By: dmgreen Subscribers: dmgreen, kristof.beyls, hiraditya, danielkiss, cfe-commits, llvm-commits, miyuki Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D83206
1 parent b887da8 commit 954db63

File tree

18 files changed

+136
-2
lines changed

18 files changed

+136
-2
lines changed

clang/test/Driver/aarch64-cpus.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@
173173

174174
// RUN: %clang -target aarch64 -mcpu=cortex-a77 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A77 %s
175175
// CORTEX-A77: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a77"
176+
// RUN: %clang -target aarch64 -mcpu=cortex-x1 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEXX1 %s
177+
// CORTEXX1: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-x1"
178+
// RUN: %clang -target aarch64 -mcpu=cortex-a78 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEXA78 %s
179+
// CORTEXA78: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a78"
176180

177181
// RUN: %clang -target aarch64_be -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3 %s
178182
// RUN: %clang -target aarch64 -mbig-endian -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3 %s

clang/test/Driver/arm-cortex-cpus.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,18 @@
840840
// CHECK-CORTEX-A76AE-SOFT: "-target-feature" "+soft-float"
841841
// CHECK-CORTEX-A76AE-SOFT: "-target-feature" "+soft-float-abi"
842842

843+
// RUN: %clang -target armv8a-arm-none-eabi -mcpu=cortex-x1 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-X1 %s
844+
// RUN: %clang -target armv8a-arm-none-eabi -mcpu=cortex-x1 -mfpu=crypto-neon-fp-armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-X1-MFPU %s
845+
// CHECK-CORTEX-X1: "-cc1"{{.*}} "-triple" "armv8.2a-{{.*}} "-target-cpu" "cortex-x1"
846+
// CHECK-CORTEX-X1-MFPU: "-cc1"{{.*}} "-target-feature" "+fp-armv8"
847+
// CHECK-CORTEX-X1-MFPU: "-target-feature" "+crypto"
848+
849+
// RUN: %clang -target armv8a-arm-none-eabi -mcpu=cortex-a78 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A78 %s
850+
// RUN: %clang -target armv8a-arm-none-eabi -mcpu=cortex-a78 -mfpu=crypto-neon-fp-armv8 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CORTEX-A78-MFPU %s
851+
// CHECK-CORTEX-A78: "-cc1"{{.*}} "-triple" "armv8.2a-{{.*}} "-target-cpu" "cortex-a78"
852+
// CHECK-CORTEX-A78-MFPU: "-cc1"{{.*}} "-target-feature" "+fp-armv8"
853+
// CHECK-CORTEX-A78-MFPU: "-target-feature" "+crypto"
854+
843855
// RUN: %clang -target arm -mcpu=cortex-m23 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8MBASE %s
844856
// CHECK-CPUV8MBASE: "-cc1"{{.*}} "-triple" "thumbv8m.base-
845857

llvm/include/llvm/Support/AArch64TargetParser.def

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ AARCH64_CPU_NAME("cortex-a76ae", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
127127
AARCH64_CPU_NAME("cortex-a77", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
128128
(AArch64::AEK_FP16 | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD |
129129
AArch64::AEK_SSBS))
130+
AARCH64_CPU_NAME("cortex-a78", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
131+
(AArch64::AEK_FP16 | AArch64::AEK_DOTPROD | AArch64::AEK_RCPC |
132+
AArch64::AEK_SSBS))
133+
AARCH64_CPU_NAME("cortex-x1", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
134+
(AArch64::AEK_FP16 | AArch64::AEK_DOTPROD | AArch64::AEK_RCPC |
135+
AArch64::AEK_SSBS))
130136
AARCH64_CPU_NAME("neoverse-e1", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
131137
(AArch64::AEK_DOTPROD | AArch64::AEK_FP16 | AArch64::AEK_RAS |
132138
AArch64::AEK_RCPC | AArch64::AEK_SSBS))

llvm/include/llvm/Support/ARMTargetParser.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ ARM_CPU_NAME("cortex-a76ae", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
294294
(ARM::AEK_FP16 | ARM::AEK_DOTPROD))
295295
ARM_CPU_NAME("cortex-a77", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
296296
(ARM::AEK_FP16 | ARM::AEK_DOTPROD))
297+
ARM_CPU_NAME("cortex-a78",ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
298+
(ARM::AEK_FP16 | ARM::AEK_DOTPROD))
299+
ARM_CPU_NAME("cortex-x1", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
300+
(ARM::AEK_FP16 | ARM::AEK_DOTPROD))
297301
ARM_CPU_NAME("neoverse-n1", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
298302
(ARM::AEK_FP16 | ARM::AEK_DOTPROD))
299303
ARM_CPU_NAME("cyclone", ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false, ARM::AEK_CRC)

llvm/lib/Support/Host.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ StringRef sys::detail::getHostCPUNameForARM(StringRef ProcCpuinfoContent) {
205205
.Case("0xd0a", "cortex-a75")
206206
.Case("0xd0b", "cortex-a76")
207207
.Case("0xd0d", "cortex-a77")
208+
.Case("0xd41", "cortex-a78")
209+
.Case("0xd44", "cortex-x1")
208210
.Case("0xd0c", "neoverse-n1")
209211
.Default("generic");
210212
}

llvm/lib/Target/AArch64/AArch64.td

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,36 @@ def ProcA77 : SubtargetFeature<"a77", "ARMProcFamily", "CortexA77",
636636
FeatureDotProd
637637
]>;
638638

639+
def ProcA78 : SubtargetFeature<"cortex-a78", "ARMProcFamily",
640+
"CortexA78",
641+
"Cortex-A78 ARM processors", [
642+
HasV8_2aOps,
643+
FeatureCrypto,
644+
FeatureFPARMv8,
645+
FeatureFuseAES,
646+
FeatureNEON,
647+
FeatureRCPC,
648+
FeaturePerfMon,
649+
FeaturePostRAScheduler,
650+
FeatureSPE,
651+
FeatureFullFP16,
652+
FeatureSSBS,
653+
FeatureDotProd]>;
654+
655+
def ProcX1 : SubtargetFeature<"cortex-x1", "ARMProcFamily", "CortexX1",
656+
"Cortex-X1 ARM processors", [
657+
HasV8_2aOps,
658+
FeatureCrypto,
659+
FeatureFPARMv8,
660+
FeatureFuseAES,
661+
FeatureNEON,
662+
FeatureRCPC,
663+
FeaturePerfMon,
664+
FeaturePostRAScheduler,
665+
FeatureSPE,
666+
FeatureFullFP16,
667+
FeatureDotProd]>;
668+
639669
def ProcA64FX : SubtargetFeature<"a64fx", "ARMProcFamily", "A64FX",
640670
"Fujitsu A64FX processors", [
641671
HasV8_2aOps,
@@ -978,6 +1008,8 @@ def : ProcessorModel<"cortex-a75", CortexA57Model, [ProcA75]>;
9781008
def : ProcessorModel<"cortex-a76", CortexA57Model, [ProcA76]>;
9791009
def : ProcessorModel<"cortex-a76ae", CortexA57Model, [ProcA76]>;
9801010
def : ProcessorModel<"cortex-a77", CortexA57Model, [ProcA77]>;
1011+
def : ProcessorModel<"cortex-a78", CortexA57Model, [ProcA78]>;
1012+
def : ProcessorModel<"cortex-x1", CortexA57Model, [ProcX1]>;
9811013
def : ProcessorModel<"neoverse-e1", CortexA53Model, [ProcNeoverseE1]>;
9821014
def : ProcessorModel<"neoverse-n1", CortexA57Model, [ProcNeoverseN1]>;
9831015
def : ProcessorModel<"exynos-m3", ExynosM3Model, [ProcExynosM3]>;

llvm/lib/Target/AArch64/AArch64Subtarget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ void AArch64Subtarget::initializeProperties() {
102102
case CortexA75:
103103
case CortexA76:
104104
case CortexA77:
105+
case CortexA78:
106+
case CortexX1:
105107
PrefFunctionLogAlignment = 4;
106108
break;
107109
case A64FX:

llvm/lib/Target/AArch64/AArch64Subtarget.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
5656
CortexA75,
5757
CortexA76,
5858
CortexA77,
59+
CortexA78,
60+
CortexX1,
5961
ExynosM3,
6062
Falkor,
6163
Kryo,

llvm/lib/Target/ARM/ARM.td

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,10 @@ def ProcA76 : SubtargetFeature<"a76", "ARMProcFamily", "CortexA76",
596596
"Cortex-A76 ARM processors", []>;
597597
def ProcA77 : SubtargetFeature<"a77", "ARMProcFamily", "CortexA77",
598598
"Cortex-A77 ARM processors", []>;
599+
def ProcA78 : SubtargetFeature<"cortex-a78", "ARMProcFamily", "CortexA78",
600+
"Cortex-A78 ARM processors", []>;
601+
def ProcX1 : SubtargetFeature<"cortex-x1", "ARMProcFamily", "CortexX1",
602+
"Cortex-X1 ARM processors", []>;
599603

600604
def ProcKrait : SubtargetFeature<"krait", "ARMProcFamily", "Krait",
601605
"Qualcomm Krait processors", []>;
@@ -1234,6 +1238,22 @@ def : ProcNoItin<"cortex-a77", [ARMv82a, ProcA77,
12341238
FeatureFullFP16,
12351239
FeatureDotProd]>;
12361240

1241+
def : ProcNoItin<"cortex-a78", [ARMv82a, ProcA78,
1242+
FeatureHWDivThumb,
1243+
FeatureHWDivARM,
1244+
FeatureCrypto,
1245+
FeatureCRC,
1246+
FeatureFullFP16,
1247+
FeatureDotProd]>;
1248+
1249+
def : ProcNoItin<"cortex-x1", [ARMv82a, ProcX1,
1250+
FeatureHWDivThumb,
1251+
FeatureHWDivARM,
1252+
FeatureCrypto,
1253+
FeatureCRC,
1254+
FeatureFullFP16,
1255+
FeatureDotProd]>;
1256+
12371257
def : ProcNoItin<"neoverse-n1", [ARMv82a,
12381258
FeatureHWDivThumb,
12391259
FeatureHWDivARM,

llvm/lib/Target/ARM/ARMSubtarget.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,14 @@ void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
293293
case CortexA75:
294294
case CortexA76:
295295
case CortexA77:
296+
case CortexA78:
296297
case CortexR4:
297298
case CortexR4F:
298299
case CortexR5:
299300
case CortexR7:
300301
case CortexM3:
301302
case CortexR52:
303+
case CortexX1:
302304
break;
303305
case Exynos:
304306
LdStMultipleTiming = SingleIssuePlusExtras;

0 commit comments

Comments
 (0)