mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
host-utils: add 128-bit quotient support to divu128/divs128
These will be used to implement new decimal floating point instructions from Power ISA 3.1. The remainder is now returned directly by divu128/divs128, freeing up phigh to receive the high 64 bits of the quotient. Signed-off-by: Luis Pires <luis.pires@eldorado.org.br> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20211025191154.350831-4-luis.pires@eldorado.org.br> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
8ac2d6c526
commit
40f3e79a86
4 changed files with 108 additions and 60 deletions
|
@ -120,7 +120,7 @@ uint64_t helper_divdeu(CPUPPCState *env, uint64_t ra, uint64_t rb, uint32_t oe)
|
|||
|
||||
uint64_t helper_divde(CPUPPCState *env, uint64_t rau, uint64_t rbu, uint32_t oe)
|
||||
{
|
||||
int64_t rt = 0;
|
||||
uint64_t rt = 0;
|
||||
int64_t ra = (int64_t)rau;
|
||||
int64_t rb = (int64_t)rbu;
|
||||
int overflow = 0;
|
||||
|
@ -2506,6 +2506,7 @@ uint32_t helper_bcdcfsq(ppc_avr_t *r, ppc_avr_t *b, uint32_t ps)
|
|||
int cr;
|
||||
uint64_t lo_value;
|
||||
uint64_t hi_value;
|
||||
uint64_t rem;
|
||||
ppc_avr_t ret = { .u64 = { 0, 0 } };
|
||||
|
||||
if (b->VsrSD(0) < 0) {
|
||||
|
@ -2541,10 +2542,10 @@ uint32_t helper_bcdcfsq(ppc_avr_t *r, ppc_avr_t *b, uint32_t ps)
|
|||
* In that case, we leave r unchanged.
|
||||
*/
|
||||
} else {
|
||||
divu128(&lo_value, &hi_value, 1000000000000000ULL);
|
||||
rem = divu128(&lo_value, &hi_value, 1000000000000000ULL);
|
||||
|
||||
for (i = 1; i < 16; hi_value /= 10, i++) {
|
||||
bcd_put_digit(&ret, hi_value % 10, i);
|
||||
for (i = 1; i < 16; rem /= 10, i++) {
|
||||
bcd_put_digit(&ret, rem % 10, i);
|
||||
}
|
||||
|
||||
for (; i < 32; lo_value /= 10, i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue