summary refs log tree commit diff stats
path: root/gitlab/issues/target_sh4/host_missing/accel_missing/2318.toml
diff options
context:
space:
mode:
Diffstat (limited to 'gitlab/issues/target_sh4/host_missing/accel_missing/2318.toml')
-rw-r--r--gitlab/issues/target_sh4/host_missing/accel_missing/2318.toml42
1 files changed, 42 insertions, 0 deletions
diff --git a/gitlab/issues/target_sh4/host_missing/accel_missing/2318.toml b/gitlab/issues/target_sh4/host_missing/accel_missing/2318.toml
new file mode 100644
index 000000000..8cfd8e0f2
--- /dev/null
+++ b/gitlab/issues/target_sh4/host_missing/accel_missing/2318.toml
@@ -0,0 +1,42 @@
+id = 2318
+title = "SH4: SUBV instruction not emulated properly"
+state = "closed"
+created_at = "2024-04-29T17:36:33.900Z"
+closed_at = "2024-05-04T02:01:16.498Z"
+labels = ["target: sh4", "workflow::Patch available"]
+url = "https://gitlab.com/qemu-project/qemu/-/issues/2318"
+host-os = "Debian testing"
+host-arch = "x86_64"
+qemu-version = "qemu-sh4 version 8.2.1 (Debian 1:8.2.1+ds-2)"
+guest-os = "Buildroot uClibc (qemu-user)"
+guest-arch = "SH4"
+description = """SUBV opcode is emulated incorrectly.
+
+The documentation says:
+
+`SUBV Rm, Rn        Rn - Rm -> Rn, underflow -> T`
+
+Qemu seems to perform the subtraction correctly, but will not detect an underflow."""
+reproduce = """```c
+#include <stdio.h>
+
+int main(void)
+{
+\tregister unsigned int a asm("r8") = 0x80000001;
+\tregister unsigned int b asm("r9") = 0x2;
+\tregister unsigned int c asm("r10");
+
+\tasm volatile("subv %2,%0\\n"
+\t\t     "movt %1\\n"
+\t\t     : "+r"(a), "=r"(c) : "r"(b) :);
+
+\tprintf("Values: a=0x%x b=0x%x c=0x%x\\n", a, b, c);
+
+\treturn 0;
+}
+```"""
+additional = """Tested on real hardware (SEGA Dreamcast, GCC 15.0), the program above prints:
+`Values: a=0x7fffffff b=0x2 c=0x1`
+
+Running with Qemu (and GCC 13.0), the same program prints:
+`Values: a=0x7fffffff b=0x2 c=0x0`"""