From 7af4b874b3ef48c35d13c23d0938ee32c5f67972 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 18 Apr 2022 16:29:41 +0100 Subject: [PATCH] experiment 1 with result <- RC + ~(RA * RB) + CARRY gives wrong results --- openpower/sv/bitmanip/divmnu64.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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; -- 2.30.2