power_insn: support ctr/cti specifiers
authorDmitry Selyutin <ghostmansd@gmail.com>
Mon, 21 Nov 2022 17:58:15 +0000 (20:58 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 2 Jun 2023 18:51:16 +0000 (19:51 +0100)
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):