[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/12] target/mips: Make the results of MOD_<U|S>.<B|
From: |
Aleksandar Markovic |
Subject: |
[Qemu-devel] [PULL 02/12] target/mips: Make the results of MOD_<U|S>.<B|H|W|D> the same as on hardware |
Date: |
Sun, 26 May 2019 18:19:01 +0200 |
From: Mateja Marjanovic <address@hidden>
MSA instructions MOD_<U|S>.<B|H|W|D> when dividing by zero,
didn't return the same value when executed on a referent hardware
(FPGA MIPS 64 r6, little endian) and when executed on QEMU, which
is not a real bug, because the result when dividing by zero is
UNPREDICTABLE [1] (page 255, 256).
[1] MIPS Architecture for Programmers
Volume IV-j: The MIPS64 SIMD
Architecture Module, Revision 1.12
Signed-off-by: Mateja Marjanovic <address@hidden>
Signed-off-by: Aleksandar Markovic <address@hidden>
Reviewed-by: Aleksandar Markovic <address@hidden>
Message-Id: <address@hidden>
---
target/mips/msa_helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
index 596190b..274c6ca 100644
--- a/target/mips/msa_helper.c
+++ b/target/mips/msa_helper.c
@@ -657,14 +657,14 @@ static inline int64_t msa_mod_s_df(uint32_t df, int64_t
arg1, int64_t arg2)
if (arg1 == DF_MIN_INT(df) && arg2 == -1) {
return 0;
}
- return arg2 ? arg1 % arg2 : 0;
+ return arg2 ? arg1 % arg2 : arg1;
}
static inline int64_t msa_mod_u_df(uint32_t df, int64_t arg1, int64_t arg2)
{
uint64_t u_arg1 = UNSIGNED(arg1, df);
uint64_t u_arg2 = UNSIGNED(arg2, df);
- return u_arg2 ? u_arg1 % u_arg2 : 0;
+ return u_arg2 ? u_arg1 % u_arg2 : u_arg1;
}
#define SIGNED_EVEN(a, df) \
--
2.7.4
- [Qemu-devel] [PULL 06/12] target/mips: Refactor and fix COPY_U.<B|H|W> instructions, (continued)
- [Qemu-devel] [PULL 06/12] target/mips: Refactor and fix COPY_U.<B|H|W> instructions, Aleksandar Markovic, 2019/05/26
- [Qemu-devel] [PULL 12/12] BootLinuxSshTest: Test some userspace commands on Malta, Aleksandar Markovic, 2019/05/26
- [Qemu-devel] [PULL 10/12] target/mips: add or remove space to fix checkpatch errors, Aleksandar Markovic, 2019/05/26
- [Qemu-devel] [PULL 11/12] target/mips: realign comments to fix checkpatch warnings, Aleksandar Markovic, 2019/05/26
- [Qemu-devel] [PULL 08/12] mips: Decide to map PAGE_EXEC in map_address, Aleksandar Markovic, 2019/05/26
- [Qemu-devel] [PULL 07/12] target/mips: Refactor and fix INSERT.<B|H|W|D> instructions, Aleksandar Markovic, 2019/05/26
- [Qemu-devel] [PULL 05/12] target/mips: Refactor and fix COPY_S.<B|H|W|D> instructions, Aleksandar Markovic, 2019/05/26
- [Qemu-devel] [PULL 09/12] linux-user: fix __NR_semtimedop undeclared error, Aleksandar Markovic, 2019/05/26
- [Qemu-devel] [PULL 04/12] target/mips: Fix MSA instructions ST.<B|H|W|D> on big endian host, Aleksandar Markovic, 2019/05/26
- [Qemu-devel] [PULL 03/12] target/mips: Fix MSA instructions LD.<B|H|W|D> on big endian host, Aleksandar Markovic, 2019/05/26
- [Qemu-devel] [PULL 02/12] target/mips: Make the results of MOD_<U|S>.<B|H|W|D> the same as on hardware,
Aleksandar Markovic <=
- [Qemu-devel] [PULL 01/12] target/mips: Make the results of DIV_<U|S>.<B|H|W|D> the same as on hardware, Aleksandar Markovic, 2019/05/26
- Re: [Qemu-devel] [PULL 00/12] MIPS queue for May 19th, 2019 - v3, Peter Maydell, 2019/05/28