From: Julian Seward Date: Fri, 12 May 2006 20:28:26 +0000 (+0000) Subject: Regression test for clc/stc/cmc on amd64. X-Git-Tag: svn/VALGRIND_3_2_0~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=931b079b9686ee5493a2d71232ac3d4e0adf6fbc;p=thirdparty%2Fvalgrind.git Regression test for clc/stc/cmc on amd64. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5893 --- diff --git a/none/tests/amd64/Makefile.am b/none/tests/amd64/Makefile.am index e8cd4d8953..151777bcff 100644 --- a/none/tests/amd64/Makefile.am +++ b/none/tests/amd64/Makefile.am @@ -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 diff --git a/none/tests/amd64/clc.c b/none/tests/amd64/clc.c new file mode 100644 index 0000000000..fc3d1d885d --- /dev/null +++ b/none/tests/amd64/clc.c @@ -0,0 +1,61 @@ + +#include + +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; +} diff --git a/none/tests/amd64/clc.stderr.exp b/none/tests/amd64/clc.stderr.exp new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/none/tests/amd64/clc.stderr.exp @@ -0,0 +1,2 @@ + + diff --git a/none/tests/amd64/clc.stdout.exp b/none/tests/amd64/clc.stdout.exp new file mode 100644 index 0000000000..e43e984d82 --- /dev/null +++ b/none/tests/amd64/clc.stdout.exp @@ -0,0 +1,3 @@ +clc: 0x00000000000008d4 +stc: 0x0000000000000001 +cmc: 0x0000000000000000 diff --git a/none/tests/amd64/clc.vgtest b/none/tests/amd64/clc.vgtest new file mode 100644 index 0000000000..bc2cea4014 --- /dev/null +++ b/none/tests/amd64/clc.vgtest @@ -0,0 +1 @@ +prog: clc