Expand this test so as to cover FXSAVE and FXRSTOR, both REX.W and
non-REX.W variants.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11506 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/memcheck/tests/amd64/fxsave-amd64.c b/memcheck/tests/amd64/fxsave-amd64.c
index b83efe8..c3fe211 100644
--- a/memcheck/tests/amd64/fxsave-amd64.c
+++ b/memcheck/tests/amd64/fxsave-amd64.c
@@ -1,6 +1,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include "tests/asm.h"
+#include "tests/malloc.h"
+#include <string.h>
 
 const unsigned int vec0[4]
    = { 0x12345678, 0x11223344, 0x55667788, 0x87654321 };
@@ -8,8 +11,64 @@
 const unsigned int vec1[4]
    = { 0xABCDEF01, 0xAABBCCDD, 0xEEFF0011, 0x10FEDCBA };
 
+const unsigned int vecZ[4]
+   = { 0, 0, 0, 0 };
+
+__attribute__((noinline))
+void do_fxsave ( void* p, int rexw ) {
+   if (rexw) {
+      asm __volatile__("rex64/fxsave (%0)" : : "r" (p) : "memory" );
+   } else {
+      asm __volatile__("fxsave (%0)" : : "r" (p) : "memory" );
+   }
+}
+
+__attribute__((noinline))
+void do_fxrstor ( void* p, int rexw ) {
+   if (rexw) {
+      asm __volatile__("rex64/fxrstor (%0)" : : "r" (p) : "memory" );
+   } else {
+      asm __volatile__("fxrstor (%0)" : : "r" (p) : "memory" );
+   }
+}
+
+void do_zeroise ( void )
+{
+   asm __volatile__("finit");
+   asm __volatile__(
+    "fldz\n\t"
+    "fldz\n\t"
+    "fldz\n\t"
+    "fldz\n\t"
+    "fldz\n\t"
+    "fldz\n\t"
+    "fldz\n\t"
+    "fldz\n\t"
+    "finit\n");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm0");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm1");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm2");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm3");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm4");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm5");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm6");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm7");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm8");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm9");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm10");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm11");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm12");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm13");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm14");
+   asm __volatile__("movups " VG_SYM(vecZ) ", %xmm15");
+   asm __volatile__(
+      "pushq $0\n\t"
+      "ldmxcsr 0(%rsp)\n\t"
+      "addq $8,%rsp\n");
+}
+
 /* set up the FP and SSE state, and then dump it. */
-void do_fxsave ( void* p )
+void do_setup_then_fxsave ( void* p, int rexw )
 {
    asm __volatile__("finit");
    asm __volatile__("fldpi");
@@ -35,7 +94,7 @@
    asm __volatile__("movaps %xmm2, %xmm13");
    asm __volatile__("movaps %xmm0, %xmm14");
    asm __volatile__("movaps %xmm1, %xmm15");
-   asm __volatile__("fxsave (%0)" : : "r" (p) : "memory" );
+   do_fxsave(p, rexw);
 }
 
 int isFPLsbs ( int i )
@@ -52,28 +111,81 @@
    return 0;
 }
 
-int main ( int argc, char** argv )
+void show ( unsigned char* buf, int xx )
 {
-   int i, j;
-   unsigned char* buf = malloc(512);
-   int xx = 1; /* argc > 1;
-   printf("Re-run with any arg to suppress least-significant\n"
-          "   16 bits of FP numbers\n");
-	       */
-   for (i = 0; i < 512; i++)
-      buf[i] = 0x55;
-
-   do_fxsave(buf);
-   for (j = 0; j < 512; j++) {
-      i = (j & 0xFFF0) + (15 - (j & 0xF));
-      if ((j % 16) == 0)
-         printf("%3d   ", j);
+   int i;
+   for (i = 0; i < 512; i++) {
+      if ((i % 16) == 0)
+         printf("%3d   ", i);
       if (xx && isFPLsbs(i))
 	 printf("xx ");
       else
          printf("%02x ", buf[i]);
-      if (j > 0 && ((j % 16) == 15))
+      if (i > 0 && ((i % 16) == 15))
           printf("\n");
    }
+}
+
+
+int main ( int argc, char** argv )
+{
+   unsigned char* buf1 = memalign16(512);
+   unsigned char* buf2 = memalign16(512);
+   unsigned char* buf3 = memalign16(512);
+   int xx = argc > 1;
+   printf("Re-run with any arg to suppress least-significant\n"
+          "   16 bits of FP numbers\n");
+
+   printf("\n-------- FXSAVE non-64 (REX.W == 0) --------\n");
+
+   memset(buf1, 0x55, 512);
+   memset(buf2, 0x55, 512);
+   memset(buf3, 0x55, 512);
+
+   /* Load up x87/xmm state and dump it. */
+   do_setup_then_fxsave(buf1, 0);
+   printf("\nBEFORE\n");
+   show(buf1, xx);
+
+   /* Zeroise x87/xmm state and dump it, to show that the
+      regs have been cleared out. */
+   do_zeroise();
+   do_fxsave(buf2, 0);
+   printf("\nZEROED\n");
+   show(buf2, xx);
+
+   /* Reload x87/xmm state from buf1 and dump it in buf3. */
+   do_fxrstor(buf1, 0);
+   do_fxsave(buf3, 0);
+   printf("\nRESTORED\n");
+   show(buf3, xx);
+
+   printf("\n-------- FXSAVE 64 (REX.W == 1) --------\n\n");
+
+   memset(buf1, 0x55, 512);
+   memset(buf2, 0x55, 512);
+   memset(buf3, 0x55, 512);
+
+   /* Load up x87/xmm state and dump it. */
+   do_setup_then_fxsave(buf1, 1);
+   printf("\nBEFORE\n");
+   show(buf1, xx);
+
+   /* Zeroise x87/xmm state and dump it, to show that the
+      regs have been cleared out. */
+   do_zeroise();
+   do_fxsave(buf2, 1);
+   printf("\nZEROED\n");
+   show(buf2, xx);
+
+   /* Reload x87/xmm state from buf1 and dump it in buf3. */
+   do_fxrstor(buf1, 1);
+   do_fxsave(buf3, 1);
+   printf("\nRESTORED\n");
+   show(buf3, xx);
+
+
+   free(buf1); free(buf2); free(buf3);
+
    return 0;
 }
diff --git a/memcheck/tests/amd64/fxsave-amd64.stdout.exp b/memcheck/tests/amd64/fxsave-amd64.stdout.exp
index 1796d5b..adc0d5a 100644
--- a/memcheck/tests/amd64/fxsave-amd64.stdout.exp
+++ b/memcheck/tests/amd64/fxsave-amd64.stdout.exp
@@ -1,29 +1,208 @@
-  0   00 00 00 00 00 00 00 00 00 00 00 fe 08 00 03 7f 
- 16   00 00 ff ff 00 00 1f 80 00 00 00 00 00 00 00 00 
- 32   00 00 00 00 00 00 3f ff 80 00 00 00 00 00 xx xx 
- 48   00 00 00 00 00 00 3f ff 80 00 00 00 00 00 xx xx 
- 64   00 00 00 00 00 00 40 00 c9 0f da a2 21 68 xx xx 
- 80   00 00 00 00 00 00 3f fd 9a 20 9a 84 fb cf xx xx 
- 96   00 00 00 00 00 00 3f fe b1 72 17 f7 d1 cf xx xx 
-112   00 00 00 00 00 00 3f ff 80 00 00 00 00 00 xx xx 
-128   00 00 00 00 00 00 40 00 c9 0f da a2 21 68 xx xx 
-144   00 00 00 00 00 00 00 00 00 00 00 00 00 00 xx xx 
-160   87 65 43 21 55 66 77 88 11 22 33 44 12 34 56 78 
-176   10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01 
+Re-run with any arg to suppress least-significant
+   16 bits of FP numbers
+
+-------- FXSAVE non-64 (REX.W == 0) --------
+
+BEFORE
+  0   7f 03 00 08 fe 00 00 00 00 00 00 00 00 00 00 00 
+ 16   00 00 00 00 00 00 00 00 80 1f 00 00 ff ff 00 00 
+ 32   xx xx 00 00 00 00 00 80 ff 3f 00 00 00 00 00 00 
+ 48   xx xx 00 00 00 00 00 80 ff 3f 00 00 00 00 00 00 
+ 64   xx xx 68 21 a2 da 0f c9 00 40 00 00 00 00 00 00 
+ 80   xx xx cf fb 84 9a 20 9a fd 3f 00 00 00 00 00 00 
+ 96   xx xx cf d1 f7 17 72 b1 fe 3f 00 00 00 00 00 00 
+112   xx xx 00 00 00 00 00 80 ff 3f 00 00 00 00 00 00 
+128   xx xx 68 21 a2 da 0f c9 00 40 00 00 00 00 00 00 
+144   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+160   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+176   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
 192   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
-208   87 65 43 21 55 66 77 88 11 22 33 44 12 34 56 78 
-224   10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01 
+208   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+224   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
 240   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
-256   87 65 43 21 55 66 77 88 11 22 33 44 12 34 56 78 
-272   10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01 
-288   10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01 
+256   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+272   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+288   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
 304   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
-320   87 65 43 21 55 66 77 88 11 22 33 44 12 34 56 78 
-336   10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01 
-352   10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01 
+320   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+336   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+352   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
 368   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
-384   87 65 43 21 55 66 77 88 11 22 33 44 12 34 56 78 
-400   10 fe dc ba ee ff 00 11 aa bb cc dd ab cd ef 01 
+384   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+400   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+416   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+432   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+448   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+464   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+480   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+496   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+
+ZEROED
+  0   7f 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+ 16   00 00 00 00 00 00 00 00 80 1f 00 00 ff ff 00 00 
+ 32   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+ 48   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+ 64   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+ 80   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+ 96   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+112   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+128   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+144   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+160   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+176   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+192   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+208   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+224   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+240   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+256   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+272   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+288   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+304   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+320   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+336   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+352   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+368   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+384   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+400   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+416   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+432   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+448   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+464   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+480   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+496   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+
+RESTORED
+  0   7f 03 00 08 fe 00 00 00 00 00 00 00 00 00 00 00 
+ 16   00 00 00 00 00 00 00 00 80 1f 00 00 ff ff 00 00 
+ 32   xx xx 00 00 00 00 00 80 ff 3f 00 00 00 00 00 00 
+ 48   xx xx 00 00 00 00 00 80 ff 3f 00 00 00 00 00 00 
+ 64   xx xx 68 21 a2 da 0f c9 00 40 00 00 00 00 00 00 
+ 80   xx xx cf fb 84 9a 20 9a fd 3f 00 00 00 00 00 00 
+ 96   xx xx cf d1 f7 17 72 b1 fe 3f 00 00 00 00 00 00 
+112   xx xx 00 00 00 00 00 80 ff 3f 00 00 00 00 00 00 
+128   xx xx 68 21 a2 da 0f c9 00 40 00 00 00 00 00 00 
+144   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+160   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+176   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+192   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+208   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+224   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+240   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+256   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+272   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+288   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+304   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+320   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+336   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+352   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+368   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+384   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+400   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+416   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+432   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+448   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+464   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+480   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+496   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+
+-------- FXSAVE 64 (REX.W == 1) --------
+
+
+BEFORE
+  0   7f 03 00 08 fe 00 00 00 00 00 00 00 00 00 00 00 
+ 16   00 00 00 00 00 00 00 00 80 1f 00 00 ff ff 00 00 
+ 32   xx xx 00 00 00 00 00 80 ff 3f 00 00 00 00 00 00 
+ 48   xx xx 00 00 00 00 00 80 ff 3f 00 00 00 00 00 00 
+ 64   xx xx 68 21 a2 da 0f c9 00 40 00 00 00 00 00 00 
+ 80   xx xx cf fb 84 9a 20 9a fd 3f 00 00 00 00 00 00 
+ 96   xx xx cf d1 f7 17 72 b1 fe 3f 00 00 00 00 00 00 
+112   xx xx 00 00 00 00 00 80 ff 3f 00 00 00 00 00 00 
+128   xx xx 68 21 a2 da 0f c9 00 40 00 00 00 00 00 00 
+144   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+160   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+176   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+192   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+208   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+224   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+240   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+256   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+272   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+288   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+304   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+320   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+336   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+352   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+368   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+384   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+400   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+416   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+432   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+448   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+464   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+480   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+496   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+
+ZEROED
+  0   7f 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+ 16   00 00 00 00 00 00 00 00 80 1f 00 00 ff ff 00 00 
+ 32   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+ 48   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+ 64   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+ 80   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+ 96   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+112   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+128   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+144   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+160   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+176   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+192   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+208   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+224   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+240   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+256   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+272   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+288   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+304   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+320   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+336   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+352   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+368   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+384   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+400   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+416   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+432   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+448   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+464   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+480   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+496   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
+
+RESTORED
+  0   7f 03 00 08 fe 00 00 00 00 00 00 00 00 00 00 00 
+ 16   00 00 00 00 00 00 00 00 80 1f 00 00 ff ff 00 00 
+ 32   xx xx 00 00 00 00 00 80 ff 3f 00 00 00 00 00 00 
+ 48   xx xx 00 00 00 00 00 80 ff 3f 00 00 00 00 00 00 
+ 64   xx xx 68 21 a2 da 0f c9 00 40 00 00 00 00 00 00 
+ 80   xx xx cf fb 84 9a 20 9a fd 3f 00 00 00 00 00 00 
+ 96   xx xx cf d1 f7 17 72 b1 fe 3f 00 00 00 00 00 00 
+112   xx xx 00 00 00 00 00 80 ff 3f 00 00 00 00 00 00 
+128   xx xx 68 21 a2 da 0f c9 00 40 00 00 00 00 00 00 
+144   xx xx 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+160   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+176   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+192   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+208   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+224   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+240   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+256   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+272   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+288   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+304   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+320   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+336   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+352   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
+368   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+384   78 56 34 12 44 33 22 11 88 77 66 55 21 43 65 87 
+400   01 ef cd ab dd cc bb aa 11 00 ff ee ba dc fe 10 
 416   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
 432   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
 448   55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 
diff --git a/memcheck/tests/amd64/fxsave-amd64.vgtest b/memcheck/tests/amd64/fxsave-amd64.vgtest
index 19f13f0..3daf525 100644
--- a/memcheck/tests/amd64/fxsave-amd64.vgtest
+++ b/memcheck/tests/amd64/fxsave-amd64.vgtest
@@ -1,2 +1,3 @@
 prog: fxsave-amd64
 vgopts: -q
+args: x