power_insn: support els specifier assembly
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 20 Nov 2022 14:17:32 +0000 (17:17 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sun, 15 Jan 2023 19:47:22 +0000 (22:47 +0300)
src/openpower/decoder/power_insn.py

index a9ac113296ef26cb51db74c77f10638855f8214c..58190b4630509b1687ba247a73aaeb9b031e4939 100644 (file)
@@ -2817,6 +2817,22 @@ class SpecifierDZ(SpecifierXZ):
             spec.validate(others=items)
 
 
+@_dataclasses.dataclass(eq=True, frozen=True)
+class SpecifierEls(Specifier):
+    @classmethod
+    def match(cls, desc, record):
+        if desc != "els":
+            return None
+
+        return cls(record=record)
+
+    def assemble(self, insn):
+        rm = insn.prefix.rm.select(record=self.record)
+        rm.els = 1
+        if self.record.svp64.mode is _SVMode.LDST_IDX:
+            rm.mode.sel = 1
+
+
 class Specifiers(tuple):
     SPECS = (
         SpecifierW,
@@ -2831,6 +2847,7 @@ class Specifiers(tuple):
         SpecifierZZ,
         SpecifierSZ,
         SpecifierDZ,
+        SpecifierEls,
     )
 
     def __new__(cls, items, record):