forked from OSchip/llvm-project
[AArch64] Add CPU Cortex-R82
This adds support for -mcpu=cortex-r82. Some more information about this core can be found here: https://www.arm.com/products/silicon-ip-cpu/cortex-r/cortex-r82 One note about the system register: that is a bit of a refactoring because of small differences between v8.4-A AArch64 and v8-R AArch64. This is based on patches from Mark Murray and Mikhail Maltsev. Differential Revision: https://reviews.llvm.org/D88660
This commit is contained in:
parent
57ac47d788
commit
8825fec37e
|
@ -481,6 +481,8 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
|
|||
ArchKind = llvm::AArch64::ArchKind::ARMV8_5A;
|
||||
if (Feature == "+v8.6a")
|
||||
ArchKind = llvm::AArch64::ArchKind::ARMV8_6A;
|
||||
if (Feature == "+v8r")
|
||||
ArchKind = llvm::AArch64::ArchKind::ARMV8R;
|
||||
if (Feature == "+fullfp16")
|
||||
HasFullFP16 = true;
|
||||
if (Feature == "+dotprod")
|
||||
|
|
|
@ -306,7 +306,8 @@ fp16_fml_fallthrough:
|
|||
NoCrypto = true;
|
||||
}
|
||||
|
||||
if (std::find(ItBegin, ItEnd, "+v8.4a") != ItEnd) {
|
||||
if (std::find(ItBegin, ItEnd, "+v8.4a") != ItEnd ||
|
||||
std::find(ItBegin, ItEnd, "+v8r") != ItEnd) {
|
||||
if (HasCrypto && !NoCrypto) {
|
||||
// Check if we have NOT disabled an algorithm with something like:
|
||||
// +crypto, -algorithm
|
||||
|
|
|
@ -178,6 +178,9 @@
|
|||
// RUN: %clang -target aarch64 -mcpu=cortex-a78 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEXA78 %s
|
||||
// CORTEXA78: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a78"
|
||||
|
||||
// RUN: %clang -target aarch64 -mcpu=cortex-r82 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEXR82 %s
|
||||
// CORTEXR82: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-r82"
|
||||
|
||||
// RUN: %clang -target aarch64_be -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3 %s
|
||||
// RUN: %clang -target aarch64 -mbig-endian -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3 %s
|
||||
// RUN: %clang -target aarch64_be -mbig-endian -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3 %s
|
||||
|
|
|
@ -9,4 +9,5 @@
|
|||
// RUN: %clang -### -target aarch64 -mcpu=cortex-a75 %s 2>&1 | FileCheck %s
|
||||
// RUN: %clang -### -target aarch64 -mcpu=cortex-a76 %s 2>&1 | FileCheck %s
|
||||
// RUN: %clang -### -target aarch64 -mcpu=cortex-a55 %s 2>&1 | FileCheck %s
|
||||
// RUN: %clang -### -target aarch64 -mcpu=cortex-r82 %s 2>&1 | FileCheck %s
|
||||
// CHECK: "+dotprod"
|
||||
|
|
|
@ -219,6 +219,7 @@
|
|||
// RUN: %clang -target aarch64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-A57 %s
|
||||
// RUN: %clang -target aarch64 -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-A72 %s
|
||||
// RUN: %clang -target aarch64 -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-CORTEX-A73 %s
|
||||
// RUN: %clang -target aarch64 -mcpu=cortex-r82 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-CORTEX-R82 %s
|
||||
// RUN: %clang -target aarch64 -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-M1 %s
|
||||
// RUN: %clang -target aarch64 -mcpu=exynos-m4 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-M4 %s
|
||||
// RUN: %clang -target aarch64 -mcpu=exynos-m5 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MCPU-M4 %s
|
||||
|
@ -237,6 +238,7 @@
|
|||
// CHECK-MCPU-A57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
|
||||
// CHECK-MCPU-A72: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
|
||||
// CHECK-MCPU-CORTEX-A73: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
|
||||
// CHECK-MCPU-CORTEX-R82: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+v8r" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" "+dotprod" "-target-feature" "+fp16fml" "-target-feature" "+ras" "-target-feature" "+rdm" "-target-feature" "+rcpc" "-target-feature" "+fullfp16" "-target-feature" "+sm4" "-target-feature" "+sha3" "-target-feature" "+sha2" "-target-feature" "+aes"
|
||||
// CHECK-MCPU-M1: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
|
||||
// CHECK-MCPU-M4: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" "+dotprod" "-target-feature" "+fullfp16"
|
||||
// CHECK-MCPU-KRYO: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto"
|
||||
|
|
|
@ -51,6 +51,14 @@ AARCH64_ARCH("armv8.6-a", ARMV8_6A, "8.6-A", "v8.6a",
|
|||
AArch64::AEK_RDM | AArch64::AEK_RCPC | AArch64::AEK_DOTPROD |
|
||||
AArch64::AEK_SM4 | AArch64::AEK_SHA3 | AArch64::AEK_BF16 |
|
||||
AArch64::AEK_SHA2 | AArch64::AEK_AES | AArch64::AEK_I8MM))
|
||||
AARCH64_ARCH("armv8-r", ARMV8R, "8-R", "v8r",
|
||||
ARMBuildAttrs::CPUArch::v8_R, FK_CRYPTO_NEON_FP_ARMV8,
|
||||
(AArch64::AEK_CRC | AArch64::AEK_RDM | AArch64::AEK_SSBS |
|
||||
AArch64::AEK_CRYPTO | AArch64::AEK_SM4 | AArch64::AEK_SHA3 |
|
||||
AArch64::AEK_SHA2 | AArch64::AEK_AES | AArch64::AEK_DOTPROD |
|
||||
AArch64::AEK_FP | AArch64::AEK_SIMD | AArch64::AEK_FP16 |
|
||||
AArch64::AEK_FP16FML | AArch64::AEK_RAS | AArch64::AEK_RCPC |
|
||||
AArch64::AEK_SB))
|
||||
#undef AARCH64_ARCH
|
||||
|
||||
#ifndef AARCH64_ARCH_EXT_NAME
|
||||
|
@ -130,6 +138,8 @@ AARCH64_CPU_NAME("cortex-a77", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
|
|||
AARCH64_CPU_NAME("cortex-a78", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
|
||||
(AArch64::AEK_FP16 | AArch64::AEK_DOTPROD | AArch64::AEK_RCPC |
|
||||
AArch64::AEK_SSBS))
|
||||
AARCH64_CPU_NAME("cortex-r82", ARMV8R, FK_CRYPTO_NEON_FP_ARMV8, false,
|
||||
(AArch64::AEK_NONE))
|
||||
AARCH64_CPU_NAME("cortex-x1", ARMV8_2A, FK_CRYPTO_NEON_FP_ARMV8, false,
|
||||
(AArch64::AEK_FP16 | AArch64::AEK_DOTPROD | AArch64::AEK_RCPC |
|
||||
AArch64::AEK_SSBS))
|
||||
|
|
|
@ -118,6 +118,8 @@ bool AArch64::getArchFeatures(AArch64::ArchKind AK,
|
|||
Features.push_back("+v8.5a");
|
||||
if (AK == AArch64::ArchKind::ARMV8_6A)
|
||||
Features.push_back("+v8.6a");
|
||||
if(AK == AArch64::ArchKind::ARMV8R)
|
||||
Features.push_back("+v8r");
|
||||
|
||||
return AK != ArchKind::INVALID;
|
||||
}
|
||||
|
|
|
@ -72,9 +72,11 @@ def FeatureLOR : SubtargetFeature<
|
|||
"lor", "HasLOR", "true",
|
||||
"Enables ARM v8.1 Limited Ordering Regions extension">;
|
||||
|
||||
def FeatureVH : SubtargetFeature<
|
||||
"vh", "HasVH", "true",
|
||||
"Enables ARM v8.1 Virtual Host extension">;
|
||||
def FeatureCONTEXTIDREL2 : SubtargetFeature<"CONTEXTIDREL2", "HasCONTEXTIDREL2",
|
||||
"true", "Enable RW operand CONTEXTIDR_EL2" >;
|
||||
|
||||
def FeatureVH : SubtargetFeature<"vh", "HasVH", "true",
|
||||
"Enables ARM v8.1 Virtual Host extension", [FeatureCONTEXTIDREL2] >;
|
||||
|
||||
def FeaturePerfMon : SubtargetFeature<"perfmon", "HasPerfMon", "true",
|
||||
"Enable ARMv8 PMUv3 Performance Monitors extension">;
|
||||
|
@ -441,6 +443,22 @@ def HasV8_6aOps : SubtargetFeature<
|
|||
[HasV8_5aOps, FeatureAMVS, FeatureBF16, FeatureFineGrainedTraps,
|
||||
FeatureEnhancedCounterVirtualization, FeatureMatMulInt8]>;
|
||||
|
||||
def HasV8_0rOps : SubtargetFeature<
|
||||
"v8r", "HasV8_0rOps", "true", "Support ARM v8r instructions",
|
||||
[//v8.1
|
||||
FeatureCRC, FeaturePAN, FeatureRDM, FeatureLSE, FeatureCONTEXTIDREL2,
|
||||
//v8.2
|
||||
FeaturePerfMon, FeatureRAS, FeaturePsUAO, FeatureSM4,
|
||||
FeatureSHA3, FeatureCCPP, FeatureFullFP16, FeaturePAN_RWV,
|
||||
//v8.3
|
||||
FeatureComplxNum, FeatureCCIDX, FeatureJS,
|
||||
FeaturePA, FeatureRCPC,
|
||||
//v8.4
|
||||
FeatureDotProd, FeatureFP16FML, FeatureRASv8_4, FeatureTRACEV8_4,
|
||||
FeatureTLB_RMI, FeatureFMI, FeatureDIT, FeatureSEL2, FeatureRCPC_IMMO,
|
||||
//v8.5
|
||||
FeatureSSBS, FeaturePredRes, FeatureSB, FeatureSpecRestrict]>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Register File Description
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -506,6 +524,7 @@ def PAUnsupported : AArch64Unsupported {
|
|||
}
|
||||
|
||||
include "AArch64SchedA53.td"
|
||||
include "AArch64SchedA55.td"
|
||||
include "AArch64SchedA57.td"
|
||||
include "AArch64SchedCyclone.td"
|
||||
include "AArch64SchedFalkor.td"
|
||||
|
@ -652,6 +671,13 @@ def ProcA78 : SubtargetFeature<"cortex-a78", "ARMProcFamily",
|
|||
FeatureSSBS,
|
||||
FeatureDotProd]>;
|
||||
|
||||
def ProcR82 : SubtargetFeature<"cortex-r82", "ARMProcFamily",
|
||||
"CortexR82",
|
||||
"Cortex-R82 ARM Processors", [
|
||||
// All features are implied by v8_0r ops:
|
||||
HasV8_0rOps,
|
||||
]>;
|
||||
|
||||
def ProcX1 : SubtargetFeature<"cortex-x1", "ARMProcFamily", "CortexX1",
|
||||
"Cortex-X1 ARM processors", [
|
||||
HasV8_2aOps,
|
||||
|
@ -1013,6 +1039,7 @@ def : ProcessorModel<"cortex-a76", CortexA57Model, [ProcA76]>;
|
|||
def : ProcessorModel<"cortex-a76ae", CortexA57Model, [ProcA76]>;
|
||||
def : ProcessorModel<"cortex-a77", CortexA57Model, [ProcA77]>;
|
||||
def : ProcessorModel<"cortex-a78", CortexA57Model, [ProcA78]>;
|
||||
def : ProcessorModel<"cortex-r82", CortexA55Model, [ProcR82]>;
|
||||
def : ProcessorModel<"cortex-x1", CortexA57Model, [ProcX1]>;
|
||||
def : ProcessorModel<"neoverse-e1", CortexA53Model, [ProcNeoverseE1]>;
|
||||
def : ProcessorModel<"neoverse-n1", CortexA57Model, [ProcNeoverseN1]>;
|
||||
|
|
|
@ -103,6 +103,7 @@ void AArch64Subtarget::initializeProperties() {
|
|||
case CortexA76:
|
||||
case CortexA77:
|
||||
case CortexA78:
|
||||
case CortexR82:
|
||||
case CortexX1:
|
||||
PrefFunctionLogAlignment = 4;
|
||||
break;
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
CortexA76,
|
||||
CortexA77,
|
||||
CortexA78,
|
||||
CortexR82,
|
||||
CortexX1,
|
||||
ExynosM3,
|
||||
Falkor,
|
||||
|
@ -84,6 +85,9 @@ protected:
|
|||
bool HasV8_5aOps = false;
|
||||
bool HasV8_6aOps = false;
|
||||
|
||||
bool HasV8_0rOps = false;
|
||||
bool HasCONTEXTIDREL2 = false;
|
||||
|
||||
bool HasFPARMv8 = false;
|
||||
bool HasNEON = false;
|
||||
bool HasCrypto = false;
|
||||
|
@ -306,6 +310,7 @@ public:
|
|||
bool hasV8_3aOps() const { return HasV8_3aOps; }
|
||||
bool hasV8_4aOps() const { return HasV8_4aOps; }
|
||||
bool hasV8_5aOps() const { return HasV8_5aOps; }
|
||||
bool hasV8_0rOps() const { return HasV8_0rOps; }
|
||||
|
||||
bool hasZeroCycleRegMove() const { return HasZeroCycleRegMove; }
|
||||
|
||||
|
@ -343,6 +348,7 @@ public:
|
|||
bool hasSHA3() const { return HasSHA3; }
|
||||
bool hasSHA2() const { return HasSHA2; }
|
||||
bool hasAES() const { return HasAES; }
|
||||
bool hasCONTEXTIDREL2() const { return HasCONTEXTIDREL2; }
|
||||
bool balanceFPOps() const { return BalanceFPOps; }
|
||||
bool predictableSelectIsExpensive() const {
|
||||
return PredictableSelectIsExpensive;
|
||||
|
|
|
@ -32,6 +32,11 @@ def HasPAN_RWV : Predicate<"Subtarget->hasPAN_RWV()">,
|
|||
AssemblerPredicate<(all_of FeaturePAN_RWV),
|
||||
"ARM v8.2 PAN AT S1E1R and AT S1E1W Variation">;
|
||||
|
||||
def HasCONTEXTIDREL2
|
||||
: Predicate<"Subtarget->hasCONTEXTIDREL2()">,
|
||||
AssemblerPredicate<(all_of FeatureCONTEXTIDREL2),
|
||||
"Target contains CONTEXTIDR_EL2 RW operand">;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// AT (address translate) instruction options.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -1220,7 +1225,6 @@ def : RWSysReg<"LORC_EL1", 0b11, 0b000, 0b1010, 0b0100, 0b011>;
|
|||
// Op0 Op1 CRn CRm Op2
|
||||
let Requires = [{ {AArch64::FeatureVH} }] in {
|
||||
def : RWSysReg<"TTBR1_EL2", 0b11, 0b100, 0b0010, 0b0000, 0b001>;
|
||||
def : RWSysReg<"CONTEXTIDR_EL2", 0b11, 0b100, 0b1101, 0b0000, 0b001>;
|
||||
def : RWSysReg<"CNTHV_TVAL_EL2", 0b11, 0b100, 0b1110, 0b0011, 0b000>;
|
||||
def : RWSysReg<"CNTHV_CVAL_EL2", 0b11, 0b100, 0b1110, 0b0011, 0b010>;
|
||||
def : RWSysReg<"CNTHV_CTL_EL2", 0b11, 0b100, 0b1110, 0b0011, 0b001>;
|
||||
|
@ -1246,6 +1250,9 @@ def : RWSysReg<"CNTV_CTL_EL02", 0b11, 0b101, 0b1110, 0b0011, 0b001>;
|
|||
def : RWSysReg<"CNTV_CVAL_EL02", 0b11, 0b101, 0b1110, 0b0011, 0b010>;
|
||||
def : RWSysReg<"SPSR_EL12", 0b11, 0b101, 0b0100, 0b0000, 0b000>;
|
||||
def : RWSysReg<"ELR_EL12", 0b11, 0b101, 0b0100, 0b0000, 0b001>;
|
||||
let Requires = [{ {AArch64::FeatureCONTEXTIDREL2} }] in {
|
||||
def : RWSysReg<"CONTEXTIDR_EL2", 0b11, 0b100, 0b1101, 0b0000, 0b001>;
|
||||
}
|
||||
}
|
||||
// v8.2a registers
|
||||
// Op0 Op1 CRn CRm Op2
|
||||
|
|
|
@ -5251,6 +5251,7 @@ static void ExpandCryptoAEK(AArch64::ArchKind ArchKind,
|
|||
case AArch64::ArchKind::ARMV8_4A:
|
||||
case AArch64::ArchKind::ARMV8_5A:
|
||||
case AArch64::ArchKind::ARMV8_6A:
|
||||
case AArch64::ArchKind::ARMV8R:
|
||||
RequestedExtensions.push_back("sm4");
|
||||
RequestedExtensions.push_back("sha3");
|
||||
RequestedExtensions.push_back("sha2");
|
||||
|
|
|
@ -881,6 +881,14 @@ TEST(TargetParserTest, testAArch64CPU) {
|
|||
AArch64::AEK_LSE | AArch64::AEK_FP16 | AArch64::AEK_DOTPROD |
|
||||
AArch64::AEK_RCPC | AArch64::AEK_SSBS,
|
||||
"8.2-A"));
|
||||
EXPECT_TRUE(testAArch64CPU(
|
||||
"cortex-r82", "armv8-r", "crypto-neon-fp-armv8",
|
||||
AArch64::AEK_CRC | AArch64::AEK_RDM | AArch64::AEK_SSBS |
|
||||
AArch64::AEK_CRYPTO | AArch64::AEK_SM4 | AArch64::AEK_SHA3 |
|
||||
AArch64::AEK_SHA2 | AArch64::AEK_AES | AArch64::AEK_DOTPROD |
|
||||
AArch64::AEK_FP | AArch64::AEK_SIMD | AArch64::AEK_FP16 |
|
||||
AArch64::AEK_FP16FML | AArch64::AEK_RAS | AArch64::AEK_RCPC |
|
||||
AArch64::AEK_SB, "8-R"));
|
||||
EXPECT_TRUE(testAArch64CPU(
|
||||
"cortex-x1", "armv8.2-a", "crypto-neon-fp-armv8",
|
||||
AArch64::AEK_CRC | AArch64::AEK_CRYPTO | AArch64::AEK_FP |
|
||||
|
@ -1026,7 +1034,7 @@ TEST(TargetParserTest, testAArch64CPU) {
|
|||
"8.2-A"));
|
||||
}
|
||||
|
||||
static constexpr unsigned NumAArch64CPUArchs = 42;
|
||||
static constexpr unsigned NumAArch64CPUArchs = 43;
|
||||
|
||||
TEST(TargetParserTest, testAArch64CPUArchList) {
|
||||
SmallVector<StringRef, NumAArch64CPUArchs> List;
|
||||
|
|
Loading…
Reference in New Issue