diff options
author | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-09-25 18:41:28 +0000 |
---|---|---|
committer | balrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-09-25 18:41:28 +0000 |
commit | 59e0fbf8e916efa9b9e9fed00f5692e8a7d684d9 (patch) | |
tree | 3a6d4b4a34bb306d8b4bc34be0c48916cc7885f6 /tests | |
parent | 0086de1c66c06a86089456b195fa7f1dcce7df74 (diff) |
Add a simple SSSE3 test.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5320 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-i386-ssse3.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/test-i386-ssse3.c b/tests/test-i386-ssse3.c new file mode 100644 index 0000000000..0a43d271f7 --- /dev/null +++ b/tests/test-i386-ssse3.c @@ -0,0 +1,42 @@ +/* See if various MMX/SSE SSSE3 instructions give expected results */ +#include <stdio.h> +#include <string.h> + +int main(int argc, char *argv[]) { + char hello[16]; + const char ehlo[8] = "EHLO "; + uint64_t mask = 0x8080800302020001; + + uint64_t a = 0x0000000000090007; + uint64_t b = 0x0000000000000000; + + const char c[16] = "LLOaaaaaaaaaaaaa"; + const char d[16] = "aaaaaaaaaaaaaaHE"; + + /* pshufb mm1/xmm1, mm2/xmm2 */ + asm volatile ("movq (%0), %%mm0" : : "r" (ehlo) : "mm0", "mm1"); + asm volatile ("movq %0, %%mm1" : : "m" (mask)); + asm volatile ("pshufb %mm1, %mm0"); + asm volatile ("movq %%mm0, %0" : "=m" (hello)); + printf("%s\n", hello); + + /* pshufb mm1/xmm1, m64/m128 */ + asm volatile ("movq (%0), %%mm0" : : "r" (ehlo) : "mm0"); + asm volatile ("pshufb %0, %%mm0" : : "m" (mask)); + asm volatile ("movq %%mm0, %0" : "=m" (hello)); + printf("%s\n", hello); + + /* psubsw mm1/xmm1, m64/m128 */ + asm volatile ("movq %0, %%mm0" : : "r" (a) : "mm0"); + asm volatile ("phsubsw %0, %%mm0" : : "m" (b)); + asm volatile ("movq %%mm0, %0" : "=m" (a)); + printf("%i - %i = %i\n", 9, 7, -(int16_t) a); + + /* palignr mm1/xmm1, m64/m128, imm8 */ + asm volatile ("movdqa (%0), %%xmm0" : : "r" (c) : "xmm0"); + asm volatile ("palignr $14, (%0), %%xmm0" : : "r" (d)); + asm volatile ("movdqa %%xmm0, (%0)" : : "r" (hello)); + printf("%5.5s\n", hello); + + return 0; +} |