[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 10/26] target/ppc: bcdsub fix sign when result is zero
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 10/26] target/ppc: bcdsub fix sign when result is zero |
Date: |
Tue, 21 Aug 2018 14:33:27 +1000 |
From: Yasmin Beatriz <address@hidden>
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 <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/int_helper.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/target/ppc/int_helper.c b/target/ppc/int_helper.c
index d52338ed71..ac7f92d7ae 100644
--- a/target/ppc/int_helper.c
+++ b/target/ppc/int_helper.c
@@ -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);
--
2.17.1
- [Qemu-ppc] [PULL 00/26] ppc-for-3.1 queue 20180821, David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 11/26] vfio/spapr: Allow backing bigger guest IOMMU pages with smaller physical pages, David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 01/26] spapr_cpu_core: vmstate_[un]register per-CPU data from (un)realizefn, David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 07/26] target/ppc: Tidy helper_fsqrt, David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 10/26] target/ppc: bcdsub fix sign when result is zero,
David Gibson <=
- [Qemu-ppc] [PULL 04/26] target/ppc: Honor fpscr_ze semantics and tidy fdiv, David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 14/26] spapr: Add a pseries-3.1 machine type, David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 03/26] target/ppc: Enable fp exceptions for user-only, David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 23/26] mac_oldworld: don't use legacy fw_cfg_init_mem() function, David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 24/26] mac_newworld: don't use legacy fw_cfg_init_mem() function, David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 06/26] target/ppc: Tidy helper_fadd, helper_fsub, David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 17/26] hw/ppc/ppc_boards: Don't use old_mmio for ref405ep_fpga, David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 12/26] xics: don't include "target/ppc/cpu-qom.h" in "hw/ppc/xics.h", David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 13/26] target/ppc: simplify bcdadd/sub functions, David Gibson, 2018/08/21
- [Qemu-ppc] [PULL 08/26] target/ppc: Honor fpscr_ze semantics and tidy fre, fresqrt, David Gibson, 2018/08/21