power_insn: support vs/vsi/vsb/vsbi/ctr/cti specifiers
authorDmitry Selyutin <ghostmansd@gmail.com>
Tue, 20 Sep 2022 00:45:48 +0000 (03:45 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Tue, 20 Sep 2022 00:55:05 +0000 (03:55 +0300)
src/openpower/decoder/power_insn.py
src/openpower/sv/trans/svp64.py
src/openpower/sv/trans/test_pysvp64dis.py

index 073d4d7798d0fe3c78506160c1012dfb80a29595..98fd44c923fabb602f80e80b38344158a5d20a7d 100644 (file)
@@ -1758,11 +1758,29 @@ class BranchVLSRM(BranchBaseRM):
     VSb: BaseRM[7]
     VLI: BaseRM[21]
 
+    def specifiers(self, record):
+        yield {
+            (0b0, 0b0): "vs",
+            (0b0, 0b1): "vsi",
+            (0b1, 0b0): "vsb",
+            (0b1, 0b1): "vsbi",
+        }[int(self.VSb), int(self.VLI)]
+
+        yield from super().specifiers(record=record)
+
 
 class BranchCTRRM(BranchBaseRM):
     """branch: CTR-test mode"""
     CTi: BaseRM[6]
 
+    def specifiers(self, record):
+        if self.CTi:
+            yield "cti"
+        else:
+            yield "ctr"
+
+        yield from super().specifiers(record=record)
+
 
 class BranchCTRVLSRM(BranchVLSRM, BranchCTRRM):
     """branch: CTR-test+VLSET mode"""
index 7e1b2637fe19c40631070190e6460a544ed867db..da0e8e55e10d32625b8dfe4774255edc2b6127c9 100644 (file)
@@ -1154,12 +1154,10 @@ class SVP64Asm:
                     svp64_rm.branch.vls.VSb = 1
                 elif encmode == 'vsbi':
                     svp64_rm.branch.VLS = 1
-                    svp64_rm.branch.vls.VLb = 1
+                    svp64_rm.branch.vls.VSb = 1
                     svp64_rm.branch.vls.VLI = 1
                 elif encmode == 'ctr':
                     svp64_rm.branch.CTR = 1
-                    svp64_rm.branch.VLS = 0
-                    svp64_rm.branch.ctr.CTi = 1
                 elif encmode == 'cti':
                     svp64_rm.branch.CTR = 1
                     svp64_rm.branch.ctr.CTi = 1
index 53d854ca4599267d342af67b708344b83d855378..981147e14c70d08e4484587e45c94800ae9ebfda 100644 (file)
@@ -261,6 +261,12 @@ class SVSTATETestCase(unittest.TestCase):
                     "sv.bc/snz 12,*1,0xc",
                     "sv.bc/all/sl/slu 12,*1,0xc",
                     "sv.bc/all/snz/sl/slu/lru 12,*1,0xc",
+                    "sv.bc/vs/all/snz/sl/slu/lru 12,*1,0xc",
+                    "sv.bc/vsi/all/snz/sl/slu/lru 12,*1,0xc",
+                    "sv.bc/vsb/all/snz/sl/slu/lru 12,*1,0xc",
+                    "sv.bc/vsbi/all/snz/sl/slu/lru 12,*1,0xc",
+                    "sv.bc/ctr/all/snz/sl/slu/lru 12,*1,0xc",
+                    "sv.bc/cti/all/snz/sl/slu/lru 12,*1,0xc",
                         ]
         self._do_tst(expected)