bug 676: although spotted under maxloc, sv.mcrf was incomplete
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 21 Dec 2023 16:33:34 +0000 (16:33 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 30 Jan 2024 20:54:08 +0000 (20:54 +0000)
https://bugs.libre-soc.org/show_bug.cgi?id=1239
BF was "vectorised" (through a rewrite of the immediate field)
but BFA was not. a *lot* more unit tests are needed for ISACaller
to be "up to spec"

src/openpower/decoder/isa/caller.py

index 7ed040e25cfc5dbb308464a1862115be83290f96..c6f255ba4e7b8b4542c747efaf8264ef76a6f83e 100644 (file)
@@ -427,13 +427,15 @@ def _get_predcr(mask):
 
 # read individual CR fields (0..VL-1), extract the required bit
 # and construct the mask
-def get_predcr(crl, mask, vl):
-    idx, noninv = _get_predcr(mask)
+def get_predcr(crl, predselect, vl):
+    idx, noninv = _get_predcr(predselect)
     mask = 0
     for i in range(vl):
         cr = crl[i+SVP64CROffs.CRPred]
         if cr[idx].value == noninv:
             mask |= (1 << i)
+        log("get_predcr", vl, idx, noninv, i+SVP64CROffs.CRPred,
+                          bin(cr.asint()), cr[idx].value, bin(mask))
     return mask
 
 
@@ -560,6 +562,9 @@ def get_cr_in(dec2, name):
     if name == 'BI':
         if in_sel == CRInSel.BI.value:
             return in1, cr_isvec
+    if name == 'BFA':
+        if in_sel == CRInSel.BFA.value:
+            return in1, cr_isvec
     log("get_cr_in not found", name)
     return None, False
 
@@ -1642,6 +1647,10 @@ class ISACaller(ISACallerHelper, ISAFPHelpers, StepLoop):
                 # low 2 LSBs (CR field selector) remain same, CR num extended
                 assert regnum <= 7, "sigh, TODO, 128 CR fields"
                 val = (val & 0b11) | (regnum << 2)
+            elif self.is_svp64_mode and name in ['BFA']:  # TODO, more CRs
+                regnum, is_vec = yield from get_cr_in(self.dec2, name)
+                log('hack %s' % name, regnum, is_vec)
+                val = regnum
             elif self.is_svp64_mode and name in ['BF']:  # TODO, more CRs
                 regnum, is_vec = yield from get_cr_out(self.dec2, "BF")
                 log('hack %s' % name, regnum, is_vec)