Commit df517cec519572613c235bd0319b7a59646e5622

Authored by bellard
1 parent 2afbeee7

int conversion test


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2396 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 36 additions and 0 deletions
tests/test-i386.c
... ... @@ -2583,6 +2583,41 @@ void test_sse(void)
2583 2583  
2584 2584 #endif
2585 2585  
  2586 +#define TEST_CONV_RAX(op)\
  2587 +{\
  2588 + unsigned long a, r;\
  2589 + a = i2l(0x8234a6f8);\
  2590 + r = a;\
  2591 + asm volatile(#op : "=a" (r) : "0" (r));\
  2592 + printf("%-10s A=" FMTLX " R=" FMTLX "\n", #op, a, r);\
  2593 +}
  2594 +
  2595 +#define TEST_CONV_RAX_RDX(op)\
  2596 +{\
  2597 + unsigned long a, d, r, rh; \
  2598 + a = i2l(0x8234a6f8);\
  2599 + d = i2l(0x8345a1f2);\
  2600 + r = a;\
  2601 + rh = d;\
  2602 + asm volatile(#op : "=a" (r), "=d" (rh) : "0" (r), "1" (rh)); \
  2603 + printf("%-10s A=" FMTLX " R=" FMTLX ":" FMTLX "\n", #op, a, r, rh); \
  2604 +}
  2605 +
  2606 +void test_conv(void)
  2607 +{
  2608 + TEST_CONV_RAX(cbw);
  2609 + TEST_CONV_RAX(cwde);
  2610 +#if defined(__x86_64__)
  2611 + TEST_CONV_RAX(cdqe);
  2612 +#endif
  2613 +
  2614 + TEST_CONV_RAX_RDX(cwd);
  2615 + TEST_CONV_RAX_RDX(cdq);
  2616 +#if defined(__x86_64__)
  2617 + TEST_CONV_RAX_RDX(cqo);
  2618 +#endif
  2619 +}
  2620 +
2586 2621 extern void *__start_initcall;
2587 2622 extern void *__stop_initcall;
2588 2623  
... ... @@ -2621,6 +2656,7 @@ int main(int argc, char **argv)
2621 2656 test_single_step();
2622 2657 #endif
2623 2658 test_enter();
  2659 + test_conv();
2624 2660 #ifdef TEST_SSE
2625 2661 test_sse();
2626 2662 test_fxsave();
... ...