power_enums: support predicate type property
authorDmitry Selyutin <ghostmansd@gmail.com>
Tue, 15 Nov 2022 19:41:13 +0000 (22:41 +0300)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 2 Jun 2023 18:51:16 +0000 (19:51 +0100)
src/openpower/decoder/power_enums.py
src/openpower/decoder/power_insn.py

index cd05891ba79073240b566736f21a8d60df1405c8..3311b10931e49e49301038221dbfca54b218aacc 100644 (file)
@@ -393,6 +393,10 @@ class SVP64Predicate(Enum):
     def __str__(self):
         return self.value[0]
 
+    @property
+    def type(self):
+        return SVP64PredicateType(self)
+
     @property
     def inv(self):
         return self.value[1]
index 6b94719b39aac5c6032463cea349037e16a03ac7..7e653123bc2ec42fc80fbbf1499e701b1baca6c0 100644 (file)
@@ -2529,7 +2529,7 @@ class SpecifierFFPR(SpecifierPredicate):
     def match(cls, desc, record, mode):
         return super().match(desc=desc, record=record,
             mode_match=lambda mode_arg: mode_arg == mode,
-            pred_match=lambda pred_arg: _SVP64PredicateType(pred_arg) in (
+            pred_match=lambda pred_arg: pred_arg.type in (
                 _SVP64PredicateType.CR,
                 _SVP64PredicateType.RC1,
             ))
@@ -2597,7 +2597,7 @@ class SpecifierMask(SpecifierPredicate):
     def match(cls, desc, record, mode):
         return super().match(desc=desc, record=record,
             mode_match=lambda mode_arg: mode_arg == mode,
-            pred_match=lambda pred_arg: _SVP64PredicateType(pred_arg) in (
+            pred_match=lambda pred_arg: pred_arg.type in (
                 _SVP64PredicateType.INTEGER,
                 _SVP64PredicateType.CR,
             ))