aboutsummaryrefslogtreecommitdiffstats
path: root/tools/tests
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2011-12-01 08:49:31 +0100
committerJan Beulich <jbeulich@suse.com>2011-12-01 08:49:31 +0100
commit316af62170b0d0b12fc0d6bf5bd2b09776914633 (patch)
treebe134057def1eb9507616b9cd0b57664181cbcc3 /tools/tests
parent11c35f84b53622c429071049b830bb9b7a880eff (diff)
downloadxen-316af62170b0d0b12fc0d6bf5bd2b09776914633.tar.gz
xen-316af62170b0d0b12fc0d6bf5bd2b09776914633.tar.bz2
xen-316af62170b0d0b12fc0d6bf5bd2b09776914633.zip
x86/emulator: add emulation of SIMD FP moves
Clone the existing movq emulation to also support the most fundamental SIMD FP moves. Extend the testing code to also exercise these instructions. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'tools/tests')
-rw-r--r--tools/tests/x86_emulator/test_x86_emulator.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index bc66c97d2d..3142917585 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -629,6 +629,60 @@ int main(int argc, char **argv)
else
printf("skipped\n");
+ printf("%-40s", "Testing movsd %xmm5,(%ecx)...");
+ memset(res, 0x77, 64);
+ memset(res + 10, 0x66, 8);
+ if ( stack_exec && cpu_has_sse2 )
+ {
+ extern const unsigned char movsd_to_mem[];
+
+ asm volatile ( "movlpd %0, %%xmm5\n\t"
+ "movhpd %0, %%xmm5\n"
+ ".pushsection .test, \"a\", @progbits\n"
+ "movsd_to_mem: movsd %%xmm5, (%1)\n"
+ ".popsection" :: "m" (res[10]), "c" (NULL) );
+
+ memcpy(instr, movsd_to_mem, 15);
+ regs.eip = (unsigned long)&instr[0];
+ regs.ecx = (unsigned long)(res + 2);
+ regs.edx = 0;
+ rc = x86_emulate(&ctxt, &emulops);
+ if ( (rc != X86EMUL_OKAY) || memcmp(res, res + 8, 32) )
+ goto fail;
+ printf("okay\n");
+ }
+ else
+ {
+ printf("skipped\n");
+ memset(res + 2, 0x66, 8);
+ }
+
+ printf("%-40s", "Testing movaps (%edx),%xmm7...");
+ if ( stack_exec && cpu_has_sse )
+ {
+ extern const unsigned char movaps_from_mem[];
+
+ asm volatile ( "xorps %%xmm7, %%xmm7\n"
+ ".pushsection .test, \"a\", @progbits\n"
+ "movaps_from_mem: movaps (%0), %%xmm7\n"
+ ".popsection" :: "d" (NULL) );
+
+ memcpy(instr, movaps_from_mem, 15);
+ regs.eip = (unsigned long)&instr[0];
+ regs.ecx = 0;
+ regs.edx = (unsigned long)res;
+ rc = x86_emulate(&ctxt, &emulops);
+ if ( rc != X86EMUL_OKAY )
+ goto fail;
+ asm ( "cmpeqps %1, %%xmm7\n\t"
+ "movmskps %%xmm7, %0" : "=r" (rc) : "m" (res[8]) );
+ if ( rc != 0xf )
+ goto fail;
+ printf("okay\n");
+ }
+ else
+ printf("skipped\n");
+
for ( j = 1; j <= 2; j++ )
{
#if defined(__i386__)