From: Jacob Lifshay Date: Mon, 18 Apr 2022 17:38:12 +0000 (-0700) Subject: split out condition X-Git-Tag: opf_rfc_ls005_v1~2729 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ca4b2a548b46c09d1a03bc099589fae9317872aa;p=libreriscv.git split out condition --- diff --git a/openpower/sv/bitmanip/divmnu64.c b/openpower/sv/bitmanip/divmnu64.c index f9f6572d0..1d3585eec 100644 --- a/openpower/sv/bitmanip/divmnu64.c +++ b/openpower/sv/bitmanip/divmnu64.c @@ -8,6 +8,7 @@ machine which has a 64/64 division instruction. */ #include #include //To define "exit", req'd by XLC. +#include #define max(x, y) ((x) > (y) ? (x) : (y)) @@ -115,9 +116,10 @@ again: } t = un[j+n] - k; un[j+n] = t; + bool need_fixup = t < 0; q[j] = qhat; // Store quotient digit. - if (t < 0) { // If we subtracted too + if (need_fixup) { // If we subtracted too q[j] = q[j] - 1; // much, add back. k = 0; for (i = 0; i < n; i++) {