mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06: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
1 changed files with 3 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue