|
From: <sv...@va...> - 2009-10-09 00:05:14
|
Author: sewardj
Date: 2009-10-09 01:04:51 +0100 (Fri, 09 Oct 2009)
New Revision: 10899
Log:
Add tests for PMOVMSKB for x86 and amd64.
Added:
branches/ICC111/memcheck/tests/amd64/pmovmskb64.c
branches/ICC111/memcheck/tests/amd64/pmovmskb64.stderr.exp
branches/ICC111/memcheck/tests/amd64/pmovmskb64.stdout.exp
branches/ICC111/memcheck/tests/amd64/pmovmskb64.vgtest
branches/ICC111/memcheck/tests/x86/pmovmskb32.c
branches/ICC111/memcheck/tests/x86/pmovmskb32.stderr.exp
branches/ICC111/memcheck/tests/x86/pmovmskb32.stdout.exp
branches/ICC111/memcheck/tests/x86/pmovmskb32.vgtest
Modified:
branches/ICC111/memcheck/tests/amd64/Makefile.am
branches/ICC111/memcheck/tests/x86/Makefile.am
Modified: branches/ICC111/memcheck/tests/amd64/Makefile.am
===================================================================
--- branches/ICC111/memcheck/tests/amd64/Makefile.am 2009-10-08 17:26:07 UTC (rev 10898)
+++ branches/ICC111/memcheck/tests/amd64/Makefile.am 2009-10-09 00:04:51 UTC (rev 10899)
@@ -16,12 +16,17 @@
fxsave-amd64.vgtest fxsave-amd64.stdout.exp fxsave-amd64.stderr.exp \
int3-amd64.vgtest int3-amd64.stdout.exp int3-amd64.stderr.exp \
more_x87_fp.stderr.exp more_x87_fp.stdout.exp more_x87_fp.vgtest \
+ pmovmskb64.stderr.exp pmovmskb64.stdout.exp pmovmskb64.vgtest \
sse_memory.stderr.exp sse_memory.stdout.exp sse_memory.vgtest \
xor-undef-amd64.stderr.exp xor-undef-amd64.stdout.exp \
xor-undef-amd64.vgtest
-check_PROGRAMS = bt_everything bug132146 fxsave-amd64 \
- xor-undef-amd64
+check_PROGRAMS = \
+ bt_everything \
+ bug132146 \
+ fxsave-amd64 \
+ pmovmskb64 \
+ xor-undef-amd64
# DDD: not sure if these ones should work on Darwin or not... if not, should
# be moved into amd64-linux/.
Added: branches/ICC111/memcheck/tests/amd64/pmovmskb64.c
===================================================================
--- branches/ICC111/memcheck/tests/amd64/pmovmskb64.c (rev 0)
+++ branches/ICC111/memcheck/tests/amd64/pmovmskb64.c 2009-10-09 00:04:51 UTC (rev 10899)
@@ -0,0 +1,96 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "tests/malloc.h"
+#include <string.h>
+
+typedef unsigned char V128[16];
+typedef unsigned char V64[8];
+typedef unsigned int UInt;
+typedef signed int Int;
+typedef unsigned char UChar;
+typedef unsigned long long int ULong;
+
+static UChar randUChar ( void )
+{
+ static UInt seed = 80021;
+ seed = 1103515245 * seed + 12345;
+ return (seed >> 17) & 0xFF;
+}
+
+static void randV128 ( V128* v )
+{
+ Int i;
+ for (i = 0; i < 16; i++)
+ (*v)[i] = randUChar();
+}
+
+static void randV64 ( V64* v )
+{
+ Int i;
+ for (i = 0; i < 8; i++)
+ (*v)[i] = randUChar();
+}
+
+static void showV128 ( V128* v )
+{
+ Int i;
+ for (i = 0; i < 16; i++)
+ printf("%02x", (Int)(*v)[i]);
+}
+
+static void showV64 ( V64* v )
+{
+ Int i;
+ for (i = 0; i < 8; i++)
+ printf("%02x", (Int)(*v)[i]);
+}
+
+ULong do_pmovmskb_xmm_r64 ( V128* arg )
+{
+ ULong res;
+ __asm__ __volatile__(
+ "movupd (%1), %%xmm11" "\n\t"
+ "pmovmskb %%xmm11, %%r15" "\n\t"
+ "movq %%r15, %0" "\n"
+ : /*out*/ "=r"(res) : /*in*/ "r"(arg)
+ : /*trash*/"memory","xmm1","r15"
+ );
+ return res;
+}
+
+ULong do_pmovmskb_mmx_r64 ( V64* arg )
+{
+ ULong res;
+ __asm__ __volatile__(
+ "movq (%1), %%mm1" "\n\t"
+ "pmovmskb %%mm1, %0" "\n"
+ : /*out*/ "=r"(res) : /*in*/ "r"(arg)
+ : /*trash*/"memory","mm1"
+ );
+ return res;
+}
+
+int main ( void )
+{
+ V128 argL;
+ V64 argS;
+ UInt res, i;
+ UChar* undef = malloc(1);
+ for (i = 0; i < 10; i++) {
+ randV128( &argL );
+ //if (i == 9) argL[5] = *undef;
+ res = do_pmovmskb_xmm_r64( &argL );
+ showV128( &argL );
+ printf(" %08x\n", res );
+ }
+ for (i = 0; i < 10; i++) {
+ randV64( &argS );
+ res = do_pmovmskb_mmx_r64( &argS );
+ showV64( &argS );
+ printf(" %08x\n", res );
+ }
+ free(undef);
+ return 0;
+}
Added: branches/ICC111/memcheck/tests/amd64/pmovmskb64.stderr.exp
===================================================================
Added: branches/ICC111/memcheck/tests/amd64/pmovmskb64.stdout.exp
===================================================================
--- branches/ICC111/memcheck/tests/amd64/pmovmskb64.stdout.exp (rev 0)
+++ branches/ICC111/memcheck/tests/amd64/pmovmskb64.stdout.exp 2009-10-09 00:04:51 UTC (rev 10899)
@@ -0,0 +1,20 @@
+00571784494af2981ecac9199de37551 000036c8
+3bd127afa6e9c3690d6a95fac528657d 00001c7a
+501eefeec0d8b84784c4457d8560b160 0000537c
+b244a056e51599fe2751bca75afbd2b6 0000ecd5
+382dccdbc2829139fd673a5c2148a319 0000417c
+179e655064dc2a846b3e625d19775d06 000000a2
+e540bc6839c44b4a36ed3550df9899d8 0000f225
+979b83b70eb840d7856c13b8709950cb 0000a9af
+8315cab0121ab056db93c0f8294addf9 0000cf4d
+5df605a7d127a7d31f195c53c95bf85f 000050da
+3d6603cf39008e39 00000048
+979569ee6d5cbcd8 000000cb
+966cf73d98a42d54 00000035
+e87fc9cb92bba120 0000007d
+40ef72e29bf3afcf 000000fa
+172ebcce16c982d1 000000ec
+6eb865944fab9d36 0000006a
+8adae4bb36b59768 0000006f
+b76e2305226ee0f4 000000c1
+069b4435908d7b40 00000032
Added: branches/ICC111/memcheck/tests/amd64/pmovmskb64.vgtest
===================================================================
--- branches/ICC111/memcheck/tests/amd64/pmovmskb64.vgtest (rev 0)
+++ branches/ICC111/memcheck/tests/amd64/pmovmskb64.vgtest 2009-10-09 00:04:51 UTC (rev 10899)
@@ -0,0 +1,2 @@
+prog: pmovmskb64
+vgopts: -q
Modified: branches/ICC111/memcheck/tests/x86/Makefile.am
===================================================================
--- branches/ICC111/memcheck/tests/x86/Makefile.am 2009-10-08 17:26:07 UTC (rev 10898)
+++ branches/ICC111/memcheck/tests/x86/Makefile.am 2009-10-09 00:04:51 UTC (rev 10899)
@@ -20,6 +20,7 @@
sse2_memory.stderr.exp sse2_memory.stdout.exp sse2_memory.vgtest \
tronical.stderr.exp tronical.vgtest \
more_x86_fp.stderr.exp more_x86_fp.stdout.exp more_x86_fp.vgtest \
+ pmovmskb32.stderr.exp pmovmskb32.stdout.exp pmovmskb32.vgtest \
fprem.stderr.exp fprem.stdout.exp fprem.vgtest \
xor-undef-x86.stderr.exp xor-undef-x86.stdout.exp \
xor-undef-x86.vgtest
@@ -31,6 +32,7 @@
fprem \
fxsave \
more_x86_fp \
+ pmovmskb32 \
pushfpopf \
pushfw_x86 \
pushpopmem \
Added: branches/ICC111/memcheck/tests/x86/pmovmskb32.c
===================================================================
--- branches/ICC111/memcheck/tests/x86/pmovmskb32.c (rev 0)
+++ branches/ICC111/memcheck/tests/x86/pmovmskb32.c 2009-10-09 00:04:51 UTC (rev 10899)
@@ -0,0 +1,94 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "tests/malloc.h"
+#include <string.h>
+
+typedef unsigned char V128[16];
+typedef unsigned char V64[8];
+typedef unsigned int UInt;
+typedef signed int Int;
+typedef unsigned char UChar;
+
+static UChar randUChar ( void )
+{
+ static UInt seed = 80021;
+ seed = 1103515245 * seed + 12345;
+ return (seed >> 17) & 0xFF;
+}
+
+static void randV128 ( V128* v )
+{
+ Int i;
+ for (i = 0; i < 16; i++)
+ (*v)[i] = randUChar();
+}
+
+static void randV64 ( V64* v )
+{
+ Int i;
+ for (i = 0; i < 8; i++)
+ (*v)[i] = randUChar();
+}
+
+static void showV128 ( V128* v )
+{
+ Int i;
+ for (i = 0; i < 16; i++)
+ printf("%02x", (Int)(*v)[i]);
+}
+
+static void showV64 ( V64* v )
+{
+ Int i;
+ for (i = 0; i < 8; i++)
+ printf("%02x", (Int)(*v)[i]);
+}
+
+UInt do_pmovmskb_xmm_r32 ( V128* arg )
+{
+ UInt res;
+ __asm__ __volatile__(
+ "movupd (%1), %%xmm1" "\n\t"
+ "pmovmskb %%xmm1, %0" "\n"
+ : /*out*/ "=r"(res) : /*in*/ "r"(arg)
+ : /*trash*/"memory","xmm1"
+ );
+ return res;
+}
+
+UInt do_pmovmskb_mmx_r32 ( V64* arg )
+{
+ UInt res;
+ __asm__ __volatile__(
+ "movq (%1), %%mm1" "\n\t"
+ "pmovmskb %%mm1, %0" "\n"
+ : /*out*/ "=r"(res) : /*in*/ "r"(arg)
+ : /*trash*/"memory","mm1"
+ );
+ return res;
+}
+
+int main ( void )
+{
+ V128 argL;
+ V64 argS;
+ UInt res, i;
+ UChar* undef = malloc(1);
+ for (i = 0; i < 10; i++) {
+ randV128( &argL );
+ //if (i == 9) argL[5] = *undef;
+ res = do_pmovmskb_xmm_r32( &argL );
+ showV128( &argL );
+ printf(" %08x\n", res );
+ }
+ for (i = 0; i < 10; i++) {
+ randV64( &argS );
+ res = do_pmovmskb_mmx_r32( &argS );
+ showV64( &argS );
+ printf(" %08x\n", res );
+ }
+ free(undef);
+ return 0;
+}
Added: branches/ICC111/memcheck/tests/x86/pmovmskb32.stderr.exp
===================================================================
Added: branches/ICC111/memcheck/tests/x86/pmovmskb32.stdout.exp
===================================================================
--- branches/ICC111/memcheck/tests/x86/pmovmskb32.stdout.exp (rev 0)
+++ branches/ICC111/memcheck/tests/x86/pmovmskb32.stdout.exp 2009-10-09 00:04:51 UTC (rev 10899)
@@ -0,0 +1,20 @@
+00571784494af2981ecac9199de37551 000036c8
+3bd127afa6e9c3690d6a95fac528657d 00001c7a
+501eefeec0d8b84784c4457d8560b160 0000537c
+b244a056e51599fe2751bca75afbd2b6 0000ecd5
+382dccdbc2829139fd673a5c2148a319 0000417c
+179e655064dc2a846b3e625d19775d06 000000a2
+e540bc6839c44b4a36ed3550df9899d8 0000f225
+979b83b70eb840d7856c13b8709950cb 0000a9af
+8315cab0121ab056db93c0f8294addf9 0000cf4d
+5df605a7d127a7d31f195c53c95bf85f 000050da
+3d6603cf39008e39 00000048
+979569ee6d5cbcd8 000000cb
+966cf73d98a42d54 00000035
+e87fc9cb92bba120 0000007d
+40ef72e29bf3afcf 000000fa
+172ebcce16c982d1 000000ec
+6eb865944fab9d36 0000006a
+8adae4bb36b59768 0000006f
+b76e2305226ee0f4 000000c1
+069b4435908d7b40 00000032
Added: branches/ICC111/memcheck/tests/x86/pmovmskb32.vgtest
===================================================================
--- branches/ICC111/memcheck/tests/x86/pmovmskb32.vgtest (rev 0)
+++ branches/ICC111/memcheck/tests/x86/pmovmskb32.vgtest 2009-10-09 00:04:51 UTC (rev 10899)
@@ -0,0 +1,3 @@
+prog: pmovmskb32
+vgopts: -q
+prereq: ../../../tests/x86_amd64_features x86-sse2
|