qemu/tests/tcg/mips/mips32-dsp/insv.c
Petar Jovanovic c0f5f9ce86 target-mips: fix incorrect behaviour for INSV
Corner case for INSV instruction when size=32 has not been correctly
implemented. The mask for size should be one bit wider, and preparing the
filter variable should be aware of this case too.

The test for INSV has been extended to include the case that triggers the
bug.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2013-05-08 18:46:38 +02:00

37 lines
629 B
C

#include<stdio.h>
#include<assert.h>
int main()
{
int rt, rs, dsp;
int result;
/* msb = 10, lsb = 5 */
dsp = 0x305;
rt = 0x12345678;
rs = 0x87654321;
result = 0x12345438;
__asm
("wrdsp %2, 0x03\n\t"
"insv %0, %1\n\t"
: "+r"(rt)
: "r"(rs), "r"(dsp)
);
assert(rt == result);
dsp = 0x1000;
rt = 0xF0F0F0F0;
rs = 0xA5A5A5A5;
result = 0xA5A5A5A5;
__asm
("wrdsp %2\n\t"
"insv %0, %1\n\t"
: "+r"(rt)
: "r"(rs), "r"(dsp)
);
assert(rt == result);
return 0;
}