target-mips: Fix incorrect code and test for INSV
PATCH 1/1 target-mips: Fix incorrect code and test for INSV
From: Petar Jovanovic <[email protected]>
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.
--- target-mips/dsp_helper.c | 2 +- tests/tcg/mips/mips32-dsp/insv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
target-mips/dsp_helper.c +1 -1
@@ -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; \ \
tests/tcg/mips/mips32-dsp/insv.c +1 -1
@@ -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"
Signature · 1 line
1.7.5.4
Quoted 50 lines
-----Original Message-----
From: [email protected] [mailto:qemu-devel- [email protected]] On Behalf Of Petar Jovanovic
Sent: Monday, November 26, 2012 7:13 AM
To: [email protected]
Cc: Jovanovic, Petar; [email protected]
Subject: [Qemu-devel] [PATCH] target-mips: Fix incorrect code and test for INSVFrom: Petar Jovanovic <[email protected]>
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 <[email protected]>--- target-mips/dsp_helper.c | 2 +- tests/tcg/mips/mips32-dsp/insv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)target-mips/dsp_helper.c +1
-1@@ -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; \\tests/tcg/mips/mips32- renamed from tests/tcg/mips/mips32-dsp/insv.c +0
-0
dsp/insv.c
index 7e3b047..243b007 100644tests/tcg/mips/mips32-dsp/insv.c +1
-2@@ -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" --
Quoted 2 lines
1.7.5.4
Aurelien Jarno
AppliedQuoted 29 lines · Petar Jovanovic
From: Petar Jovanovic <[email protected]>
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 <[email protected]>--- target-mips/dsp_helper.c | 2 +- tests/tcg/mips/mips32-dsp/insv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)target-mips/dsp_helper.c +1
-1@@ -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; \ \tests/tcg/mips/mips32-dsp/insv.c +0
-0
tests/tcg/mips/mips32-dsp/insv.c int main() · line 16
Quoted 8 lines
tests/tcg/mips/mips32-dsp/insv.c +1
-1@@ -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"
Thanks, applied. I added a CC: to [email protected], as it is definitely stable material.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net