OSDN Git Service

[AArch64][v8.5A] Add Armv8.5-A "DC CVADP" instruction
authorOliver Stannard <oliver.stannard@arm.com>
Thu, 27 Sep 2018 13:53:35 +0000 (13:53 +0000)
committerOliver Stannard <oliver.stannard@arm.com>
Thu, 27 Sep 2018 13:53:35 +0000 (13:53 +0000)
This adds a new variant of the DC system instruction for persistent
memory.

Patch by Pablo Barrio!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343216 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/AArch64.td
lib/Target/AArch64/AArch64InstrInfo.td
lib/Target/AArch64/AArch64Subtarget.h
lib/Target/AArch64/AArch64SystemOperands.td
lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
test/MC/AArch64/armv8.5a-persistent-memory.s [new file with mode: 0644]
test/MC/Disassembler/AArch64/armv8.5a-persistent-memory.txt [new file with mode: 0644]

index 8d20850..c6a41d4 100644 (file)
@@ -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.
 //
@@ -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]
 >;
 
 //===----------------------------------------------------------------------===//
index 1192fad..004639e 100644 (file)
@@ -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
index cc901e1..d0be93e 100644 (file)
@@ -99,6 +99,7 @@ protected:
   bool HasFRInt3264 = false;
   bool HasSpecCtrl = false;
   bool HasPredCtrl = false;
+  bool HasCCDP = false;
 
   // HasZeroCycleRegMove - Has zero-cycle register mov instructions.
   bool HasZeroCycleRegMove = false;
@@ -316,6 +317,7 @@ public:
   bool hasFRInt3264() const { return HasFRInt3264; }
   bool hasSpecCtrl() { return HasSpecCtrl; }
   bool hasPredCtrl() { return HasPredCtrl; }
+  bool hasCCDP() { return HasCCDP; }
 
   bool isLittleEndian() const { return IsLittle; }
 
index 1b3887e..c6d29ac 100644 (file)
@@ -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.
 //===----------------------------------------------------------------------===//
index acbea2b..5648c9f 100644 (file)
@@ -2757,6 +2757,7 @@ static const struct Extension {
   { "ras", {AArch64::FeatureRAS} },
   { "lse", {AArch64::FeatureLSE} },
   { "predctrl", {AArch64::FeaturePredCtrl} },
+  { "ccdp", {AArch64::FeatureCacheDeepPersist} },
 
   // FIXME: Unsupported extensions
   { "pan", {} },
index aa537ab..da8b281 100644 (file)
@@ -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()))
diff --git a/test/MC/AArch64/armv8.5a-persistent-memory.s b/test/MC/AArch64/armv8.5a-persistent-memory.s
new file mode 100644 (file)
index 0000000..a77e1bc
--- /dev/null
@@ -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
diff --git a/test/MC/Disassembler/AArch64/armv8.5a-persistent-memory.txt b/test/MC/Disassembler/AArch64/armv8.5a-persistent-memory.txt
new file mode 100644 (file)
index 0000000..7e07992
--- /dev/null
@@ -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