From df517cec519572613c235bd0319b7a59646e5622 Mon Sep 17 00:00:00 2001 From: bellard Date: Mon, 5 Feb 2007 20:52:39 +0000 Subject: [PATCH] int conversion test git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2396 c046a42c-6fe2-441c-8c8c-71466251a162 --- tests/test-i386.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/test-i386.c b/tests/test-i386.c index 4a25d03..2673915 100644 --- a/tests/test-i386.c +++ b/tests/test-i386.c @@ -2583,6 +2583,41 @@ void test_sse(void) #endif +#define TEST_CONV_RAX(op)\ +{\ + unsigned long a, r;\ + a = i2l(0x8234a6f8);\ + r = a;\ + asm volatile(#op : "=a" (r) : "0" (r));\ + printf("%-10s A=" FMTLX " R=" FMTLX "\n", #op, a, r);\ +} + +#define TEST_CONV_RAX_RDX(op)\ +{\ + unsigned long a, d, r, rh; \ + a = i2l(0x8234a6f8);\ + d = i2l(0x8345a1f2);\ + r = a;\ + rh = d;\ + asm volatile(#op : "=a" (r), "=d" (rh) : "0" (r), "1" (rh)); \ + printf("%-10s A=" FMTLX " R=" FMTLX ":" FMTLX "\n", #op, a, r, rh); \ +} + +void test_conv(void) +{ + TEST_CONV_RAX(cbw); + TEST_CONV_RAX(cwde); +#if defined(__x86_64__) + TEST_CONV_RAX(cdqe); +#endif + + TEST_CONV_RAX_RDX(cwd); + TEST_CONV_RAX_RDX(cdq); +#if defined(__x86_64__) + TEST_CONV_RAX_RDX(cqo); +#endif +} + extern void *__start_initcall; extern void *__stop_initcall; @@ -2621,6 +2656,7 @@ int main(int argc, char **argv) test_single_step(); #endif test_enter(); + test_conv(); #ifdef TEST_SSE test_sse(); test_fxsave(); -- 2.7.4