(no commit message)
authorlkcl <lkcl@web>
Fri, 29 Apr 2022 11:26:45 +0000 (12:26 +0100)
committerIkiWiki <ikiwiki.info>
Fri, 29 Apr 2022 11:26:45 +0000 (12:26 +0100)
openpower/sv/biginteger/analysis.mdwn

index 4cd820b53ea8eecd31c03cbe1e6fa8b127ccefb5..960b501269fc085193ddfde6c5dae8be0bddf5e3 100644 (file)
@@ -458,9 +458,24 @@ Look closely at Algorithm D when the divisor is only a scalar
 Here, just as with `madded` which can put the hi-half of the 128 bit product
 back in as a form of 64-bit carry, a scalar divisor of a vector dividend
 puts the modulo back in as the hi-half of a 128/64-bit divide.
+    RT0      = ((  0<<64) | RA0) / RB0
+         RC0 = ((  0<<64) | RA0) % RB0
+          |
+          +-------+
+                  |
+    RT1      = ((RC0<<64) | RA1) / RB1
+         RC1 = ((RC0<<64) | RA1) % RB1
+          |
+          +-------+
+                  |
+    RT2      = ((RC1<<64) | RA2) / RB2
+         RC2 = ((RC1<<64) | RA2) % RB2
+
 By a nice coincidence this is exactly the same 128/64-bit operation
 needed for the `qhat` estimate if it may produce both the quotient and
 the remainder.
+The pseudocode cleanly covering both scenarios (leaving out
+overflow for clarity) can be written as:
 
 `divrem2du RT,RA,RB,RC`