|
From: <sv...@va...> - 2007-01-10 04:57:29
|
Author: sewardj
Date: 2007-01-10 04:57:27 +0000 (Wed, 10 Jan 2007)
New Revision: 6499
Log:
Regtest for FXSAVE on amd64.
Added:
trunk/memcheck/tests/amd64/fxsave-amd64.c
trunk/memcheck/tests/amd64/fxsave-amd64.stderr.exp
trunk/memcheck/tests/amd64/fxsave-amd64.stdout.exp
trunk/memcheck/tests/amd64/fxsave-amd64.vgtest
Modified:
trunk/memcheck/tests/amd64/Makefile.am
Modified: trunk/memcheck/tests/amd64/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/amd64/Makefile.am 2007-01-09 20:41:41 UTC (rev 6=
498)
+++ trunk/memcheck/tests/amd64/Makefile.am 2007-01-10 04:57:27 UTC (rev 6=
499)
@@ -11,10 +11,11 @@
bt_everything.stderr.exp bt_everything.stdout.exp \
bt_everything.vgtest \
bug132146.vgtest bug132146.stderr.exp bug132146.stdout.exp \
+ fxsave-amd64.vgtest fxsave-amd64.stdout.exp fxsave-amd64.stderr.exp \
more_x87_fp.stderr.exp more_x87_fp.stdout.exp more_x87_fp.vgtest \
sse_memory.stderr.exp sse_memory.stdout.exp sse_memory.vgtest
=20
-check_PROGRAMS =3D bt_everything bug132146 more_x87_fp sse_memory
+check_PROGRAMS =3D bt_everything bug132146 fxsave-amd64 more_x87_fp sse_=
memory
=20
AM_CPPFLAGS =3D -I$(top_srcdir)/include
AM_CFLAGS =3D $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/inc=
lude
Added: trunk/memcheck/tests/amd64/fxsave-amd64.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/amd64/fxsave-amd64.c (re=
v 0)
+++ trunk/memcheck/tests/amd64/fxsave-amd64.c 2007-01-10 04:57:27 UTC (re=
v 6499)
@@ -0,0 +1,79 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+
+const unsigned int vec0[4]
+ =3D { 0x12345678, 0x11223344, 0x55667788, 0x87654321 };
+
+const unsigned int vec1[4]
+ =3D { 0xABCDEF01, 0xAABBCCDD, 0xEEFF0011, 0x10FEDCBA };
+
+/* set up the FP and SSE state, and then dump it. */
+void do_fxsave ( void* p )
+{
+ asm __volatile__("finit");
+ asm __volatile__("fldpi");
+ asm __volatile__("fld1");
+ asm __volatile__("fldln2");
+ asm __volatile__("fldlg2");
+ asm __volatile__("fld %st(3)");
+ asm __volatile__("fld %st(3)");
+ asm __volatile__("fld1");
+ asm __volatile__("movups (%0), %%xmm0" : : "r"(&vec0[0]) : "xmm0" );
+ asm __volatile__("movups (%0), %%xmm1" : : "r"(&vec1[0]) : "xmm1" );
+ asm __volatile__("xorps %xmm2, %xmm2");
+ asm __volatile__("movaps %xmm0, %xmm3");
+ asm __volatile__("movaps %xmm1, %xmm4");
+ asm __volatile__("movaps %xmm2, %xmm5");
+ asm __volatile__("movaps %xmm0, %xmm6");
+ asm __volatile__("movaps %xmm1, %xmm7");
+ asm __volatile__("movaps %xmm1, %xmm8");
+ asm __volatile__("movaps %xmm2, %xmm9");
+ asm __volatile__("movaps %xmm0, %xmm10");
+ asm __volatile__("movaps %xmm1, %xmm11");
+ asm __volatile__("movaps %xmm1, %xmm12");
+ asm __volatile__("movaps %xmm2, %xmm13");
+ asm __volatile__("movaps %xmm0, %xmm14");
+ asm __volatile__("movaps %xmm1, %xmm15");
+ asm __volatile__("fxsave (%0)" : : "r" (p) : "memory" );
+}
+
+int isFPLsbs ( int i )
+{
+ int q;
+ q =3D 32; if (i =3D=3D q || i =3D=3D q+1) return 1;
+ q =3D 48; if (i =3D=3D q || i =3D=3D q+1) return 1;
+ q =3D 64; if (i =3D=3D q || i =3D=3D q+1) return 1;
+ q =3D 80; if (i =3D=3D q || i =3D=3D q+1) return 1;
+ q =3D 96; if (i =3D=3D q || i =3D=3D q+1) return 1;
+ q =3D 112; if (i =3D=3D q || i =3D=3D q+1) return 1;
+ q =3D 128; if (i =3D=3D q || i =3D=3D q+1) return 1;
+ q =3D 144; if (i =3D=3D q || i =3D=3D q+1) return 1;
+ return 0;
+}
+
+int main ( int argc, char** argv )
+{
+ int i, j;
+ unsigned char* buf =3D malloc(512);
+ int xx =3D 1; /* argc > 1;
+ printf("Re-run with any arg to suppress least-significant\n"
+ " 16 bits of FP numbers\n");
+ */
+ for (i =3D 0; i < 512; i++)
+ buf[i] =3D 0x55;
+
+ do_fxsave(buf);
+ for (j =3D 0; j < 512; j++) {
+ i =3D (j & 0xFFF0) + (15 - (j & 0xF));
+ if ((j % 16) =3D=3D 0)
+ printf("%3d ", j);
+ if (xx && isFPLsbs(i))
+ printf("xx ");
+ else
+ printf("%02x ", buf[i]);
+ if (j > 0 && ((j % 16) =3D=3D 15))
+ printf("\n");
+ }
+ return 0;
+}
Added: trunk/memcheck/tests/amd64/fxsave-amd64.stderr.exp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Added: trunk/memcheck/tests/amd64/fxsave-amd64.stdout.exp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/amd64/fxsave-amd64.stdout.exp =
(rev 0)
+++ trunk/memcheck/tests/amd64/fxsave-amd64.stdout.exp 2007-01-10 04:57:2=
7 UTC (rev 6499)
@@ -0,0 +1,32 @@
+ 0 00 00 00 00 00 00 00 00 00 00 00 fe 08 00 03 7f=20
+ 16 00 00 ff ff 00 00 1f 80 00 00 00 00 00 00 00 00=20
+ 32 00 00 00 00 00 00 3f ff 80 00 00 00 00 00 xx xx=20
+ 48 00 00 00 00 00 00 3f ff 80 00 00 00 00 00 xx xx=20
+ 64 00 00 00 00 00 00 40 00 c9 0f da a2 21 68 xx xx=20
+ 80 00 00 00 00 00 00 3f fd 9a 20 9a 84 fb cf xx xx=20
+ 96 00 00 00 00 00 00 3f fe b1 72 17 f7 d1 cf xx xx=20
+112 00 00 00 00 00 00 3f ff 80 00 00 00 00 00 xx xx=20
+128 00 00 00 00 00 00 40 00 c9 0f da a2 21 68 xx xx=20
+144 00 00 00 00 00 00 00 00 00 00 00 00 00 00 xx xx=20
+160 87 65 43 21 55 66 77 88 11 22 33 44 12 34 56 78=20
+176 10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01=20
+192 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00=20
+208 87 65 43 21 55 66 77 88 11 22 33 44 12 34 56 78=20
+224 10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01=20
+240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00=20
+256 87 65 43 21 55 66 77 88 11 22 33 44 12 34 56 78=20
+272 10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01=20
+288 10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01=20
+304 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00=20
+320 87 65 43 21 55 66 77 88 11 22 33 44 12 34 56 78=20
+336 10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01=20
+352 10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01=20
+368 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00=20
+384 87 65 43 21 55 66 77 88 11 22 33 44 12 34 56 78=20
+400 10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01=20
+416 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55=20
+432 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55=20
+448 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55=20
+464 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55=20
+480 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55=20
+496 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55=20
Added: trunk/memcheck/tests/amd64/fxsave-amd64.vgtest
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/memcheck/tests/amd64/fxsave-amd64.vgtest =
(rev 0)
+++ trunk/memcheck/tests/amd64/fxsave-amd64.vgtest 2007-01-10 04:57:27 UT=
C (rev 6499)
@@ -0,0 +1,2 @@
+prog: fxsave-amd64
+vgopts: -q
|