From: Luke Kenneth Casson Leighton Date: Tue, 5 Dec 2023 15:49:37 +0000 (+0000) Subject: add sv.bc warm words for pospopcount bug #672 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0eee41dc14505b669d47c8e913d952888c7b7c94;p=libreriscv.git add sv.bc warm words for pospopcount bug #672 --- diff --git a/openpower/sv/cookbook/pospopcnt.mdwn b/openpower/sv/cookbook/pospopcnt.mdwn index bf3a6880c..0c3bd5eb4 100644 --- a/openpower/sv/cookbook/pospopcnt.mdwn +++ b/openpower/sv/cookbook/pospopcnt.mdwn @@ -166,6 +166,13 @@ set already by the `setvl` above. sv.add *16,*16,*24 # and accumulate in results ``` +Finally, `sv.bc` loops back, subtracting VL from CTR. +Being based on Power ISA Scalar Branch-Conditional, if +CTR goes negative (which it will because VL was set +hard-coded to 8, above) it does not matter, the loop +will still be correctly exited. In other words we complete +the correct number of *blocks* (of length 8). + ``` # branch back if CTR still non-zero. works even though VL=8 sv.bc/all 16, *0, -0x28 # reduce CTR by VL and stop if -ve