]> git.proxmox.com Git - qemu.git/commitdiff
target-mips: Fix incorrect code and test for INSV
authorPetar Jovanovic <petarj@mips.com>
Mon, 26 Nov 2012 15:13:21 +0000 (16:13 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Thu, 6 Dec 2012 07:10:50 +0000 (08:10 +0100)
Content of register rs should be shifted for pos before applying a mask.
This change contains both fix for the instruction and to the existing test.

Signed-off-by: Petar Jovanovic <petarj@mips.com>
Reviewed-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-mips/dsp_helper.c
tests/tcg/mips/mips32-dsp/insv.c

index e7949c22c0b3bcc97ae756c09557e6578be18374..fda5f0460bd59b5d13ce6b1775e8ddd2b6ffb6fc 100644 (file)
@@ -3152,7 +3152,7 @@ target_ulong helper_##name(CPUMIPSState *env, target_ulong rs,  \
                                                                 \
     filter = ((int32_t)0x01 << size) - 1;                       \
     filter = filter << pos;                                     \
-    temprs = rs & filter;                                       \
+    temprs = (rs << pos) & filter;                              \
     temprt = rt & ~filter;                                      \
     temp = temprs | temprt;                                     \
                                                                 \
index 7e3b0476064dc6f93e659b7c11d3be2ba15dfd2f..243b00733d4f6886674c92c78ba87102c0643859 100644 (file)
@@ -10,7 +10,7 @@ int main()
     dsp    = 0x305;
     rt     = 0x12345678;
     rs     = 0x87654321;
-    result = 0x12345338;
+    result = 0x12345438;
     __asm
         ("wrdsp %2, 0x03\n\t"
          "insv  %0, %1\n\t"