]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Tests for the mov{z,s}{bw,bl,wl} instructions.
authorJulian Seward <jseward@acm.org>
Wed, 3 May 2006 18:09:41 +0000 (18:09 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 3 May 2006 18:09:41 +0000 (18:09 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5879

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

index 5847cdadf7bcbb4e6668ec31ff6488c6dbcb3a43..945a441fe60ef90a3fae690e08bec18db4adeb79 100644 (file)
@@ -22,6 +22,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
        $(addsuffix .vgtest,$(INSN_TESTS)) \
        lahf.stdout.exp lahf.stderr.exp lahf.vgtest \
        looper.stderr.exp looper.stdout.exp looper.vgtest \
+       movx.stderr.exp movx.stdout.exp movx.vgtest \
        pushpopseg.stderr.exp pushpopseg.stdout.exp pushpopseg.vgtest \
        sbbmisc.stderr.exp sbbmisc.stdout.exp sbbmisc.vgtest \
        seg_override.stderr.exp seg_override.stdout.exp seg_override.vgtest \
@@ -33,7 +34,7 @@ check_PROGRAMS = \
        badseg bt_everything bt_literal cmpxchg8b cpuid \
        faultstatus fcmovnu fpu_lazy_eflags fxtract \
        getseg incdec_alt $(INSN_TESTS) \
-       lahf looper int pushpopseg sbbmisc \
+       lahf looper movx int pushpopseg sbbmisc \
        seg_override sigcontext smc1 yield
 
 AM_CFLAGS    = $(WERROR) -Winline -Wall -Wshadow \
diff --git a/none/tests/x86/movx.c b/none/tests/x86/movx.c
new file mode 100644 (file)
index 0000000..fc60cfc
--- /dev/null
@@ -0,0 +1,177 @@
+
+#include <stdio.h>
+
+static int movzbw_1 ( void )
+{
+   int res;
+   __asm__ __volatile__(
+      "movl $0x12345678, %%eax\n\t"
+      "movb $0x22, %%al\n\t"
+      "movzbw %%al,%%ax\n\t"
+      "mov %%eax, %0"
+      : "=r"(res) : : "eax"
+   );
+   return res;
+}
+
+static int movzbw_2 ( void )
+{
+   int res;
+   __asm__ __volatile__(
+      "movl $0x12345678, %%eax\n\t"
+      "movb $0x99, %%al\n\t"
+      "movzbw %%al,%%ax\n\t"
+      "mov %%eax, %0"
+      : "=r"(res) : : "eax"
+   );
+   return res;
+}
+
+static int movzbl_1 ( void )
+{
+   int res;
+   __asm__ __volatile__(
+      "movl $0x12345678, %%eax\n\t"
+      "movb $0x22, %%al\n\t"
+      "movzbl %%al,%%eax\n\t"
+      "mov %%eax, %0"
+      : "=r"(res) : : "eax"
+   );
+   return res;
+}
+
+static int movzbl_2 ( void )
+{
+   int res;
+   __asm__ __volatile__(
+      "movl $0x12345678, %%eax\n\t"
+      "movb $0x99, %%al\n\t"
+      "movzbl %%al,%%eax\n\t"
+      "mov %%eax, %0"
+      : "=r"(res) : : "eax"
+   );
+   return res;
+}
+
+static int movzwl_1 ( void )
+{
+   int res;
+   __asm__ __volatile__(
+      "movl $0x12345678, %%eax\n\t"
+      "movw $0x2222, %%ax\n\t"
+      "movzwl %%ax,%%eax\n\t"
+      "mov %%eax, %0"
+      : "=r"(res) : : "eax"
+   );
+   return res;
+}
+
+static int movzwl_2 ( void )
+{
+   int res;
+   __asm__ __volatile__(
+      "movl $0x12345678, %%eax\n\t"
+      "movw $0x9999, %%ax\n\t"
+      "movzwl %%ax,%%eax\n\t"
+      "mov %%eax, %0"
+      : "=r"(res) : : "eax"
+   );
+   return res;
+}
+
+static int movsbw_1 ( void )
+{
+   int res;
+   __asm__ __volatile__(
+      "movl $0x12345678, %%eax\n\t"
+      "movb $0x22, %%al\n\t"
+      "movsbw %%al,%%ax\n\t"
+      "mov %%eax, %0"
+      : "=r"(res) : : "eax"
+   );
+   return res;
+}
+
+static int movsbw_2 ( void )
+{
+   int res;
+   __asm__ __volatile__(
+      "movl $0x12345678, %%eax\n\t"
+      "movb $0x99, %%al\n\t"
+      "movsbw %%al,%%ax\n\t"
+      "mov %%eax, %0"
+      : "=r"(res) : : "eax"
+   );
+   return res;
+}
+
+static int movsbl_1 ( void )
+{
+   int res;
+   __asm__ __volatile__(
+      "movl $0x12345678, %%eax\n\t"
+      "movb $0x22, %%al\n\t"
+      "movsbl %%al,%%eax\n\t"
+      "mov %%eax, %0"
+      : "=r"(res) : : "eax"
+   );
+   return res;
+}
+
+static int movsbl_2 ( void )
+{
+   int res;
+   __asm__ __volatile__(
+      "movl $0x12345678, %%eax\n\t"
+      "movb $0x99, %%al\n\t"
+      "movsbl %%al,%%eax\n\t"
+      "mov %%eax, %0"
+      : "=r"(res) : : "eax"
+   );
+   return res;
+}
+
+static int movswl_1 ( void )
+{
+   int res;
+   __asm__ __volatile__(
+      "movl $0x12345678, %%eax\n\t"
+      "movw $0x2222, %%ax\n\t"
+      "movswl %%ax,%%eax\n\t"
+      "mov %%eax, %0"
+      : "=r"(res) : : "eax"
+   );
+   return res;
+}
+
+static int movswl_2 ( void )
+{
+   int res;
+   __asm__ __volatile__(
+      "movl $0x12345678, %%eax\n\t"
+      "movw $0x9999, %%ax\n\t"
+      "movswl %%ax,%%eax\n\t"
+      "mov %%eax, %0"
+      : "=r"(res) : : "eax"
+   );
+   return res;
+}
+
+
+
+int main ( void )
+{
+   printf("%8s 0x%08x\n", "movzbw_1", movzbw_1());
+   printf("%8s 0x%08x\n", "movzbw_2", movzbw_2());
+   printf("%8s 0x%08x\n", "movzbl_1", movzbl_1());
+   printf("%8s 0x%08x\n", "movzbl_2", movzbl_2());
+   printf("%8s 0x%08x\n", "movzwl_1", movzwl_1());
+   printf("%8s 0x%08x\n", "movzwl_2", movzwl_2());
+   printf("%8s 0x%08x\n", "movsbw_1", movsbw_1());
+   printf("%8s 0x%08x\n", "movsbw_2", movsbw_2());
+   printf("%8s 0x%08x\n", "movsbl_1", movsbl_1());
+   printf("%8s 0x%08x\n", "movsbl_2", movsbl_2());
+   printf("%8s 0x%08x\n", "movswl_1", movswl_1());
+   printf("%8s 0x%08x\n", "movswl_2", movswl_2());
+   return 0;
+}
diff --git a/none/tests/x86/movx.stderr.exp b/none/tests/x86/movx.stderr.exp
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/x86/movx.stdout.exp b/none/tests/x86/movx.stdout.exp
new file mode 100644 (file)
index 0000000..620cfe2
--- /dev/null
@@ -0,0 +1,12 @@
+movzbw_1 0x12340022
+movzbw_2 0x12340099
+movzbl_1 0x00000022
+movzbl_2 0x00000099
+movzwl_1 0x00002222
+movzwl_2 0x00009999
+movsbw_1 0x12340022
+movsbw_2 0x1234ff99
+movsbl_1 0x00000022
+movsbl_2 0xffffff99
+movswl_1 0x00002222
+movswl_2 0xffff9999
diff --git a/none/tests/x86/movx.vgtest b/none/tests/x86/movx.vgtest
new file mode 100644 (file)
index 0000000..2e1c8f9
--- /dev/null
@@ -0,0 +1 @@
+prog: movx