Skip to content

Commit

Permalink
[AArch64][v8.5A] Add Armv8.5-A "DC CVADP" instruction
Browse files Browse the repository at this point in the history
This adds a new variant of the DC system instruction for persistent
memory.

Patch by Pablo Barrio!

Differential revision: https://reviews.llvm.org/D52480

llvm-svn: 343216
  • Loading branch information
ostannard committed Sep 27, 2018
1 parent c4976f6 commit 6930b12
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 2 deletions.
5 changes: 4 additions & 1 deletion llvm/lib/Target/AArch64/AArch64.td
Expand Up @@ -217,6 +217,9 @@ def FeatureSpecCtrl : SubtargetFeature<"specctrl", "HasSpecCtrl", "true",
def FeaturePredCtrl : SubtargetFeature<"predctrl", "HasPredCtrl", "true",
"Enable execution and data prediction invalidation instructions" >;

def FeatureCacheDeepPersist : SubtargetFeature<"ccdp", "HasCCDP",
"true", "Enable Cache Clean to Point of Deep Persistence" >;

//===----------------------------------------------------------------------===//
// Architectures.
//
Expand All @@ -236,7 +239,7 @@ def HasV8_4aOps : SubtargetFeature<"v8.4a", "HasV8_4aOps", "true",
def HasV8_5aOps : SubtargetFeature<
"v8.5a", "HasV8_5aOps", "true", "Support ARM v8.5a instructions",
[HasV8_4aOps, FeatureAltFPCmp, FeatureFRInt3264, FeatureSpecCtrl,
FeaturePredCtrl]
FeaturePredCtrl, FeatureCacheDeepPersist]
>;

//===----------------------------------------------------------------------===//
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/AArch64/AArch64InstrInfo.td
Expand Up @@ -70,6 +70,8 @@ def HasSpecCtrl : Predicate<"Subtarget->hasSpecCtrl()">,
AssemblerPredicate<"FeatureSpecCtrl", "specctrl">;
def HasPredCtrl : Predicate<"Subtarget->hasPredCtrl()">,
AssemblerPredicate<"FeaturePredCtrl", "predctrl">;
def HasCCDP : Predicate<"Subtarget->hasCCDP()">,
AssemblerPredicate<"FeatureCacheDeepPersist", "ccdp">;
def IsLE : Predicate<"Subtarget->isLittleEndian()">;
def IsBE : Predicate<"!Subtarget->isLittleEndian()">;
def UseAlternateSExtLoadCVTF32
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/AArch64/AArch64Subtarget.h
Expand Up @@ -99,6 +99,7 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
bool HasFRInt3264 = false;
bool HasSpecCtrl = false;
bool HasPredCtrl = false;
bool HasCCDP = false;

// HasZeroCycleRegMove - Has zero-cycle register mov instructions.
bool HasZeroCycleRegMove = false;
Expand Down Expand Up @@ -316,6 +317,7 @@ class AArch64Subtarget final : public AArch64GenSubtargetInfo {
bool hasFRInt3264() const { return HasFRInt3264; }
bool hasSpecCtrl() { return HasSpecCtrl; }
bool hasPredCtrl() { return HasPredCtrl; }
bool hasCCDP() { return HasCCDP; }

bool isLittleEndian() const { return IsLittle; }

Expand Down
3 changes: 3 additions & 0 deletions llvm/lib/Target/AArch64/AArch64SystemOperands.td
Expand Up @@ -105,6 +105,9 @@ def : DC<"CISW", 0b000, 0b0111, 0b1110, 0b010>;
let Requires = [{ {AArch64::HasV8_2aOps} }] in
def : DC<"CVAP", 0b011, 0b0111, 0b1100, 0b001>;

let Requires = [{ {AArch64::FeatureCacheDeepPersist} }] in
def : DC<"CVADP", 0b011, 0b0111, 0b1101, 0b001>;

//===----------------------------------------------------------------------===//
// IC (instruction cache maintenance) instruction options.
//===----------------------------------------------------------------------===//
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
Expand Up @@ -2757,6 +2757,7 @@ static const struct Extension {
{ "ras", {AArch64::FeatureRAS} },
{ "lse", {AArch64::FeatureLSE} },
{ "predctrl", {AArch64::FeaturePredCtrl} },
{ "ccdp", {AArch64::FeatureCacheDeepPersist} },

// FIXME: Unsupported extensions
{ "pan", {} },
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
Expand Up @@ -812,7 +812,7 @@ bool AArch64InstPrinter::printSysAlias(const MCInst *MI,
}
break;
// DC aliases
case 4: case 6: case 10: case 11: case 12: case 14:
case 4: case 6: case 10: case 11: case 12: case 13: case 14:
{
const AArch64DC::DC *DC = AArch64DC::lookupDCByEncoding(Encoding);
if (!DC || !DC->haveFeatures(STI.getFeatureBits()))
Expand Down
7 changes: 7 additions & 0 deletions llvm/test/MC/AArch64/armv8.5a-persistent-memory.s
@@ -0,0 +1,7 @@
// RUN: llvm-mc -triple aarch64-none-linux-gnu -show-encoding -mattr=+ccdp < %s | FileCheck %s
// RUN: llvm-mc -triple aarch64-none-linux-gnu -show-encoding -mattr=+v8.5a < %s | FileCheck %s
// RUN: not llvm-mc -triple aarch64-none-linux-gnu -show-encoding -mattr=-ccdp < %s 2>&1 | FileCheck %s --check-prefix=NOCCDP

dc cvadp, x7
// CHECK: dc cvadp, x7 // encoding: [0x27,0x7d,0x0b,0xd5]
// NOCCDP: error: DC CVADP requires ccdp
@@ -0,0 +1,7 @@
# RUN: llvm-mc -triple aarch64-none-linux-gnu -mattr=+ccdp --disassemble < %s | FileCheck %s
# RUN: llvm-mc -triple aarch64-none-linux-gnu -mattr=+v8.5a --disassemble < %s | FileCheck %s
# RUN: llvm-mc -triple aarch64-none-linux-gnu -mattr=-ccdp --disassemble < %s | FileCheck %s --check-prefix=NOCCDP

[0x27,0x7d,0x0b,0xd5]
# CHECK: dc cvadp, x7
# NOCCDP: sys #3, c7, c13, #1, x7

0 comments on commit 6930b12

Please sign in to comment.