From a436494ba8e62f56c1c6563a613b48da231a6ced Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Mon, 21 Nov 2022 20:33:22 +0300 Subject: [PATCH] power_insn: support all specifier --- src/openpower/decoder/power_insn.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/openpower/decoder/power_insn.py b/src/openpower/decoder/power_insn.py index a6e69dfa..84cd5e1c 100644 --- a/src/openpower/decoder/power_insn.py +++ b/src/openpower/decoder/power_insn.py @@ -2915,6 +2915,31 @@ class SpecifierCRM(Specifier): rm.crm = 1 +@_dataclasses.dataclass(eq=True, frozen=True) +class SpecifierBranch(Specifier): + @classmethod + def match(cls, desc, record, etalon): + if desc != etalon: + return None + + return cls(record=record) + + def validate(self, others): + if self.record.svp64.mode != _SVMode.BRANCH: + raise ValueError("only branch modes supported") + + +@_dataclasses.dataclass(eq=True, frozen=True) +class SpecifierAll(SpecifierBranch): + @classmethod + def match(cls, desc, record): + return super().match(desc=desc, record=record, etalon="all") + + def assemble(self, insn): + rm = insn.prefix.rm.select(record=self.record) + rm.ALL = 1 + + class Specifiers(tuple): SPECS = ( SpecifierW, @@ -2935,6 +2960,7 @@ class Specifiers(tuple): SpecifierMR, SpecifierMRR, SpecifierCRM, + SpecifierAll, ) def __new__(cls, items, record): -- 2.30.2