From: Julian Seward Date: Sat, 19 Feb 2005 22:46:11 +0000 (+0000) Subject: Test a few more bits and pieces. X-Git-Tag: svn/VALGRIND_3_0_1^2~403 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86ededc22e8689b55a6d2462d2ae1ab0f82a341c;p=thirdparty%2Fvalgrind.git Test a few more bits and pieces. git-svn-id: svn://svn.valgrind.org/vex/trunk@931 --- diff --git a/VEX/test/test-amd64-muldiv.h b/VEX/test/test-amd64-muldiv.h index d6976ac319..f8fb2de6cf 100644 --- a/VEX/test/test-amd64-muldiv.h +++ b/VEX/test/test-amd64-muldiv.h @@ -53,4 +53,22 @@ void glue(glue(test_, OP), l)(int64 op0h, int64 op0, int64 op1) stringify(OP) "l", op0h, op0, s1, resh, res, flags & CC_MASK); } +void glue(glue(test_, OP), q)(int64 op0h, int64 op0, int64 op1) +{ + int64 res, s1, flags, resh; + s1 = op1; + resh = op0h; + res = op0; + flags = 0; + asm ("pushq %5\n\t" + "popfq\n\t" + stringify(OP) "q %3\n\t" + "pushfq\n\t" + "popq %1\n\t" + : "=a" (res), "=g" (flags), "=d" (resh) + : "q" (s1), "0" (res), "1" (flags), "2" (resh)); + printf("%-10s AH=%016llx AL=%016llx B=%016llx RH=%016llx RL=%016llx CC=%04llx\n", + stringify(OP) "q", op0h, op0, s1, resh, res, flags & CC_MASK); +} + #undef OP diff --git a/VEX/test/test-amd64.c b/VEX/test/test-amd64.c index f4eaa384a7..052dd4b628 100644 --- a/VEX/test/test-amd64.c +++ b/VEX/test/test-amd64.c @@ -510,6 +510,11 @@ void test_mul(void) test_idivl(0, 0x80000000, -1); test_idivl(0x12343, 0x12345678, 0x81234567); + test_idivq(0, 0x12345678, 12347); + test_idivq(0, -233223, -45); + test_idivq(0, 0x80000000, -1); + test_idivq(0x12343, 0x12345678, 0x81234567); + test_divb(0x12341678, 0x127e); test_divb(0x43210123, -5); test_divb(0x12340004, -1); @@ -523,6 +528,11 @@ void test_mul(void) test_divl(0, -233223, -45); test_divl(0, 0x80000000, -1); test_divl(0x12343, 0x12345678, 0x81234567); + + test_divq(0, 0x12345678, 12347); + test_divq(0, -233223, -45); + test_divq(0, 0x80000000, -1); + test_divq(0x12343, 0x12345678, 0x81234567); } #define TEST_BSX(op, size, op0)\ @@ -1666,8 +1676,6 @@ int main(int argc, char **argv) void **ptr; void (*func)(void); - printf("hello\n"); - printf("hello again\n"); #if 1 ptr = &call_start + 1; while (*ptr != NULL) { @@ -1681,7 +1689,7 @@ int main(int argc, char **argv) // test_floats(); REINSTATE64 //test_bcd(); //test_xchg(); REINSTATE64 - // test_string(); REINSTATE64 FIRST + test_string(); //test_misc(); // REINSTATE test_lea(); // test_segs();