xemu/target-arm
Peter Crosthwaite 0655eeed18 arm: translate.c: Fix smlald Instruction
The smlald (and probably smlsld) instruction was doing incorrect sign
extensions of the operands amongst 64bit result calculation. The
instruction psuedo-code is:

 operand2 = if m_swap then ROR(R[m],16) else R[m];
 product1 = SInt(R[n]<15:0>) * SInt(operand2<15:0>);
 product2 = SInt(R[n]<31:16>) * SInt(operand2<31:16>);
 result = product1 + product2 + SInt(R[dHi]:R[dLo]);
 R[dHi] = result<63:32>;
 R[dLo] = result<31:0>;

The result calculation should be done in 64 bit arithmetic, and hence
product1 and product2 should be sign extended to 64b before calculation.

The current implementation was adding product1 and product2 together
then sign-extending the intermediate result leading to false negatives.

E.G. if product1 = product2 = 0x4000000, their sum = 0x80000000, which
will be incorrectly interpreted as -ve on sign extension.

We fix by doing the 64b extensions on both product1 and product2 before
any addition/subtraction happens.

We also fix where we were possibly incorrectly setting the Q saturation
flag for SMLSLD, which the ARM ARM specifically says is not set.

Reported-by: Christina Smith <christina.smith@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 2cddb6f5a15be4ab8d2160f3499d128ae93d304d.1397704570.git.peter.crosthwaite@xilinx.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 33bbd75a7c)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2014-06-25 16:08:05 -05:00
..
Makefile.objs Makefile.target: CONFIG_NO_* variables removed 2013-10-16 18:21:00 +02:00
arm-semi.c exec: Change cpu_memory_rw_debug() argument to CPUState 2013-07-23 02:41:33 +02:00
cpu-qom.h target-arm: Add AArch64 gdbstub support 2013-09-10 19:11:28 +01:00
cpu.c target-arm: Prepare translation for AArch64 code 2013-09-10 19:11:28 +01:00
cpu.h target-arm: Add CP15 VBAR support 2013-10-31 14:00:16 +01:00
cpu64.c target-arm: Add AArch64 gdbstub support 2013-09-10 19:11:28 +01:00
gdbstub.c cpu: Introduce CPUClass::gdb_{read,write}_register() 2013-07-27 00:04:17 +02:00
gdbstub64.c target-arm: Add AArch64 gdbstub support 2013-09-10 19:11:28 +01:00
helper.c target-arm: sort TCG cpreg list by KVM-style 64 bit ID number 2013-10-31 14:00:16 +01:00
helper.h tcg: Remove stray semi-colons from target-*/helper.h 2013-10-10 11:43:37 -07:00
iwmmxt_helper.c misc: Use new rotate functions 2013-09-25 21:23:05 +02:00
kvm-stub.c target-arm: Initialize cpreg list from KVM when using KVM 2013-06-25 18:16:10 +01:00
kvm.c target-arm: fix sorting issue of KVM cpreg list 2013-10-31 14:00:16 +01:00
kvm_arm.h target-arm: Initialize cpreg list from KVM when using KVM 2013-06-25 18:16:10 +01:00
machine.c target-arm: Prepare translation for AArch64 code 2013-09-10 19:11:28 +01:00
neon_helper.c exec: move include files to include/exec/ 2012-12-19 08:31:31 +01:00
op_addsub.h Correct spelling of licensed 2011-07-23 11:26:12 -05:00
op_helper.c cpu: Move halted and interrupt_request fields to CPUState 2013-03-12 10:35:55 +01:00
translate-a64.c target-arm: Add AArch64 translation stub 2013-09-10 19:11:28 +01:00
translate.c arm: translate.c: Fix smlald Instruction 2014-06-25 16:08:05 -05:00
translate.h target-arm: Add AArch64 translation stub 2013-09-10 19:11:28 +01:00