mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 18:13:01 +00:00
Regtest for FXSAVE on amd64.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6499
This commit is contained in:
parent
46cf602633
commit
0e343fea86
@ -11,10 +11,11 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
|
||||
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
|
||||
|
||||
check_PROGRAMS = bt_everything bug132146 more_x87_fp sse_memory
|
||||
check_PROGRAMS = bt_everything bug132146 fxsave-amd64 more_x87_fp sse_memory
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include
|
||||
|
||||
79
memcheck/tests/amd64/fxsave-amd64.c
Normal file
79
memcheck/tests/amd64/fxsave-amd64.c
Normal file
@ -0,0 +1,79 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
const unsigned int vec0[4]
|
||||
= { 0x12345678, 0x11223344, 0x55667788, 0x87654321 };
|
||||
|
||||
const unsigned int vec1[4]
|
||||
= { 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 = 32; if (i == q || i == q+1) return 1;
|
||||
q = 48; if (i == q || i == q+1) return 1;
|
||||
q = 64; if (i == q || i == q+1) return 1;
|
||||
q = 80; if (i == q || i == q+1) return 1;
|
||||
q = 96; if (i == q || i == q+1) return 1;
|
||||
q = 112; if (i == q || i == q+1) return 1;
|
||||
q = 128; if (i == q || i == q+1) return 1;
|
||||
q = 144; if (i == q || i == q+1) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main ( int argc, char** argv )
|
||||
{
|
||||
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);
|
||||
if (xx && isFPLsbs(i))
|
||||
printf("xx ");
|
||||
else
|
||||
printf("%02x ", buf[i]);
|
||||
if (j > 0 && ((j % 16) == 15))
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
0
memcheck/tests/amd64/fxsave-amd64.stderr.exp
Normal file
0
memcheck/tests/amd64/fxsave-amd64.stderr.exp
Normal file
32
memcheck/tests/amd64/fxsave-amd64.stdout.exp
Normal file
32
memcheck/tests/amd64/fxsave-amd64.stdout.exp
Normal file
@ -0,0 +1,32 @@
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
2
memcheck/tests/amd64/fxsave-amd64.vgtest
Normal file
2
memcheck/tests/amd64/fxsave-amd64.vgtest
Normal file
@ -0,0 +1,2 @@
|
||||
prog: fxsave-amd64
|
||||
vgopts: -q
|
||||
Loading…
x
Reference in New Issue
Block a user