power_insn: support AA matching
authorDmitry Selyutin <ghostmansd@gmail.com>
Thu, 1 Sep 2022 14:50:54 +0000 (17:50 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Fri, 2 Sep 2022 08:57:36 +0000 (11:57 +0300)
src/openpower/decoder/power_insn.py

index f0f476d7510921d721dac54c5f1e7bd5715a0bd3..1aee47376f1b4faa5a6280658c7436e20d3539c4 100644 (file)
@@ -864,11 +864,25 @@ class PPCDatabase:
 
             return exact_match(key[:-1], record)
 
+        def AA_match(key, record):
+            if not key.endswith("a"):
+                return False
+
+            if record.intop not in {_MicrOp.OP_B, _MicrOp.OP_BC}:
+                return False
+
+            if self.__mdwndb[key]["AA"] is None:
+                return False
+
+            return (exact_match(key[:-1], record) or
+                LK_match(key[:-1], record))
+
         for (section, records) in self.__db.items():
             for record in records:
                 if (exact_match(key, record) or
                         Rc_match(key, record) or
-                        LK_match(key, record)):
+                        LK_match(key, record) or
+                        AA_match(key, record)):
                     return (section, record)
 
         return (None, None)