power_insn: support specifiers
authorDmitry Selyutin <ghostmansd@gmail.com>
Sat, 17 Sep 2022 13:52:34 +0000 (16:52 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 17 Sep 2022 16:44:16 +0000 (17:44 +0100)
src/openpower/decoder/power_insn.py

index bfaf2fa751216c70b5f4ad9942d14365e8d0cfe1..fcb673e764c27d8d606933d5fb881ca71b317004 100644 (file)
@@ -1278,6 +1278,10 @@ class BaseRM(_Mapping):
     extra2: Extra2.remap(range(10, 19))
     extra3: Extra3.remap(range(10, 19))
 
+    @property
+    def specifiers(self):
+        yield from ()
+
     def disassemble(self, verbosity=Verbosity.NORMAL):
         if verbosity >= Verbosity.VERBOSE:
             indent = (" " * 4)
@@ -1712,20 +1716,30 @@ class SVP64Instruction(PrefixedInstruction):
             yield f"{blob_suffix}.long 0x{int(self.suffix):08x}"
             return
 
+        name = f"sv.{record.name}"
+
+        Rc = False
+        if record.mdwn.operands["Rc"] is not None:
+            Rc = bool(self.suffix[record.fields["Rc"]])
+        rm = self.prefix.rm.select(record=record, Rc=Rc)
+
+        specifiers = tuple(rm.specifiers)
+        if specifiers:
+            specifiers = f"/{'/'.join(specifiers)}"
+        else:
+            specifiers = ""
+
         operands = tuple(map(_operator.itemgetter(1),
             self.dynamic_operands(db=db, verbosity=verbosity)))
         if operands:
-            yield f"{blob_prefix}sv.{record.name} {','.join(operands)}"
+            operands = f" {','.join(operands)}"
         else:
-            yield f"{blob_prefix}{record.name}"
+            operands = ""
+
+        yield f"{blob_prefix}{name}{specifiers}{operands}"
         if blob_suffix:
             yield f"{blob_suffix}"
 
-        Rc = False
-        if record.mdwn.operands["Rc"] is not None:
-            Rc = bool(self.suffix[record.fields["Rc"]])
-
-        rm = self.prefix.rm.select(record=record, Rc=Rc)
         if verbosity >= Verbosity.VERBOSE:
             indent = (" " * 4)
             binary = self.binary