[Libre-soc-isa] [Bug 817] Big Integer Math (sv.adde, sv.subfe, sv.madded, 128 by 64-bit -> 64-bit div/rem, maybe more...)

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Apr 25 20:14:58 BST 2022


https://bugs.libre-soc.org/show_bug.cgi?id=817

--- Comment #31 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
ha. simple. this:

 128         // Compute estimate qhat of q[j] from top 2 digits
 129         uint64_t dig2 = ((uint64_t)un[j + n] << 32) | un[j + n - 1];
 130         qhat = dig2 / vn[n - 1];
 131         rhat = dig2 % vn[n - 1];

becomes a 2-long unrolling of the loop @ line 98, like this:

         uint64_t dig1 = (uint64_t)un[j + n];
         qhat = dig1 / vn[n - 1];
         rhat = dig1 % vn[n - 1];
         uint64_t dig2 = (rhat << 32) | un[j + n - 1];
         qhat = qhat<<32 | dig2 / vn[n - 1];
         rhat = rhat<<32 | dig2 % vn[n - 1];

(translate to 128/64 rather than 64/32 of course).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Libre-SOC-ISA mailing list