From 55d0436835a028b179cb45cb52d36ee7b05f346c Mon Sep 17 00:00:00 2001 From: lkcl Date: Thu, 21 Apr 2022 13:13:17 +0100 Subject: [PATCH] --- openpower/sv/biginteger/analysis.mdwn | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/openpower/sv/biginteger/analysis.mdwn b/openpower/sv/biginteger/analysis.mdwn index 1be393b7c..be9303194 100644 --- a/openpower/sv/biginteger/analysis.mdwn +++ b/openpower/sv/biginteger/analysis.mdwn @@ -50,7 +50,28 @@ If there is pressure on the register file (multi-million-digit big integers) then a partial-sum may be carried out with LD and ST in a standard Cray-style Vector Loop: - + aptr = A address + bptr = B address + rptr = Result address + li r0, 0 # used to help clear CA + addic r0, r0, 0 # CA to zero as well + setmvli 8 # set MAXVL to 8 + loop: + setvl t0, n # n is the number of digits + mulli t1, t0, 8 # 8 bytes per element + sv.ldu a0, aptr, t1 # update advances pointer + sv.ldu b0, bptr, t1 # likewise + sv.adde r0, a0, b0 # partial, of length VL + sv.stu rptr, r0, t1 # pointer advances too + sub. n, n, t0 # should not alter CA + bnz loop # do more digits + +This is not that different from a Scalar Big-Int add, it is +just that like all Cray-style Vectorisation, a variable number +of elements are covered by one instruction. Of interest +to people unfamiliar with Cray-style Vectors: if VL is not +permitted to exceed 1 (MAXVL set to 1) then the above +actually becomes a Scalar Big-Int add algorithm. # Multiply -- 2.30.2