From: Luke Kenneth Casson Leighton Date: Mon, 18 Apr 2022 18:55:51 +0000 (+0100) Subject: split MUL_RSUB_CARRY into 2 loops X-Git-Tag: opf_rfc_ls005_v1~2726 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d209b7b2c1a180c8641e781bd98d1b6bb73db35b;p=libreriscv.git split MUL_RSUB_CARRY into 2 loops again make them look like 2 instructions --- diff --git a/openpower/sv/bitmanip/divmnu64.c b/openpower/sv/bitmanip/divmnu64.c index 44310d32d..e5cd1f1d1 100644 --- a/openpower/sv/bitmanip/divmnu64.c +++ b/openpower/sv/bitmanip/divmnu64.c @@ -107,7 +107,7 @@ again: if (rhat < b) goto again; } -#define SUB_MUL_BORROW +#define MUL_RSUB_CARRY #ifdef ORIGINAL // Multiply and subtract. k = 0; @@ -150,9 +150,16 @@ again: // Multiply and subtract. uint32_t carry = 1; + uint32_t phi[2000]; // plenty space + uint32_t plo[2000]; // plenty space for(int i = 0; i <= n; i++) { uint32_t vn_i = i < n ? vn[i] : 0; - uint64_t result = un[i + j] + ~((uint64_t)qhat * vn_i) + carry; + uint64_t value = un[i + j] + ~((uint64_t)qhat * vn_i); + plo[i] = value & 0xffffffffLL; + phi[i] = value >> 32; + } + for(int i = 0; i <= n; i++) { + uint64_t result = (((uint64_t)phi[i]<<32) | plo[i]) + carry; uint32_t result_high = result >> 32; if(carry <= 1) result_high++;