From: Julian Seward Date: Fri, 4 Nov 2005 14:38:48 +0000 (+0000) Subject: Also test jecxz. X-Git-Tag: svn/VALGRIND_3_1_0~231 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d335331fd3006774b54e9baefb4dc7709b894418;p=thirdparty%2Fvalgrind.git Also test jecxz. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5001 --- diff --git a/none/tests/amd64/jrcxz.c b/none/tests/amd64/jrcxz.c index 511ad64ed1..dad088f089 100644 --- a/none/tests/amd64/jrcxz.c +++ b/none/tests/amd64/jrcxz.c @@ -2,35 +2,68 @@ #include 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; } diff --git a/none/tests/amd64/jrcxz.stdout.exp b/none/tests/amd64/jrcxz.stdout.exp index 353c521b57..59b846e306 100644 --- a/none/tests/amd64/jrcxz.stdout.exp +++ b/none/tests/amd64/jrcxz.stdout.exp @@ -1 +1,2 @@ 17700 +218418