qemu/target
Philippe Mathieu-Daudé e88a856efd target/sh4: Fix SUBV opcode
The documentation says:

  SUBV Rm, Rn        Rn - Rm -> Rn, underflow -> T

The overflow / underflow can be calculated as:

  T = ((Rn ^ Rm) & (Result ^ Rn)) >> 31

However we were using the incorrect:

  T = ((Rn ^ Rm) & (Result ^ Rm)) >> 31

Fix by using the Rn register instead of Rm.

Add tests provided by Paul Cercueil.

Cc: qemu-stable@nongnu.org
Fixes: ad8d25a11f ("target-sh4: implement addv and subv using TCG")
Reported-by: Paul Cercueil <paul@crapouillou.net>
Suggested-by: Paul Cercueil <paul@crapouillou.net>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2318
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Message-Id: <20240430163125.77430-3-philmd@linaro.org>
2024-05-03 17:33:26 +02:00
..
alpha target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h' 2024-04-26 15:31:37 +02:00
arm exec: Declare CPUBreakpoint/CPUWatchpoint type in 'breakpoint.h' header 2024-04-26 17:03:05 +02:00
avr target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h' 2024-04-26 15:31:37 +02:00
cris hw, target: Add ResetType argument to hold and exit phase methods 2024-04-25 10:21:06 +01:00
hexagon accel: Include missing 'exec/cpu_ldst.h' header 2024-04-26 15:31:37 +02:00
hppa target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h' 2024-04-26 15:31:37 +02:00
i386 accel/whpx: Fix NULL dereference in whpx_init_vcpu() 2024-05-03 14:37:51 +02:00
loongarch target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h' 2024-04-26 15:31:37 +02:00
m68k hw, target: Add ResetType argument to hold and exit phase methods 2024-04-25 10:21:06 +01:00
microblaze target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h' 2024-04-26 15:31:37 +02:00
mips target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h' 2024-04-26 15:31:37 +02:00
openrisc target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h' 2024-04-26 15:31:37 +02:00
ppc exec: Declare CPUBreakpoint/CPUWatchpoint type in 'breakpoint.h' header 2024-04-26 17:03:05 +02:00
riscv exec: Declare CPUBreakpoint/CPUWatchpoint type in 'breakpoint.h' header 2024-04-26 17:03:05 +02:00
rx hw, target: Add ResetType argument to hold and exit phase methods 2024-04-25 10:21:06 +01:00
s390x target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h' 2024-04-26 15:31:37 +02:00
sh4 target/sh4: Fix SUBV opcode 2024-05-03 17:33:26 +02:00
sparc target/sparc: Replace abi_ulong by uint32_t for TARGET_ABI32 2024-04-26 15:31:37 +02:00
tricore gdbstub: Avoid including 'cpu.h' in 'gdbstub/helpers.h' 2024-04-26 15:31:37 +02:00
xtensa target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h' 2024-04-26 15:31:37 +02:00
Kconfig target/nios2: Remove the deprecated Nios II target 2024-04-24 16:03:38 +02:00
meson.build exec: Expose 'target_page.h' API to user emulation 2024-04-26 15:28:11 +02:00