power_insn: fix sv_extra algorithm
authorDmitry Selyutin <ghostmansd@gmail.com>
Wed, 17 Aug 2022 18:43:58 +0000 (21:43 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Wed, 17 Aug 2022 18:43:58 +0000 (21:43 +0300)
src/openpower/decoder/power_insn.py

index cdd7ef98ce4c2c40cec4f2e1a4000caf16db2030..e0af08d2db600a0175e77971437b2bc4f528abec 100644 (file)
@@ -480,6 +480,9 @@ class Instruction:
         sel = getattr(self.svp64, key)
         if sel is _CRInSel.BA_BB:
             return _SVExtra.Idx_1_2
+        reg = _SVExtraReg(sel)
+        if reg is _SVExtraReg.NONE:
+            return _SVExtra.NONE
 
         extra_map = {
             _SVExtraRegType.SRC: {},
@@ -490,7 +493,7 @@ class Instruction:
                 extra_map[entry.regtype][entry.reg] = Instruction.__EXTRA[index]
 
         for regtype in (_SVExtraRegType.SRC, _SVExtraRegType.DST):
-            extra = extra_map[regtype][sel]
+            extra = extra_map[regtype].get(reg, _SVExtra.NONE)
             if extra is not _SVExtra.NONE:
                 return extra