1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[AArch64] Add +flagm archictecture option, allowing the v8.4a flag modification extension.

Differential Revision: https://reviews.llvm.org/D94081
This commit is contained in:
Mark Murray 2021-01-05 12:10:04 +00:00
parent 1bb511bb4c
commit 9ad1687341
8 changed files with 25 additions and 20 deletions

View File

@ -109,6 +109,7 @@ AARCH64_ARCH_EXT_NAME("tme", AArch64::AEK_TME, "+tme", "-tme"
AARCH64_ARCH_EXT_NAME("ls64", AArch64::AEK_LS64, "+ls64", "-ls64")
AARCH64_ARCH_EXT_NAME("brbe", AArch64::AEK_BRBE, "+brbe", "-brbe")
AARCH64_ARCH_EXT_NAME("pauth", AArch64::AEK_PAUTH, "+pauth", "-pauth")
AARCH64_ARCH_EXT_NAME("flagm", AArch64::AEK_FLAGM, "+flagm", "-flagm")
#undef AARCH64_ARCH_EXT_NAME
#ifndef AARCH64_CPU_NAME

View File

@ -65,6 +65,7 @@ enum ArchExtKind : uint64_t {
AEK_LS64 = 1ULL << 33,
AEK_BRBE = 1ULL << 34,
AEK_PAUTH = 1ULL << 35,
AEK_FLAGM = 1ULL << 36,
};
enum class ArchKind {

View File

@ -104,6 +104,8 @@ bool AArch64::getExtensionFeatures(uint64_t Extensions,
Features.push_back("+brbe");
if (Extensions & AEK_PAUTH)
Features.push_back("+pauth");
if (Extensions & AEK_FLAGM)
Features.push_back("+flagm");
return true;
}

View File

@ -316,8 +316,8 @@ def FeatureTLB_RMI : SubtargetFeature<
"tlb-rmi", "HasTLB_RMI", "true",
"Enable v8.4-A TLB Range and Maintenance Instructions">;
def FeatureFMI : SubtargetFeature<
"fmi", "HasFMI", "true",
def FeatureFlagM : SubtargetFeature<
"flagm", "HasFlagM", "true",
"Enable v8.4-A Flag Manipulation Instructions">;
// 8.4 RCPC enchancements: LDAPR & STLR instructions with Immediate Offset
@ -445,7 +445,7 @@ def HasV8_4aOps : SubtargetFeature<"v8.4a", "HasV8_4aOps", "true",
"Support ARM v8.4a instructions", [HasV8_3aOps, FeatureDotProd,
FeatureNV, FeatureMPAM, FeatureDIT,
FeatureTRACEV8_4, FeatureAM, FeatureSEL2, FeaturePMU, FeatureTLB_RMI,
FeatureFMI, FeatureRCPC_IMMO]>;
FeatureFlagM, FeatureRCPC_IMMO]>;
def HasV8_5aOps : SubtargetFeature<
"v8.5a", "HasV8_5aOps", "true", "Support ARM v8.5a instructions",
@ -474,7 +474,7 @@ def HasV8_0rOps : SubtargetFeature<
FeaturePAuth, FeatureRCPC,
//v8.4
FeatureDotProd, FeatureFP16FML, FeatureTRACEV8_4,
FeatureTLB_RMI, FeatureFMI, FeatureDIT, FeatureSEL2, FeatureRCPC_IMMO,
FeatureTLB_RMI, FeatureFlagM, FeatureDIT, FeatureSEL2, FeatureRCPC_IMMO,
//v8.5
FeatureSSBS, FeaturePredRes, FeatureSB, FeatureSpecRestrict]>;
@ -697,7 +697,7 @@ def ProcA78C : SubtargetFeature<"cortex-a78c", "ARMProcFamily",
HasV8_2aOps,
FeatureCrypto,
FeatureDotProd,
FeatureFMI,
FeatureFlagM,
FeatureFP16FML,
FeatureFPARMv8,
FeatureFullFP16,

View File

@ -69,8 +69,8 @@ def HasPMU : Predicate<"Subtarget->hasPMU()">,
def HasTLB_RMI : Predicate<"Subtarget->hasTLB_RMI()">,
AssemblerPredicate<(all_of FeatureTLB_RMI), "tlb-rmi">;
def HasFMI : Predicate<"Subtarget->hasFMI()">,
AssemblerPredicate<(all_of FeatureFMI), "fmi">;
def HasFlagM : Predicate<"Subtarget->hasFlagM()">,
AssemblerPredicate<(all_of FeatureFlagM), "flagm">;
def HasRCPC_IMMO : Predicate<"Subtarget->hasRCPCImm()">,
AssemblerPredicate<(all_of FeatureRCPC_IMMO), "rcpc-immo">;
@ -1149,7 +1149,7 @@ def FJCVTZS : BaseFPToIntegerUnscaled<0b01, 0b11, 0b110, FPR64, GPR32,
} // HasJS, HasFPARMv8
// v8.4 Flag manipulation instructions
let Predicates = [HasFMI], Defs = [NZCV], Uses = [NZCV] in {
let Predicates = [HasFlagM], Defs = [NZCV], Uses = [NZCV] in {
def CFINV : SimpleSystemI<0, (ins), "cfinv", "">, Sched<[WriteSys]> {
let Inst{20-5} = 0b0000001000000000;
}
@ -1157,7 +1157,7 @@ def SETF8 : BaseFlagManipulation<0, 0, (ins GPR32:$Rn), "setf8", "{\t$Rn}">;
def SETF16 : BaseFlagManipulation<0, 1, (ins GPR32:$Rn), "setf16", "{\t$Rn}">;
def RMIF : FlagRotate<(ins GPR64:$Rn, uimm6:$imm, imm0_15:$mask), "rmif",
"{\t$Rn, $imm, $mask}">;
} // HasFMI
} // HasFlagM
// v8.5 flag manipulation instructions
let Predicates = [HasAltNZCV], Uses = [NZCV], Defs = [NZCV] in {

View File

@ -140,7 +140,7 @@ protected:
bool HasSEL2 = false;
bool HasPMU = false;
bool HasTLB_RMI = false;
bool HasFMI = false;
bool HasFlagM = false;
bool HasRCPC_IMMO = false;
bool HasLSLFast = false;
@ -513,7 +513,7 @@ public:
bool hasSEL2() const { return HasSEL2; }
bool hasPMU() const { return HasPMU; }
bool hasTLB_RMI() const { return HasTLB_RMI; }
bool hasFMI() const { return HasFMI; }
bool hasFlagM() const { return HasFlagM; }
bool hasRCPC_IMMO() const { return HasRCPC_IMMO; }
bool addrSinkUsingGEPs() const override {

View File

@ -1,13 +1,13 @@
// RUN: llvm-mc -triple aarch64-none-linux-gnu -show-encoding -mattr=+v8.4a %s -o - | \
// RUN: FileCheck %s
// RUN: llvm-mc -triple aarch64-none-linux-gnu -show-encoding -mattr=+fmi %s -o - 2>&1 | \
// RUN: llvm-mc -triple aarch64-none-linux-gnu -show-encoding -mattr=+flagm %s -o - 2>&1 | \
// RUN: FileCheck %s
// RUN: not llvm-mc -triple aarch64-none-linux-gnu -show-encoding -mattr=-v8.4a %s -o - 2>&1 | \
// RUN: FileCheck %s --check-prefix=ERROR
// RUN: not llvm-mc -triple aarch64-none-linux-gnu -show-encoding -mattr=+v8.4a,-fmi %s -o - 2>&1 | \
// RUN: not llvm-mc -triple aarch64-none-linux-gnu -show-encoding -mattr=+v8.4a,-flagm %s -o - 2>&1 | \
// RUN: FileCheck %s --check-prefix=ERROR
//------------------------------------------------------------------------------
@ -30,24 +30,24 @@
//CHECK-NEXT: rmif x1, #63, #15 // encoding: [0x2f,0x84,0x1f,0xba]
//CHECK-NEXT: rmif xzr, #63, #15 // encoding: [0xef,0x87,0x1f,0xba]
//ERROR: error: instruction requires: fmi
//ERROR: error: instruction requires: flagm
//ERROR-NEXT: cfinv
//ERROR-NEXT: ^
//ERROR-NEXT: error: instruction requires: fmi
//ERROR-NEXT: error: instruction requires: flagm
//ERROR-NEXT: setf8 w1
//ERROR-NEXT: ^
//ERROR-NEXT: error: instruction requires: fmi
//ERROR-NEXT: error: instruction requires: flagm
//ERROR-NEXT: setf8 wzr
//ERROR-NEXT: ^
//ERROR-NEXT: error: instruction requires: fmi
//ERROR-NEXT: error: instruction requires: flagm
//ERROR-NEXT: setf16 w1
//ERROR-NEXT: ^
//ERROR-NEXT: error: instruction requires: fmi
//ERROR-NEXT: error: instruction requires: flagm
//ERROR-NEXT: setf16 wzr
//ERROR-NEXT: ^
//ERROR-NEXT: error: instruction requires: fmi
//ERROR-NEXT: error: instruction requires: flagm
//ERROR-NEXT: rmif x1, #63, #15
//ERROR-NEXT: ^
//ERROR-NEXT: error: instruction requires: fmi
//ERROR-NEXT: error: instruction requires: flagm
//ERROR-NEXT: rmif xzr, #63, #15
//ERROR-NEXT: ^

View File

@ -1408,6 +1408,7 @@ TEST(TargetParserTest, AArch64ArchFeatures) {
TEST(TargetParserTest, AArch64ArchExtFeature) {
const char *ArchExt[][4] = {{"crc", "nocrc", "+crc", "-crc"},
{"crypto", "nocrypto", "+crypto", "-crypto"},
{"flagm", "noflagm", "+flagm", "-flagm"},
{"fp", "nofp", "+fp-armv8", "-fp-armv8"},
{"simd", "nosimd", "+neon", "-neon"},
{"fp16", "nofp16", "+fullfp16", "-fullfp16"},