From: Luke Kenneth Casson Leighton Date: Mon, 18 Apr 2022 19:33:31 +0000 (+0100) Subject: experiment expressing borrow as ~val+1 instead of -val X-Git-Tag: opf_rfc_ls005_v1~2724 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bd4cfa18b0ed7828de9bc9ae2b8ef9542f2bbe9c;p=libreriscv.git experiment expressing borrow as ~val+1 instead of -val --- diff --git a/openpower/sv/bitmanip/divmnu64.c b/openpower/sv/bitmanip/divmnu64.c index 52f1715aa..bc9b033b1 100644 --- a/openpower/sv/bitmanip/divmnu64.c +++ b/openpower/sv/bitmanip/divmnu64.c @@ -107,7 +107,7 @@ again: if (rhat < b) goto again; } -#define MUL_RSUB_CARRY1 +#define SUB_MUL_BORROW #ifdef ORIGINAL // Multiply and subtract. k = 0; @@ -141,7 +141,7 @@ again: // this is the new (odd) instruction for(int i = 0; i <= n; i++) { uint64_t value = (((uint64_t)phi[i]<<32) | plo[i]) - borrow; - borrow = -(uint32_t)(value >> 32); + borrow = ~(value >> 32)+1; // -(uint32_t)(value >> 32); un[i + j] = (uint32_t)value; } bool need_fixup = borrow != 0;