From dc79c46ae3b6d6add66d6e00737249b9dfcdf1cf Mon Sep 17 00:00:00 2001 From: lkcl Date: Tue, 26 Apr 2022 17:27:28 +0100 Subject: [PATCH] --- openpower/sv/biginteger/analysis.mdwn | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openpower/sv/biginteger/analysis.mdwn b/openpower/sv/biginteger/analysis.mdwn index a29aa6a6b..76f0a37f5 100644 --- a/openpower/sv/biginteger/analysis.mdwn +++ b/openpower/sv/biginteger/analysis.mdwn @@ -409,3 +409,11 @@ selecting whether `RS=RC` or allows the instruction to perform full parallel vector div/mod, or act in loop-back mode for big-int division by a scalar, or for a single scalar 128/64 div/mod. + +Just as with `divdeu` on which this instruction is based an overflow +detection is required. When the divisor is too small compared to +the dividend then the result may not fit into 64 bit. Knuth's +original algorithm detects overflow and manually places 0xffffffff +(all ones) into `qhat`. It makes sense for `divrem2du` to do +this, and also to return an overflow indicator: this can be dobe +by always setting Rc=1 as a way to save opcode space -- 2.30.2