mirror of
https://github.com/qemu/qemu.git
synced 2024-12-16 07:53:36 +08:00
target/ppc: bcdsub fix sign when result is zero
When the result of bcdsub is equal to zero, the result sign may be set to negative in some cases, and this does not follow the Power ISA specifications as to decimal integer arithmetic instructions. Signed-off-by: Yasmin Beatriz <yasmins@linux.ibm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
86c0cab11a
commit
56e0e961ec
@ -2747,6 +2747,9 @@ uint32_t helper_bcdadd(ppc_avr_t *r, ppc_avr_t *a, ppc_avr_t *b, uint32_t ps)
|
||||
result.u8[BCD_DIG_BYTE(0)] = bcd_preferred_sgn(sgna, ps);
|
||||
zero = bcd_sub_mag(&result, a, b, &invalid, &overflow);
|
||||
cr = (sgna > 0) ? CRF_GT : CRF_LT;
|
||||
} else if (bcd_cmp_mag(a, b) == 0) {
|
||||
result.u8[BCD_DIG_BYTE(0)] = bcd_preferred_sgn(0, ps);
|
||||
zero = bcd_sub_mag(&result, b, a, &invalid, &overflow);
|
||||
} else {
|
||||
result.u8[BCD_DIG_BYTE(0)] = bcd_preferred_sgn(sgnb, ps);
|
||||
zero = bcd_sub_mag(&result, b, a, &invalid, &overflow);
|
||||
|
Loading…
Reference in New Issue
Block a user