power_insn: support ctr/cti specifiers
authorDmitry Selyutin <ghostmansd@gmail.com>
Mon, 21 Nov 2022 17:58:15 +0000 (20:58 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sun, 15 Jan 2023 19:47:22 +0000 (22:47 +0300)
src/openpower/decoder/power_insn.py

index a3d4cd47166b79c5ae6baeb0cab24f6e4bd2cdc0..d0799952fdf2f37999c25eb05dde01be41406282 100644 (file)
@@ -3037,6 +3037,35 @@ class SpecifierVSbi(SpecifierVS):
         rm.VSb = 1
 
 
+@_dataclasses.dataclass(eq=True, frozen=True)
+class SpecifierCTR(SpecifierVS):
+    @classmethod
+    def match(cls, desc, record):
+        if desc != "ctr":
+            return None
+
+        return cls(record=record)
+
+    def assemble(self, insn):
+        rm = insn.prefix.rm.select(record=self.record)
+        rm.CTR = 1
+
+
+@_dataclasses.dataclass(eq=True, frozen=True)
+class SpecifierCTi(SpecifierVS):
+    @classmethod
+    def match(cls, desc, record):
+        if desc != "cti":
+            return None
+
+        return cls(record=record)
+
+    def assemble(self, insn):
+        rm = insn.prefix.rm.select(record=self.record)
+        rm.CTR = 1
+        rm.CTi = 1
+
+
 class Specifiers(tuple):
     SPECS = (
         SpecifierW,
@@ -3066,6 +3095,8 @@ class Specifiers(tuple):
         SpecifierVSi,
         SpecifierVSb,
         SpecifierVSbi,
+        SpecifierCTR,
+        SpecifierCTi,
     )
 
     def __new__(cls, items, record):