]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Also test jecxz.
authorJulian Seward <jseward@acm.org>
Fri, 4 Nov 2005 14:38:48 +0000 (14:38 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 4 Nov 2005 14:38:48 +0000 (14:38 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5001

none/tests/amd64/jrcxz.c
none/tests/amd64/jrcxz.stdout.exp

index 511ad64ed1cbfe402bfbc865fd78592427fb943a..dad088f0892dbf3fe1e496164d5f7e2bd04e7f5f 100644 (file)
@@ -2,35 +2,68 @@
 #include <stdio.h>
 
 typedef unsigned long long int ULong;
+typedef unsigned           int UInt;
 
-ULong arg, res;
+ULong arg64, res64;
 
-extern void foo ( void );
+extern void foo64 ( void );
 asm("\n"
-"foo:\n"
+"foo64:\n"
 "\tpushq %rcx\n"
 
 "\tmovq $0, %rax\n"
-"\tmovq arg, %rcx\n"
+"\tmovq arg64, %rcx\n"
 
-"Lagain:\n"
+"Lagain64:\n"
 "\taddq $177, %rax\n"
 "\tdecq %rcx\n"
-"\tjrcxz Lout\n"
-"\tjmp Lagain\n"
+"\tjrcxz Lout64\n"
+"\tjmp Lagain64\n"
 
-"Lout:\n"
-"\tmovq %rax, res\n"
+"Lout64:\n"
+"\tmovq %rax, res64\n"
 
 "\tpopq %rcx\n"
 "\tret\n"
 );
 
+
+UInt arg32, res32;
+
+extern void foo32 ( void );
+asm("\n"
+"foo32:\n"
+"\tpushq %rcx\n"
+
+"\tmovq $0, %rax\n"
+"\tmovl arg32, %ecx\n"
+
+"Lagain32:\n"
+"\taddq $177, %rax\n"
+"\tdecl %ecx\n"
+"\tjecxz Lout32\n"
+"\tjmp Lagain32\n"
+
+"Lout32:\n"
+"\tmovl %eax, res32\n"
+
+"\tpopq %rcx\n"
+"\tret\n"
+);
+
+
+
 int main ( void )
 {
-  arg = 100;
-  res = 0;
-  foo();
-  printf("%lld\n", res);
+  arg64 = 100;
+  res64 = 0;
+  foo64();
+  printf("%lld\n", res64);
+
+  arg32 = 1234;
+  res32 = 0;
+  foo32();
+  printf("%d\n", res32);
+
   return 0;
 }
index 353c521b5735ff3bfe77a38355f7e707a59cc28f..59b846e306f98aaaa4176d148940f0919e614b36 100644 (file)
@@ -1 +1,2 @@
 17700
+218418