]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Regression test for clc/stc/cmc on amd64.
authorJulian Seward <jseward@acm.org>
Fri, 12 May 2006 20:28:26 +0000 (20:28 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 12 May 2006 20:28:26 +0000 (20:28 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5893

none/tests/amd64/Makefile.am
none/tests/amd64/clc.c [new file with mode: 0644]
none/tests/amd64/clc.stderr.exp [new file with mode: 0644]
none/tests/amd64/clc.stdout.exp [new file with mode: 0644]
none/tests/amd64/clc.vgtest [new file with mode: 0644]

index e8cd4d8953ab8a5203f828592c3b9ebcc1d5f36f..151777bcff3d9576dd879af61c72d79d61afa52e 100644 (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
diff --git a/none/tests/amd64/clc.c b/none/tests/amd64/clc.c
new file mode 100644 (file)
index 0000000..fc3d1d8
--- /dev/null
@@ -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;
+}
diff --git a/none/tests/amd64/clc.stderr.exp b/none/tests/amd64/clc.stderr.exp
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/amd64/clc.stdout.exp b/none/tests/amd64/clc.stdout.exp
new file mode 100644 (file)
index 0000000..e43e984
--- /dev/null
@@ -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 (file)
index 0000000..bc2cea4
--- /dev/null
@@ -0,0 +1 @@
+prog: clc