]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Test misc sbb/adc insns.
authorJulian Seward <jseward@acm.org>
Mon, 3 Oct 2005 02:23:17 +0000 (02:23 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 3 Oct 2005 02:23:17 +0000 (02:23 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4848

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

index 49f18778916b3947c9c660e17df787aa8f6f0900..3ef6eb198f70370e23902d7fbc98577cf654d89b 100644 (file)
@@ -19,6 +19,7 @@ EXTRA_DIST = $(noinst_SCRIPTS) \
        $(addsuffix .vgtest,$(INSN_TESTS)) \
        looper.stderr.exp looper.stdout.exp looper.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 \
        sigcontext.stdout.exp sigcontext.stderr.exp sigcontext.vgtest \
        smc1.stderr.exp smc1.stdout.exp smc1.vgtest \
@@ -28,7 +29,8 @@ check_PROGRAMS = \
        badseg bt_everything bt_literal cmpxchg8b cpuid fpu_lazy_eflags \
        fxtract \
        getseg $(INSN_TESTS) \
-       looper int pushpopseg seg_override sigcontext smc1 yield
+       looper int pushpopseg sbbmisc \
+       seg_override sigcontext smc1 yield
 
 AM_CFLAGS   = $(WERROR) -Winline -Wall -Wshadow \
                -g -I$(top_srcdir)/include \
diff --git a/none/tests/x86/sbbmisc.c b/none/tests/x86/sbbmisc.c
new file mode 100644 (file)
index 0000000..48c2052
--- /dev/null
@@ -0,0 +1,181 @@
+
+#include <stdio.h>
+
+char in_b, out_b1, out_b2, in_b2;
+
+short in_w, out_w1, out_w2;
+
+int in_l, out_l1, out_l2;
+
+extern void sbb_ib_al ( void );
+asm("\n"
+"sbb_ib_al:\n"
+
+"\tmovb in_b, %al\n"
+"\tclc\n"
+"\tsbbb $5, %al\n"
+"\tmovb %al, out_b1\n"
+
+"\tmovb in_b, %al\n"
+"\tstc\n"
+"\tsbbb $5, %al\n"
+"\tmovb %al, out_b2\n"
+
+"\tret\n"
+);
+
+
+extern void sbb_iw_ax ( void );
+asm("\n"
+"sbb_iw_ax:\n"
+
+"\tmovw in_w, %ax\n"
+"\tclc\n"
+"\tsbbw $555, %ax\n"
+"\tmovw %ax, out_w1\n"
+
+"\tmovw in_w, %ax\n"
+"\tstc\n"
+"\tsbbw $555, %ax\n"
+"\tmovw %ax, out_w2\n"
+
+"\tret\n"
+);
+
+
+extern void sbb_il_eax ( void );
+asm("\n"
+"sbb_il_eax:\n"
+
+"\tmovl in_l, %eax\n"
+"\tclc\n"
+"\tsbbl $555666, %eax\n"
+"\tmovl %eax, out_l1\n"
+
+"\tmovl in_l, %eax\n"
+"\tstc\n"
+"\tsbbl $555666, %eax\n"
+"\tmovl %eax, out_l2\n"
+
+"\tret\n"
+);
+
+
+extern void sbb_eb_gb ( void );
+asm("\n"
+"sbb_eb_gb:\n"
+
+"\tmovb in_b, %al\n"
+"\tclc\n"
+"\tsbbb in_b2, %al\n"
+"\tmovb %al, out_b1\n"
+
+"\tmovb in_b, %al\n"
+"\tstc\n"
+"\tsbbb in_b2, %al\n"
+"\tmovb %al, out_b2\n"
+
+"\tret\n"
+);
+
+
+extern void sbb_eb_gb_2 ( void );
+asm("\n"
+"sbb_eb_gb_2:\n"
+"\tpushl %ecx\n"
+
+"\tmovb in_b, %cl\n"
+"\tmovb in_b2, %dh\n"
+"\tclc\n"
+"\tsbbb %dh,%cl\n"
+"\tmovb %cl, out_b1\n"
+
+"\tmovb in_b, %cl\n"
+"\tmovb in_b2, %dh\n"
+"\tstc\n"
+"\tsbbb %dh,%cl\n"
+"\tmovb %cl, out_b2\n"
+
+"\tpopl %ecx\n"
+"\tret\n"
+);
+
+
+extern void adc_eb_gb ( void );
+asm("\n"
+"adc_eb_gb:\n"
+
+"\tmovb in_b, %al\n"
+"\tclc\n"
+"\tadcb in_b2, %al\n"
+"\tmovb %al, out_b1\n"
+
+"\tmovb in_b, %al\n"
+"\tstc\n"
+"\tadcb in_b2, %al\n"
+"\tmovb %al, out_b2\n"
+
+"\tret\n"
+);
+
+
+extern void adc_eb_gb_2 ( void );
+asm("\n"
+"adc_eb_gb_2:\n"
+"\tpushl %ecx\n"
+
+"\tmovb in_b, %cl\n"
+"\tmovb in_b2, %dh\n"
+"\tclc\n"
+"\tadcb %dh,%cl\n"
+"\tmovb %cl, out_b1\n"
+
+"\tmovb in_b, %cl\n"
+"\tmovb in_b2, %dh\n"
+"\tstc\n"
+"\tadcb %dh,%cl\n"
+"\tmovb %cl, out_b2\n"
+
+"\tpopl %ecx\n"
+"\tret\n"
+);
+
+
+
+
+int main ( void )
+{
+   in_b = 99;
+   sbb_ib_al();
+   printf("r1 = %d %d\n", (int)out_b1, (int)out_b2);
+
+   in_w = 49999;
+   sbb_iw_ax();
+   printf("r2 = %d %d\n", (int)out_w1, (int)out_w2);
+
+   in_l = 0xF0000000;
+   sbb_il_eax();
+   printf("r3 = %d %d\n", (int)out_l1, (int)out_l2);
+
+   in_b = 99;
+   in_b2 = 88;
+   sbb_eb_gb();
+   printf("r4 = %d %d\n", (int)out_b1, (int)out_b2);
+
+   in_b = 66;
+   in_b2 = 77;
+   sbb_eb_gb_2();
+   printf("r5 = %d %d\n", (int)out_b1, (int)out_b2);
+
+   in_b = 99;
+   in_b2 = 88;
+   adc_eb_gb();
+   printf("r6 = %d %d\n", (int)out_b1, (int)out_b2);
+
+   in_b = 66;
+   in_b2 = 77;
+   adc_eb_gb_2();
+   printf("r7 = %d %d\n", (int)out_b1, (int)out_b2);
+
+   return 0;
+}
diff --git a/none/tests/x86/sbbmisc.stderr.exp b/none/tests/x86/sbbmisc.stderr.exp
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/none/tests/x86/sbbmisc.stdout.exp b/none/tests/x86/sbbmisc.stdout.exp
new file mode 100644 (file)
index 0000000..6c616b0
--- /dev/null
@@ -0,0 +1,7 @@
+r1 = 94 93
+r2 = -16092 -16093
+r3 = -268991122 -268991123
+r4 = 11 10
+r5 = -11 -12
+r6 = -69 -68
+r7 = -113 -112
diff --git a/none/tests/x86/sbbmisc.vgtest b/none/tests/x86/sbbmisc.vgtest
new file mode 100644 (file)
index 0000000..b90ba2a
--- /dev/null
@@ -0,0 +1 @@
+prog: sbbmisc