From 34a32aaf6daf9addcb3ba370d3c4db8e1ac29e9e Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 18 Apr 2022 10:07:36 -0700 Subject: [PATCH] revert to original code from hackers delight this reverts to the code from commit d23c78621366e1748bb6a782c08225e5faeac179 --- openpower/sv/bitmanip/divmnu64.c | 43 +------------------------------- 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/openpower/sv/bitmanip/divmnu64.c b/openpower/sv/bitmanip/divmnu64.c index 52663f755..2bdb5bbbb 100644 --- a/openpower/sv/bitmanip/divmnu64.c +++ b/openpower/sv/bitmanip/divmnu64.c @@ -107,55 +107,14 @@ 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 & 0xffffffffLL); + un[i+j] = t; k = (p >> 32) - (t >> 32); } t = un[j+n] - k; un[j+n] = t; -#endif -#define EXPERIMENT1 - k = 1; -#ifdef EXPERIMENT1 - for (i = 0; i < n+1; i++) { - unsigned rhi; - unsigned long long sum; - if (i != n) { - p = qhat*vn[i]; - sum = ((unsigned long long)un[i+j]) + ~p + k; - } else { // for last loop instead of separate cleanup do special sum - sum = (~0)+k; - } - rhi = (sum >> 32); - if (((unsigned long long)k) <= 1) rhi += 1; - k = rhi; - un[i+j] = sum & 0xffffffff; - } - // XXX t is not properly computed, it must contain -ve - // if the subtract should not have occurred -#endif -//#define EXPERIMENT2 -#ifdef EXPERIMENT2 - k = 0; - unsigned long phi[200]; // yes, not malloced, we know - unsigned long plo[200]; // yes, not malloced, we know - // double-width multiply with strange subtract only on bottom half - for (i = 0; i < n; i++) { - unsigned long long p = qhat*vn[i]; - plo[i] = un[i+j] - (p&0xffffffffLL); - phi[i] = p >> 32; - } - for (i = 0; i < n; i++) { - t = plo[i] - k; // subtract previous carry - un[i+j] = (t & 0xffffffffLL); - k = phi[i] - (t >> 32); // take top-halves for new carry - } - t = un[j+n] - k; - un[j+n] = t; -#endif q[j] = qhat; // Store quotient digit. if (t < 0) { // If we subtracted too -- 2.30.2