From 09d67a7ce8e272ea1ef0d1d796b719fe22d0bcdb Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 6 Oct 2022 17:26:24 +0100 Subject: [PATCH] make fail-first cope with sv.cmp which uses CR[BF] --- src/openpower/decoder/isa/caller.py | 13 ++++-- .../decoder/isa/test_caller_svp64_inssort.py | 43 +++++++++---------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/openpower/decoder/isa/caller.py b/src/openpower/decoder/isa/caller.py index 6f00233b..c4cb0c39 100644 --- a/src/openpower/decoder/isa/caller.py +++ b/src/openpower/decoder/isa/caller.py @@ -1855,13 +1855,14 @@ class ISACaller(ISACallerHelper, ISAFPHelpers, StepLoop): if self.is_svp64_mode: sv_mode = yield self.dec2.rm_dec.sv_mode is_cr = sv_mode == SVMode.CROP.value - ffirst_hit = (yield from self.check_ffirst(rc_en or is_cr, srcstep)) + chk = rc_en or is_cr + ffirst_hit = (yield from self.check_ffirst(info, chk, srcstep)) # any modified return results? yield from self.do_outregs_nia(asmop, ins_name, info, outs, carry_en, rc_en, ffirst_hit) - def check_ffirst(self, rc_en, srcstep): + def check_ffirst(self, info, rc_en, srcstep): """fail-first mode: checks a bit of Rc Vector, truncates VL """ rm_mode = yield self.dec2.rm_dec.mode @@ -1878,10 +1879,14 @@ class ISACaller(ISACallerHelper, ISAFPHelpers, StepLoop): if not rc_en or rm_mode != SVP64RMMode.FFIRST.value: return False # get the CR vevtor, do BO-test - regnum, is_vec = yield from get_pdecode_cr_out(self.dec2, "CR0") + crf = "CR0" + log("asmregs", info.asmregs[0], info.write_regs) + if 'CR' in info.write_regs and 'BF' in info.asmregs[0]: + crf = 'BF' + regnum, is_vec = yield from get_pdecode_cr_out(self.dec2, crf) crtest = self.crl[regnum] ffirst_hit = crtest[cr_bit] != ff_inv - log("cr test", regnum, int(crtest), crtest, cr_bit, ff_inv) + log("cr test", crf, regnum, int(crtest), crtest, cr_bit, ff_inv) log("cr test?", ffirst_hit) if not ffirst_hit: return False diff --git a/src/openpower/decoder/isa/test_caller_svp64_inssort.py b/src/openpower/decoder/isa/test_caller_svp64_inssort.py index 8e7cce4f..9703cebb 100644 --- a/src/openpower/decoder/isa/test_caller_svp64_inssort.py +++ b/src/openpower/decoder/isa/test_caller_svp64_inssort.py @@ -67,25 +67,21 @@ class DecoderTestCase(FHDLTestCase): assert crf == crs_expected[i] def tst_sv_insert_sort(self): - """>>> lst = ["svshape 7, 0, 0, 7, 0", - "svremap 31, 0, 1, 0, 0, 0, 0", - "sv.add *0, *8, *16" - ] - REMAP add RT,RA,RB - ctr = alen-1 - li r10, 1 # prepare mask - sld r10, alen, r10 - addi r10, r10, -1 # all 1s. must be better way -loop: - setvl r3, ctr - sv.mv/m=1<