From: Luke Kenneth Casson Leighton Date: Mon, 18 Apr 2022 15:29:41 +0000 (+0100) Subject: experiment 1 with X-Git-Tag: opf_rfc_ls005_v1~2734 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7af4b874b3ef48c35d13c23d0938ee32c5f67972;p=libreriscv.git experiment 1 with result <- RC + ~(RA * RB) + CARRY gives wrong results --- diff --git a/openpower/sv/bitmanip/divmnu64.c b/openpower/sv/bitmanip/divmnu64.c index 2bdb5bbbb..02bef0bb5 100644 --- a/openpower/sv/bitmanip/divmnu64.c +++ b/openpower/sv/bitmanip/divmnu64.c @@ -107,12 +107,24 @@ again: // Multiply and subtract. k = 0; +#ifdef ORIGINAL for (i = 0; i < n; i++) { p = qhat*vn[i]; t = un[i+j] - k - (p & 0xFFFFFFFFLL); un[i+j] = t; k = (p >> 32) - (t >> 32); } +#else + for (i = 0; i < n; i++) { + unsigned rhi; + unsigned long long sum; + p = ((unsigned long long)un[i+j])+ ~(qhat*vn[i]) + k; + rhi = (p >> 32); + if (((unsigned long long)k) <= 1) rhi += 1; + k = rhi; + un[i+j] = sum & 0xffffffff; + } +#endif t = un[j+n] - k; un[j+n] = t;