Regression test for clc/stc/cmc on amd64.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5893
This commit is contained in:
Julian Seward 2006-05-12 20:28:26 +00:00
parent 4950ba1806
commit 931b079b96
5 changed files with 69 additions and 0 deletions

View File

@ -5,6 +5,7 @@ CLEANFILES = $(addsuffix .c,$(INSN_TESTS))
INSN_TESTS = insn_basic insn_mmx insn_sse insn_sse2 insn_fpu
EXTRA_DIST = $(noinst_SCRIPTS) \
clc.vgtest clc.stdout.exp clc.stderr.exp \
faultstatus.vgtest faultstatus.stderr.exp \
fcmovnu.vgtest fcmovnu.stderr.exp fcmovnu.stdout.exp \
fxtract.vgtest fxtract.stderr.exp fxtract.stdout.exp \
@ -18,6 +19,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
check_PROGRAMS = \
clc \
faultstatus fcmovnu fxtract $(INSN_TESTS) looper jrcxz smc1 shrld
AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include

61
none/tests/amd64/clc.c Normal file
View File

@ -0,0 +1,61 @@
#include <stdio.h>
typedef unsigned long long int ULong;
ULong do_clc ( void )
{
ULong res;
__asm__ __volatile__(
"pushq $0x8d5\n\t" /* OSZACP */
"popfq\n\t"
"clc\n\t"
"pushfq\n\t"
"popq %0"
: "=r"(res)
:
: "memory", "cc"
);
return res;
}
ULong do_stc ( void )
{
ULong res;
__asm__ __volatile__(
"pushq $0x0\n\t"
"popfq\n\t"
"stc\n\t"
"pushfq\n\t"
"popq %0"
: "=r"(res)
:
: "memory", "cc"
);
return res;
}
ULong do_cmc ( void )
{
ULong res;
__asm__ __volatile__(
"pushq $0x0\n\t"
"popfq\n\t"
"stc\n\t"
"cmc\n\t"
"pushfq\n\t"
"popq %0"
: "=r"(res)
:
: "memory", "cc"
);
return res;
}
int main ( void )
{
printf("clc: 0x%016llx\n", 0x8d5 & do_clc());
printf("stc: 0x%016llx\n", 0x8d5 & do_stc());
printf("cmc: 0x%016llx\n", 0x8d5 & do_cmc());
return 0;
}

View File

@ -0,0 +1,2 @@

View File

@ -0,0 +1,3 @@
clc: 0x00000000000008d4
stc: 0x0000000000000001
cmc: 0x0000000000000000

View File

@ -0,0 +1 @@
prog: clc